File indexing completed on 2025-01-31 10:11:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__
0014 #define GOOGLE_PROTOBUF_COMPILER_JAVA_STRING_FIELD_H__
0015
0016 #include <string>
0017
0018 #include "google/protobuf/compiler/java/full/field_generator.h"
0019 #include "google/protobuf/descriptor.h"
0020
0021 namespace google {
0022 namespace protobuf {
0023 namespace compiler {
0024 namespace java {
0025 class Context;
0026 class ClassNameResolver;
0027 }
0028 }
0029 }
0030 }
0031
0032 namespace google {
0033 namespace protobuf {
0034 namespace compiler {
0035 namespace java {
0036
0037 class ImmutableStringFieldGenerator : public ImmutableFieldGenerator {
0038 public:
0039 explicit ImmutableStringFieldGenerator(const FieldDescriptor* descriptor,
0040 int messageBitIndex,
0041 int builderBitIndex, Context* context);
0042 ImmutableStringFieldGenerator(const ImmutableStringFieldGenerator&) = delete;
0043 ImmutableStringFieldGenerator& operator=(
0044 const ImmutableStringFieldGenerator&) = delete;
0045 ~ImmutableStringFieldGenerator() override;
0046
0047
0048
0049 int GetMessageBitIndex() const override;
0050 int GetBuilderBitIndex() const override;
0051 int GetNumBitsForMessage() const override;
0052 int GetNumBitsForBuilder() const override;
0053 void GenerateInterfaceMembers(io::Printer* printer) const override;
0054 void GenerateMembers(io::Printer* printer) const override;
0055 void GenerateBuilderMembers(io::Printer* printer) const override;
0056 void GenerateInitializationCode(io::Printer* printer) const override;
0057 void GenerateBuilderClearCode(io::Printer* printer) const override;
0058 void GenerateMergingCode(io::Printer* printer) const override;
0059 void GenerateBuildingCode(io::Printer* printer) const override;
0060 void GenerateBuilderParsingCode(io::Printer* printer) const override;
0061 void GenerateSerializationCode(io::Printer* printer) const override;
0062 void GenerateSerializedSizeCode(io::Printer* printer) const override;
0063 void GenerateFieldBuilderInitializationCode(
0064 io::Printer* printer) const override;
0065 void GenerateEqualsCode(io::Printer* printer) const override;
0066 void GenerateHashCode(io::Printer* printer) const override;
0067 void GenerateKotlinDslMembers(io::Printer* printer) const override;
0068
0069 std::string GetBoxedType() const override;
0070
0071 protected:
0072 const FieldDescriptor* descriptor_;
0073 int message_bit_index_;
0074 int builder_bit_index_;
0075 absl::flat_hash_map<absl::string_view, std::string> variables_;
0076 Context* context_;
0077 ClassNameResolver* name_resolver_;
0078 };
0079
0080 class ImmutableStringOneofFieldGenerator
0081 : public ImmutableStringFieldGenerator {
0082 public:
0083 ImmutableStringOneofFieldGenerator(const FieldDescriptor* descriptor,
0084 int messageBitIndex, int builderBitIndex,
0085 Context* context);
0086 ImmutableStringOneofFieldGenerator(
0087 const ImmutableStringOneofFieldGenerator&) = delete;
0088 ImmutableStringOneofFieldGenerator& operator=(
0089 const ImmutableStringOneofFieldGenerator&) = delete;
0090 ~ImmutableStringOneofFieldGenerator() override;
0091
0092 private:
0093 void GenerateMembers(io::Printer* printer) const override;
0094 void GenerateBuilderMembers(io::Printer* printer) const override;
0095 void GenerateBuilderClearCode(io::Printer* printer) const override;
0096 void GenerateMergingCode(io::Printer* printer) const override;
0097 void GenerateBuildingCode(io::Printer* printer) const override;
0098 void GenerateBuilderParsingCode(io::Printer* printer) const override;
0099 void GenerateSerializationCode(io::Printer* printer) const override;
0100 void GenerateSerializedSizeCode(io::Printer* printer) const override;
0101 };
0102
0103 class RepeatedImmutableStringFieldGenerator
0104 : public ImmutableStringFieldGenerator {
0105 public:
0106 explicit RepeatedImmutableStringFieldGenerator(
0107 const FieldDescriptor* descriptor, int messageBitIndex,
0108 int builderBitIndex, Context* context);
0109 RepeatedImmutableStringFieldGenerator(
0110 const RepeatedImmutableStringFieldGenerator&) = delete;
0111 RepeatedImmutableStringFieldGenerator& operator=(
0112 const RepeatedImmutableStringFieldGenerator&) = delete;
0113 ~RepeatedImmutableStringFieldGenerator() override;
0114
0115
0116 int GetNumBitsForMessage() const override;
0117 int GetNumBitsForBuilder() const override;
0118 void GenerateInterfaceMembers(io::Printer* printer) const override;
0119 void GenerateMembers(io::Printer* printer) const override;
0120 void GenerateBuilderMembers(io::Printer* printer) const override;
0121 void GenerateInitializationCode(io::Printer* printer) const override;
0122 void GenerateBuilderClearCode(io::Printer* printer) const override;
0123 void GenerateMergingCode(io::Printer* printer) const override;
0124 void GenerateBuildingCode(io::Printer* printer) const override;
0125 void GenerateBuilderParsingCode(io::Printer* printer) const override;
0126 void GenerateSerializationCode(io::Printer* printer) const override;
0127 void GenerateSerializedSizeCode(io::Printer* printer) const override;
0128 void GenerateFieldBuilderInitializationCode(
0129 io::Printer* printer) const override;
0130 void GenerateEqualsCode(io::Printer* printer) const override;
0131 void GenerateHashCode(io::Printer* printer) const override;
0132 void GenerateKotlinDslMembers(io::Printer* printer) const override;
0133
0134 std::string GetBoxedType() const override;
0135 };
0136
0137 }
0138 }
0139 }
0140 }
0141
0142 #endif