TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BnetServiceGenerator.h
Go to the documentation of this file.
1 //
2 // Created by tea on 10.03.16.
3 //
4 
5 #ifndef PROTOC_BNET_BNETSERVICEGENERATOR_H
6 #define PROTOC_BNET_BNETSERVICEGENERATOR_H
7 
9 #include <cstdint>
10 #include <string>
11 #include <map>
12 
13 namespace google
14 {
15  namespace protobuf
16  {
17  class ServiceDescriptor;
18 
19  namespace io
20  {
21  class Printer;
22  }
23 
24  namespace compiler
25  {
26  namespace cpp
27  {
28  struct Options;
29  }
30  }
31  }
32 }
33 
34 namespace pb = google::protobuf;
35 namespace pbcpp = pb::compiler::cpp;
36 
38 {
39 public:
40  // See generator.cc for the meaning of dllexport_decl.
42  const pbcpp::Options& options);
44 
45  // Header stuff.
46 
47  // Generate the class definitions for the service's interface and the
48  // stub implementation.
49  void GenerateDeclarations(pb::io::Printer* printer);
50 
51  // Source file stuff.
52 
53  // Generate code that initializes the global variable storing the service's
54  // descriptor.
55  void GenerateDescriptorInitializer(pb::io::Printer* printer, int index);
56 
57  // Generate implementations of everything declared by GenerateDeclarations().
58  void GenerateImplementation(pb::io::Printer* printer);
59 
60 private:
61  // Header stuff.
62 
63  // Generate the service abstract interface.
64  void GenerateInterface(pb::io::Printer* printer);
65 
66  // Prints signatures for all methods in the
67  void GenerateClientMethodSignatures(pb::io::Printer* printer);
68  void GenerateServerMethodSignatures(pb::io::Printer* printer);
69 
70  // Source file stuff.
71 
72  void GenerateClientMethodImplementations(pb::io::Printer* printer);
73 
74  // Generate the CallMethod() method of the service.
75  void GenerateServerCallMethod(pb::io::Printer* printer);
76  void GenerateServerImplementations(pb::io::Printer* printer);
77 
78  std::uint32_t HashServiceName(std::string const& name);
79 
81  std::map<std::string, std::string> vars_;
82 
84 };
85 
86 #endif //PROTOC_BNET_BNETSERVICEGENERATOR_H
void GenerateClientMethodSignatures(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:83
void GenerateDeclarations(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:29
void GenerateServerCallMethod(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:204
void GenerateClientMethodImplementations(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:159
Definition: BnetFileGenerator.h:49
Definition: descriptor.h:846
void GenerateServerMethodSignatures(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:106
unsigned int uint32_t
Definition: stdint.h:80
void GenerateInterface(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:34
std::uint32_t HashServiceName(std::string const &name)
Definition: BnetServiceGenerator.cpp:309
void GenerateServerImplementations(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:273
void GenerateImplementation(pb::io::Printer *printer)
Definition: BnetServiceGenerator.cpp:139
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BnetServiceGenerator)
const pb::ServiceDescriptor * descriptor_
Definition: BnetServiceGenerator.h:80
BnetServiceGenerator(const pb::ServiceDescriptor *descriptor, const pbcpp::Options &options)
Definition: BnetServiceGenerator.cpp:14
Definition: BnetServiceGenerator.h:37
std::map< std::string, std::string > vars_
Definition: BnetServiceGenerator.h:81
~BnetServiceGenerator()
Definition: BnetServiceGenerator.cpp:27
Definition: BnetFileGenerator.h:47
void GenerateDescriptorInitializer(pb::io::Printer *printer, int index)
Definition: BnetServiceGenerator.cpp:128