blob: 16aa97ac686a76a029fd554d1dae334cf33a143d [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
2#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
3
4// cpp_generator.h/.cc do not directly depend on GRPC/ProtoBuf, such that they
5// can be used to generate code for other serialization systems, such as
6// FlatBuffers.
7
8#include <memory>
9#include <vector>
10
Austin Schuhe89fa2d2019-08-14 20:24:23 -070011#include "src/compiler/schema_interface.h"
12
13#ifndef GRPC_CUSTOM_STRING
James Kuszmaul8e62b022022-03-22 09:33:25 -070014# include <string>
15# define GRPC_CUSTOM_STRING std::string
Austin Schuhe89fa2d2019-08-14 20:24:23 -070016#endif
17
18namespace grpc {
19
20typedef GRPC_CUSTOM_STRING string;
21
22} // namespace grpc
23
24namespace grpc_cpp_generator {
25
26// Contains all the parameters that are parsed from the command line.
27struct Parameters {
28 // Puts the service into a namespace
29 grpc::string services_namespace;
30 // Use system includes (<>) or local includes ("")
31 bool use_system_headers;
32 // Prefix to any grpc include
33 grpc::string grpc_search_path;
34 // Generate GMOCK code to facilitate unit testing.
35 bool generate_mock_code;
36};
37
38// Return the prologue of the generated header file.
39grpc::string GetHeaderPrologue(grpc_generator::File *file,
40 const Parameters &params);
41
42// Return the includes needed for generated header file.
43grpc::string GetHeaderIncludes(grpc_generator::File *file,
44 const Parameters &params);
45
46// Return the includes needed for generated source file.
47grpc::string GetSourceIncludes(grpc_generator::File *file,
48 const Parameters &params);
49
50// Return the epilogue of the generated header file.
51grpc::string GetHeaderEpilogue(grpc_generator::File *file,
52 const Parameters &params);
53
54// Return the prologue of the generated source file.
55grpc::string GetSourcePrologue(grpc_generator::File *file,
56 const Parameters &params);
57
58// Return the services for generated header file.
59grpc::string GetHeaderServices(grpc_generator::File *file,
60 const Parameters &params);
61
62// Return the services for generated source file.
63grpc::string GetSourceServices(grpc_generator::File *file,
64 const Parameters &params);
65
66// Return the epilogue of the generated source file.
67grpc::string GetSourceEpilogue(grpc_generator::File *file,
68 const Parameters &params);
69
70// Return the prologue of the generated mock file.
71grpc::string GetMockPrologue(grpc_generator::File *file,
72 const Parameters &params);
73
74// Return the includes needed for generated mock file.
75grpc::string GetMockIncludes(grpc_generator::File *file,
76 const Parameters &params);
77
78// Return the services for generated mock file.
79grpc::string GetMockServices(grpc_generator::File *file,
80 const Parameters &params);
81
82// Return the epilogue of generated mock file.
83grpc::string GetMockEpilogue(grpc_generator::File *file,
84 const Parameters &params);
85
86// Return the prologue of the generated mock file.
87grpc::string GetMockPrologue(grpc_generator::File *file,
88 const Parameters &params);
89
90// Return the includes needed for generated mock file.
91grpc::string GetMockIncludes(grpc_generator::File *file,
92 const Parameters &params);
93
94// Return the services for generated mock file.
95grpc::string GetMockServices(grpc_generator::File *file,
96 const Parameters &params);
97
98// Return the epilogue of generated mock file.
99grpc::string GetMockEpilogue(grpc_generator::File *file,
100 const Parameters &params);
101
102} // namespace grpc_cpp_generator
103
104#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H