File indexing completed on 2025-01-31 10:11:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__
0013 #define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_BUILDER_H__
0014
0015 #include <memory>
0016 #include <string>
0017 #include <vector>
0018
0019 #include "absl/container/btree_map.h"
0020 #include "google/protobuf/compiler/java/full/field_generator.h"
0021 #include "google/protobuf/descriptor.h"
0022
0023 namespace google {
0024 namespace protobuf {
0025 namespace compiler {
0026 namespace java {
0027 class Context;
0028 class ClassNameResolver;
0029 }
0030 }
0031 namespace io {
0032 class Printer;
0033 }
0034 }
0035 }
0036
0037 namespace google {
0038 namespace protobuf {
0039 namespace compiler {
0040 namespace java {
0041
0042 class MessageBuilderGenerator {
0043 public:
0044 explicit MessageBuilderGenerator(const Descriptor* descriptor,
0045 Context* context);
0046 MessageBuilderGenerator(const MessageBuilderGenerator&) = delete;
0047 MessageBuilderGenerator& operator=(const MessageBuilderGenerator&) = delete;
0048 virtual ~MessageBuilderGenerator();
0049
0050 virtual void Generate(io::Printer* printer);
0051
0052 private:
0053 void GenerateCommonBuilderMethods(io::Printer* printer);
0054 void GenerateBuildPartial(io::Printer* printer);
0055 int GenerateBuildPartialPiece(io::Printer* printer, int piece,
0056 int first_field);
0057 int GenerateBuildPartialPieceWithoutPresence(io::Printer* printer, int piece,
0058 int first_field);
0059 void GenerateDescriptorMethods(io::Printer* printer);
0060 void GenerateBuilderParsingMethods(io::Printer* printer);
0061 void GenerateBuilderFieldParsingCases(io::Printer* printer);
0062 void GenerateBuilderFieldParsingCase(io::Printer* printer,
0063 const FieldDescriptor* field);
0064 void GenerateBuilderPackedFieldParsingCase(io::Printer* printer,
0065 const FieldDescriptor* field);
0066 void GenerateIsInitialized(io::Printer* printer);
0067
0068 const Descriptor* descriptor_;
0069 Context* context_;
0070 ClassNameResolver* name_resolver_;
0071 FieldGeneratorMap<ImmutableFieldGenerator> field_generators_;
0072 absl::btree_map<int, const OneofDescriptor*> oneofs_;
0073 };
0074
0075 }
0076 }
0077 }
0078 }
0079
0080 #endif