28 #include <google/protobuf/compiler/code_generator.h>
29 #include <google/protobuf/io/zero_copy_stream.h>
33 #include <google/protobuf/descriptor.h>
35 namespace google {
namespace protobuf {
39 class GeneratorContext;
42 namespace QtProtobuf {
129 class GeneratorBase:
public ::google::protobuf::compiler::CodeGenerator
136 GeneratorBase(Mode mode);
137 virtual ~GeneratorBase() =
default;
139 virtual bool GenerateAll(
const std::vector<const ::google::protobuf::FileDescriptor *> &files,
140 const std::string ¶meter,
141 ::google::protobuf::compiler::GeneratorContext *generatorContext,
142 std::string *error)
const override;
143 bool HasGenerateAll()
const override {
return true; }
145 static void printDisclaimer(
const std::shared_ptr<::google::protobuf::io::Printer> printer);
146 static void printPreamble(
const std::shared_ptr<::google::protobuf::io::Printer> printer);
147 static void printInclude(
const std::shared_ptr<::google::protobuf::io::Printer> printer,
const google::protobuf::Descriptor *message,
const google::protobuf::FieldDescriptor *field, std::set<std::string> &existingIncludes);
148 static void printQtProtobufUsingNamespace(
const std::shared_ptr<::google::protobuf::io::Printer> printer);
149 static void printNamespaces(
const std::shared_ptr<::google::protobuf::io::Printer> printer,
const std::vector<std::string> namespaces);
151 static std::string generateBaseName(const ::google::protobuf::FileDescriptor *file, std::string name);