TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BnetFileGenerator.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: [email protected] (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 
35 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__
36 #define GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__
37 
38 #include <memory>
39 #include <string>
40 #include <vector>
44 
45 class BnetServiceGenerator; // service.h
46 
47 namespace google
48 {
49  namespace protobuf
50  {
51  class FileDescriptor; // descriptor.h
52  namespace io
53  {
54  class Printer; // printer.h
55  }
56  }
57 
58  namespace protobuf
59  {
60  namespace compiler
61  {
62  namespace cpp
63  {
64 
65  class EnumGenerator; // enum.h
66  class MessageGenerator; // message.h
67  class ExtensionGenerator; // extension.h
68  }
69  }
70  }
71 }
72 
73 namespace pb = google::protobuf;
74 namespace pbcpp = pb::compiler::cpp;
75 
77 {
78 public:
79  // See generator.cc for the meaning of dllexport_decl.
80  explicit BnetFileGenerator(const pb::FileDescriptor* file,
81  const pbcpp::Options& options);
83 
84  void GenerateHeader(pb::io::Printer* printer);
85  void GenerateSource(pb::io::Printer* printer);
86 
87 private:
88  // Generate the BuildDescriptors() procedure, which builds all descriptors
89  // for types defined in the file.
90  void GenerateBuildDescriptors(pb::io::Printer* printer);
91 
92  void GenerateNamespaceOpeners(pb::io::Printer* printer);
93  void GenerateNamespaceClosers(pb::io::Printer* printer);
94 
96 
97  pb::scoped_array<pb::scoped_ptr<pbcpp::MessageGenerator>> message_generators_;
98  pb::scoped_array<pb::scoped_ptr<pbcpp::EnumGenerator>> enum_generators_;
99  pb::scoped_array<pb::scoped_ptr<BnetServiceGenerator>> service_generators_;
100  pb::scoped_array<pb::scoped_ptr<pbcpp::ExtensionGenerator>> extension_generators_;
101 
102  // E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}.
103  std::vector<std::string> package_parts_;
104  const pbcpp::Options options_;
105 
107 };
108 
109 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_FILE_H__
pb::scoped_array< pb::scoped_ptr< pbcpp::EnumGenerator > > enum_generators_
Definition: BnetFileGenerator.h:98
~BnetFileGenerator()
Definition: BnetFileGenerator.cpp:93
const pbcpp::Options options_
Definition: BnetFileGenerator.h:104
void GenerateBuildDescriptors(pb::io::Printer *printer)
Definition: BnetFileGenerator.cpp:445
Definition: BnetFileGenerator.h:49
pb::scoped_array< pb::scoped_ptr< pbcpp::ExtensionGenerator > > extension_generators_
Definition: BnetFileGenerator.h:100
Definition: BnetFileGenerator.h:76
BnetFileGenerator(const pb::FileDescriptor *file, const pbcpp::Options &options)
Definition: BnetFileGenerator.cpp:53
void GenerateNamespaceOpeners(pb::io::Printer *printer)
Definition: BnetFileGenerator.cpp:678
std::vector< std::string > package_parts_
Definition: BnetFileGenerator.h:103
pb::scoped_array< pb::scoped_ptr< BnetServiceGenerator > > service_generators_
Definition: BnetFileGenerator.h:99
void GenerateSource(pb::io::Printer *printer)
Definition: BnetFileGenerator.cpp:316
void GenerateHeader(pb::io::Printer *printer)
Definition: BnetFileGenerator.cpp:95
pb::scoped_array< pb::scoped_ptr< pbcpp::MessageGenerator > > message_generators_
Definition: BnetFileGenerator.h:97
Definition: printer.h:64
Definition: BnetServiceGenerator.h:37
void GenerateNamespaceClosers(pb::io::Printer *printer)
Definition: BnetFileGenerator.cpp:690
Definition: BnetFileGenerator.h:47
const pb::FileDescriptor * file_
Definition: BnetFileGenerator.h:95
Definition: descriptor.h:986
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BnetFileGenerator)