Index: third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h b/third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.h |
similarity index 51% |
copy from third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h |
copy to third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.h |
index 1b5b6d95d56a66a2bc07f03c11597e79d439c485..a01981dd481af4e9d7fb0b52964c45d95f66c2b6 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_primitive_field.h |
@@ -32,92 +32,119 @@ |
// Based on original Protocol Buffers design by |
// Sanjay Ghemawat, Jeff Dean, and others. |
-#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ |
-#define GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ |
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ |
+#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ |
#include <map> |
#include <string> |
-#include <google/protobuf/compiler/java/java_field.h> |
+#include <google/protobuf/compiler/javanano/javanano_field.h> |
namespace google { |
namespace protobuf { |
namespace compiler { |
-namespace java { |
+namespace javanano { |
class PrimitiveFieldGenerator : public FieldGenerator { |
public: |
- explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor, |
- int messageBitIndex, int builderBitIndex); |
+ explicit PrimitiveFieldGenerator( |
+ const FieldDescriptor* descriptor, const Params& params); |
~PrimitiveFieldGenerator(); |
// implements FieldGenerator --------------------------------------- |
- int GetNumBitsForMessage() const; |
- int GetNumBitsForBuilder() const; |
- void GenerateInterfaceMembers(io::Printer* printer) const; |
- void GenerateMembers(io::Printer* printer) const; |
- void GenerateBuilderMembers(io::Printer* printer) const; |
- void GenerateInitializationCode(io::Printer* printer) const; |
- void GenerateBuilderClearCode(io::Printer* printer) const; |
+ bool SavedDefaultNeeded() const; |
+ void GenerateInitSavedDefaultCode(io::Printer* printer) const; |
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const; |
+ void GenerateClearCode(io::Printer* printer) const; |
void GenerateMergingCode(io::Printer* printer) const; |
- void GenerateBuildingCode(io::Printer* printer) const; |
- void GenerateParsingCode(io::Printer* printer) const; |
- void GenerateParsingDoneCode(io::Printer* printer) const; |
void GenerateSerializationCode(io::Printer* printer) const; |
void GenerateSerializedSizeCode(io::Printer* printer) const; |
- void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; |
void GenerateEqualsCode(io::Printer* printer) const; |
- void GenerateHashCode(io::Printer* printer) const; |
- |
- string GetBoxedType() const; |
+ void GenerateHashCodeCode(io::Printer* printer) const; |
private: |
+ void GenerateSerializationConditional(io::Printer* printer) const; |
+ |
const FieldDescriptor* descriptor_; |
map<string, string> variables_; |
- const int messageBitIndex_; |
- const int builderBitIndex_; |
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); |
}; |
+class AccessorPrimitiveFieldGenerator : public FieldGenerator { |
+ public: |
+ explicit AccessorPrimitiveFieldGenerator(const FieldDescriptor* descriptor, |
+ const Params ¶ms, int has_bit_index); |
+ ~AccessorPrimitiveFieldGenerator(); |
+ |
+ // implements FieldGenerator --------------------------------------- |
+ bool SavedDefaultNeeded() const; |
+ void GenerateInitSavedDefaultCode(io::Printer* printer) const; |
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const; |
+ void GenerateClearCode(io::Printer* printer) const; |
+ void GenerateMergingCode(io::Printer* printer) const; |
+ void GenerateSerializationCode(io::Printer* printer) const; |
+ void GenerateSerializedSizeCode(io::Printer* printer) const; |
+ void GenerateEqualsCode(io::Printer* printer) const; |
+ void GenerateHashCodeCode(io::Printer* printer) const; |
+ |
+ private: |
+ const FieldDescriptor* descriptor_; |
+ map<string, string> variables_; |
+ |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AccessorPrimitiveFieldGenerator); |
+}; |
+ |
+class PrimitiveOneofFieldGenerator : public FieldGenerator { |
+ public: |
+ explicit PrimitiveOneofFieldGenerator( |
+ const FieldDescriptor* descriptor, const Params& params); |
+ ~PrimitiveOneofFieldGenerator(); |
+ |
+ // implements FieldGenerator --------------------------------------- |
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const; |
+ void GenerateClearCode(io::Printer* printer) const; |
+ void GenerateMergingCode(io::Printer* printer) const; |
+ void GenerateSerializationCode(io::Printer* printer) const; |
+ void GenerateSerializedSizeCode(io::Printer* printer) const; |
+ void GenerateEqualsCode(io::Printer* printer) const; |
+ void GenerateHashCodeCode(io::Printer* printer) const; |
+ |
+ private: |
+ const FieldDescriptor* descriptor_; |
+ map<string, string> variables_; |
+ |
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); |
+}; |
+ |
class RepeatedPrimitiveFieldGenerator : public FieldGenerator { |
public: |
explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, |
- int messageBitIndex, int builderBitIndex); |
+ const Params& params); |
~RepeatedPrimitiveFieldGenerator(); |
// implements FieldGenerator --------------------------------------- |
- int GetNumBitsForMessage() const; |
- int GetNumBitsForBuilder() const; |
- void GenerateInterfaceMembers(io::Printer* printer) const; |
- void GenerateMembers(io::Printer* printer) const; |
- void GenerateBuilderMembers(io::Printer* printer) const; |
- void GenerateInitializationCode(io::Printer* printer) const; |
- void GenerateBuilderClearCode(io::Printer* printer) const; |
+ void GenerateMembers(io::Printer* printer, bool lazy_init) const; |
+ void GenerateClearCode(io::Printer* printer) const; |
void GenerateMergingCode(io::Printer* printer) const; |
- void GenerateBuildingCode(io::Printer* printer) const; |
- void GenerateParsingCode(io::Printer* printer) const; |
- void GenerateParsingCodeFromPacked(io::Printer* printer) const; |
- void GenerateParsingDoneCode(io::Printer* printer) const; |
+ void GenerateMergingCodeFromPacked(io::Printer* printer) const; |
void GenerateSerializationCode(io::Printer* printer) const; |
void GenerateSerializedSizeCode(io::Printer* printer) const; |
- void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; |
void GenerateEqualsCode(io::Printer* printer) const; |
- void GenerateHashCode(io::Printer* printer) const; |
- |
- string GetBoxedType() const; |
+ void GenerateHashCodeCode(io::Printer* printer) const; |
+ void GenerateFixClonedCode(io::Printer* printer) const; |
private: |
+ void GenerateRepeatedDataSizeCode(io::Printer* printer) const; |
+ |
const FieldDescriptor* descriptor_; |
map<string, string> variables_; |
- const int messageBitIndex_; |
- const int builderBitIndex_; |
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); |
}; |
-} // namespace java |
+} // namespace javanano |
} // namespace compiler |
} // namespace protobuf |
} // namespace google |
-#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_PRIMITIVE_FIELD_H__ |
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ |