File indexing completed on 2025-01-31 10:11:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
0013 #define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
0014
0015 #include <string>
0016
0017 #include "absl/container/flat_hash_map.h"
0018 #include "google/protobuf/compiler/cpp/helpers.h"
0019 #include "google/protobuf/compiler/cpp/options.h"
0020 #include "google/protobuf/port.h"
0021
0022
0023 #include "google/protobuf/port_def.inc"
0024
0025 namespace google {
0026 namespace protobuf {
0027 class FieldDescriptor;
0028 namespace io {
0029 class Printer;
0030 }
0031 }
0032 }
0033
0034 namespace google {
0035 namespace protobuf {
0036 namespace compiler {
0037 namespace cpp {
0038
0039 class MessageSCCAnalyzer;
0040
0041
0042
0043
0044 class PROTOC_EXPORT ExtensionGenerator {
0045 public:
0046
0047 explicit ExtensionGenerator(const FieldDescriptor* descriptor,
0048 const Options& options,
0049 MessageSCCAnalyzer* scc_analyzer);
0050 ExtensionGenerator(const ExtensionGenerator&) = delete;
0051 ExtensionGenerator& operator=(const ExtensionGenerator&) = delete;
0052 ~ExtensionGenerator();
0053
0054
0055 void GenerateDeclaration(io::Printer* p) const;
0056
0057
0058 void GenerateDefinition(io::Printer* p);
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 void GenerateRegistration(io::Printer* p, InitPriority priority);
0073 bool WillGenerateRegistration(InitPriority priority);
0074
0075 bool IsScoped() const;
0076
0077 private:
0078 const FieldDescriptor* descriptor_;
0079 std::string type_traits_;
0080 Options options_;
0081 MessageSCCAnalyzer* scc_analyzer_;
0082
0083 absl::flat_hash_map<absl::string_view, std::string> variables_;
0084 };
0085
0086 }
0087 }
0088 }
0089 }
0090
0091 #include "google/protobuf/port_undef.inc"
0092
0093 #endif