File indexing completed on 2025-01-31 10:11:57
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_JAVA_MAP_FIELD_H__
0010
0011 #include "google/protobuf/compiler/java/context.h"
0012 #include "google/protobuf/compiler/java/full/field_generator.h"
0013 #include "google/protobuf/descriptor.h"
0014 #include "google/protobuf/io/printer.h"
0015
0016 namespace google {
0017 namespace protobuf {
0018 namespace compiler {
0019 namespace java {
0020
0021 class ImmutableMapFieldGenerator : public ImmutableFieldGenerator {
0022 public:
0023 explicit ImmutableMapFieldGenerator(const FieldDescriptor* descriptor,
0024 int messageBitIndex, int builderBitIndex,
0025 Context* context);
0026 ~ImmutableMapFieldGenerator() override = default;
0027
0028
0029 int GetMessageBitIndex() const override;
0030 int GetBuilderBitIndex() const override;
0031 int GetNumBitsForMessage() const override;
0032 int GetNumBitsForBuilder() const override;
0033 void GenerateInterfaceMembers(io::Printer* printer) const override;
0034 void GenerateMembers(io::Printer* printer) const override;
0035 void GenerateBuilderMembers(io::Printer* printer) const override;
0036 void GenerateInitializationCode(io::Printer* printer) const override;
0037 void GenerateBuilderClearCode(io::Printer* printer) const override;
0038 void GenerateMergingCode(io::Printer* printer) const override;
0039 void GenerateBuildingCode(io::Printer* printer) const override;
0040 void GenerateBuilderParsingCode(io::Printer* printer) const override;
0041 void GenerateSerializationCode(io::Printer* printer) const override;
0042 void GenerateSerializedSizeCode(io::Printer* printer) const override;
0043 void GenerateFieldBuilderInitializationCode(
0044 io::Printer* printer) const override;
0045 void GenerateEqualsCode(io::Printer* printer) const override;
0046 void GenerateHashCode(io::Printer* printer) const override;
0047 void GenerateKotlinDslMembers(io::Printer* printer) const override;
0048
0049 std::string GetBoxedType() const override;
0050
0051 private:
0052 const FieldDescriptor* descriptor_;
0053 int message_bit_index_;
0054 int builder_bit_index_;
0055 absl::flat_hash_map<absl::string_view, std::string> variables_;
0056 ClassNameResolver* name_resolver_;
0057 Context* context_;
0058 void SetMessageVariables(const FieldGeneratorInfo* info);
0059 void GenerateMapGetters(io::Printer* printer) const;
0060 void GenerateMessageMapBuilderMembers(io::Printer* printer) const;
0061 void GenerateMessageMapGetters(io::Printer* printer) const;
0062 };
0063
0064 }
0065 }
0066 }
0067 }
0068
0069 #endif