Index: third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h |
index 002e177ebe0bf9a58c731750807abd492f2a3f4f..88efd459bbe26341b4fda840948034e36ee0d121 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h |
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_helpers.h |
@@ -68,6 +68,9 @@ string FileClassName(const FileDescriptor* file); |
// Returns the file's Java package name. |
string FileJavaPackage(const FileDescriptor* file); |
+// Returns output directory for the given package name. |
+string JavaPackageToDir(string package_name); |
+ |
// Converts the given fully-qualified name in the proto namespace to its |
// fully-qualified name in the Java namespace, given that it is in the given |
// file. |
@@ -118,6 +121,7 @@ JavaType GetJavaType(const FieldDescriptor* field); |
const char* BoxedPrimitiveTypeName(JavaType type); |
string DefaultValue(const FieldDescriptor* field); |
+bool IsDefaultValueJavaDefault(const FieldDescriptor* field); |
// Does this message class keep track of unknown fields? |
inline bool HasUnknownFields(const Descriptor* descriptor) { |
@@ -133,6 +137,11 @@ inline bool HasGeneratedMethods(const Descriptor* descriptor) { |
FileOptions::CODE_SIZE; |
} |
+// Does this message have specialized equals() and hashCode() methods? |
+inline bool HasEqualsAndHashCode(const Descriptor* descriptor) { |
+ return descriptor->file()->options().java_generate_equals_and_hash(); |
+} |
+ |
// Does this message class have descriptor and reflection methods? |
inline bool HasDescriptorMethods(const Descriptor* descriptor) { |
return descriptor->file()->options().optimize_for() != |
@@ -147,6 +156,12 @@ inline bool HasDescriptorMethods(const FileDescriptor* descriptor) { |
FileOptions::LITE_RUNTIME; |
} |
+inline bool HasNestedBuilders(const Descriptor* descriptor) { |
+ // The proto-lite version doesn't support nested builders. |
+ return descriptor->file()->options().optimize_for() != |
+ FileOptions::LITE_RUNTIME; |
+} |
+ |
// Should we generate generic services for this file? |
inline bool HasGenericServices(const FileDescriptor *file) { |
return file->service_count() > 0 && |
@@ -154,6 +169,43 @@ inline bool HasGenericServices(const FileDescriptor *file) { |
file->options().java_generic_services(); |
} |
+ |
+// Methods for shared bitfields. |
+ |
+// Gets the name of the shared bitfield for the given index. |
+string GetBitFieldName(int index); |
+ |
+// Gets the name of the shared bitfield for the given bit index. |
+// Effectively, GetBitFieldName(bitIndex / 32) |
+string GetBitFieldNameForBit(int bitIndex); |
+ |
+// Generates the java code for the expression that returns the boolean value |
+// of the bit of the shared bitfields for the given bit index. |
+// Example: "((bitField1_ & 0x04) == 0x04)" |
+string GenerateGetBit(int bitIndex); |
+ |
+// Generates the java code for the expression that sets the bit of the shared |
+// bitfields for the given bit index. |
+// Example: "bitField1_ = (bitField1_ | 0x04)" |
+string GenerateSetBit(int bitIndex); |
+ |
+// Generates the java code for the expression that clears the bit of the shared |
+// bitfields for the given bit index. |
+// Example: "bitField1_ = (bitField1_ & ~0x04)" |
+string GenerateClearBit(int bitIndex); |
+ |
+// Does the same as GenerateGetBit but operates on the bit field on a local |
+// variable. This is used by the builder to copy the value in the builder to |
+// the message. |
+// Example: "((from_bitField1_ & 0x04) == 0x04)" |
+string GenerateGetBitFromLocal(int bitIndex); |
+ |
+// Does the same as GenerateSetBit but operates on the bit field on a local |
+// variable. This is used by the builder to copy the value in the builder to |
+// the message. |
+// Example: "to_bitField1_ = (to_bitField1_ | 0x04)" |
+string GenerateSetBitToLocal(int bitIndex); |
+ |
} // namespace java |
} // namespace compiler |
} // namespace protobuf |