aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/java')
-rw-r--r--src/google/protobuf/compiler/java/java_doc_comment.h6
-rw-r--r--src/google/protobuf/compiler/java/java_enum_field.h8
-rw-r--r--src/google/protobuf/compiler/java/java_enum_field_lite.h8
-rw-r--r--src/google/protobuf/compiler/java/java_extension.h6
-rw-r--r--src/google/protobuf/compiler/java/java_extension_lite.h2
-rw-r--r--src/google/protobuf/compiler/java/java_field.h20
-rw-r--r--src/google/protobuf/compiler/java/java_file.cc4
-rw-r--r--src/google/protobuf/compiler/java/java_file.h16
-rw-r--r--src/google/protobuf/compiler/java/java_generator.h10
-rw-r--r--src/google/protobuf/compiler/java/java_helpers.h78
-rw-r--r--src/google/protobuf/compiler/java/java_map_field.h4
-rw-r--r--src/google/protobuf/compiler/java/java_map_field_lite.h4
-rw-r--r--src/google/protobuf/compiler/java/java_message_field.h8
-rw-r--r--src/google/protobuf/compiler/java/java_message_field_lite.h8
-rw-r--r--src/google/protobuf/compiler/java/java_message_lite.cc16
-rw-r--r--src/google/protobuf/compiler/java/java_name_resolver.h36
-rw-r--r--src/google/protobuf/compiler/java/java_names.h12
-rw-r--r--src/google/protobuf/compiler/java/java_primitive_field.h8
-rw-r--r--src/google/protobuf/compiler/java/java_primitive_field_lite.h8
-rw-r--r--src/google/protobuf/compiler/java/java_service.h2
-rw-r--r--src/google/protobuf/compiler/java/java_shared_code_generator.h4
-rw-r--r--src/google/protobuf/compiler/java/java_string_field.h8
-rw-r--r--src/google/protobuf/compiler/java/java_string_field_lite.h8
23 files changed, 147 insertions, 137 deletions
diff --git a/src/google/protobuf/compiler/java/java_doc_comment.h b/src/google/protobuf/compiler/java/java_doc_comment.h
index 112c3bc3..ef9b3a90 100644
--- a/src/google/protobuf/compiler/java/java_doc_comment.h
+++ b/src/google/protobuf/compiler/java/java_doc_comment.h
@@ -37,6 +37,8 @@
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace io {
@@ -61,11 +63,13 @@ void WriteMethodDocComment(io::Printer* printer,
const MethodDescriptor* method);
// Exposed for testing only.
-LIBPROTOC_EXPORT string EscapeJavadoc(const string& input);
+PROTOC_EXPORT std::string EscapeJavadoc(const std::string& input);
} // namespace java
} // namespace compiler
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_DOC_COMMENT_H__
diff --git a/src/google/protobuf/compiler/java/java_enum_field.h b/src/google/protobuf/compiler/java/java_enum_field.h
index 842da592..723102d8 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.h
+++ b/src/google/protobuf/compiler/java/java_enum_field.h
@@ -81,11 +81,11 @@ class ImmutableEnumFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
@@ -142,11 +142,11 @@ class RepeatedImmutableEnumFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.h b/src/google/protobuf/compiler/java/java_enum_field_lite.h
index 6bda426f..bf25ffaa 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.h
@@ -79,11 +79,11 @@ class ImmutableEnumFieldLiteGenerator : public ImmutableFieldLiteGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
@@ -136,11 +136,11 @@ class RepeatedImmutableEnumFieldLiteGenerator
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
diff --git a/src/google/protobuf/compiler/java/java_extension.h b/src/google/protobuf/compiler/java/java_extension.h
index 7a58373f..1f11324c 100644
--- a/src/google/protobuf/compiler/java/java_extension.h
+++ b/src/google/protobuf/compiler/java/java_extension.h
@@ -80,9 +80,9 @@ class ExtensionGenerator {
protected:
static void InitTemplateVars(const FieldDescriptor* descriptor,
- const string& scope, bool immutable,
+ const std::string& scope, bool immutable,
ClassNameResolver* name_resolver,
- std::map<string, string>* vars_pointer);
+ std::map<std::string, std::string>* vars_pointer);
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
@@ -102,7 +102,7 @@ class ImmutableExtensionGenerator : public ExtensionGenerator {
const FieldDescriptor* descriptor_;
Context* context_;
ClassNameResolver* name_resolver_;
- string scope_;
+ std::string scope_;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableExtensionGenerator);
diff --git a/src/google/protobuf/compiler/java/java_extension_lite.h b/src/google/protobuf/compiler/java/java_extension_lite.h
index 34716f9d..eaa90a4b 100644
--- a/src/google/protobuf/compiler/java/java_extension_lite.h
+++ b/src/google/protobuf/compiler/java/java_extension_lite.h
@@ -63,7 +63,7 @@ class ImmutableExtensionLiteGenerator : public ExtensionGenerator {
const FieldDescriptor* descriptor_;
Context* context_;
ClassNameResolver* name_resolver_;
- string scope_;
+ std::string scope_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableExtensionLiteGenerator);
};
diff --git a/src/google/protobuf/compiler/java/java_field.h b/src/google/protobuf/compiler/java/java_field.h
index 881427d7..abefc589 100644
--- a/src/google/protobuf/compiler/java/java_field.h
+++ b/src/google/protobuf/compiler/java/java_field.h
@@ -87,7 +87,7 @@ class ImmutableFieldGenerator {
virtual void GenerateEqualsCode(io::Printer* printer) const = 0;
virtual void GenerateHashCode(io::Printer* printer) const = 0;
- virtual string GetBoxedType() const = 0;
+ virtual std::string GetBoxedType() const = 0;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldGenerator);
@@ -118,7 +118,7 @@ class ImmutableFieldLiteGenerator {
virtual void GenerateHashCode(io::Printer* printer) const = 0;
- virtual string GetBoxedType() const = 0;
+ virtual std::string GetBoxedType() const = 0;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableFieldLiteGenerator);
@@ -171,29 +171,29 @@ FieldGeneratorMap<ImmutableFieldLiteGenerator>::~FieldGeneratorMap();
// Field information used in FieldGeneartors.
struct FieldGeneratorInfo {
- string name;
- string capitalized_name;
- string disambiguated_reason;
+ std::string name;
+ std::string capitalized_name;
+ std::string disambiguated_reason;
};
// Oneof information used in OneofFieldGenerators.
struct OneofGeneratorInfo {
- string name;
- string capitalized_name;
+ std::string name;
+ std::string capitalized_name;
};
// Set some common variables used in variable FieldGenerators.
void SetCommonFieldVariables(const FieldDescriptor* descriptor,
const FieldGeneratorInfo* info,
- std::map<string, string>* variables);
+ std::map<std::string, std::string>* variables);
// Set some common oneof variables used in OneofFieldGenerators.
void SetCommonOneofVariables(const FieldDescriptor* descriptor,
const OneofGeneratorInfo* info,
- std::map<string, string>* variables);
+ std::map<std::string, std::string>* variables);
// Print useful comments before a field's accessors.
-void PrintExtraFieldInfo(const std::map<string, string>& variables,
+void PrintExtraFieldInfo(const std::map<std::string, std::string>& variables,
io::Printer* printer);
} // namespace java
diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
index 5dc2dff8..5356512c 100644
--- a/src/google/protobuf/compiler/java/java_file.cc
+++ b/src/google/protobuf/compiler/java/java_file.cc
@@ -232,7 +232,9 @@ bool FileGenerator::Validate(string* error) {
<< "will be ignored by protoc in the future and protoc will always "
<< "generate full runtime code for Java. To use Java Lite runtime, "
<< "users should use the Java Lite plugin instead. See:\n"
- << " https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md";
+ << " "
+ "https://github.com/protocolbuffers/protobuf/blob/master/java/"
+ "lite.md";
}
return true;
}
diff --git a/src/google/protobuf/compiler/java/java_file.h b/src/google/protobuf/compiler/java/java_file.h
index 4158d48b..9dca82bb 100644
--- a/src/google/protobuf/compiler/java/java_file.h
+++ b/src/google/protobuf/compiler/java/java_file.h
@@ -74,20 +74,20 @@ class FileGenerator {
// Checks for problems that would otherwise lead to cryptic compile errors.
// Returns true if there are no problems, or writes an error description to
// the given string and returns false otherwise.
- bool Validate(string* error);
+ bool Validate(std::string* error);
void Generate(io::Printer* printer);
// If we aren't putting everything into one file, this will write all the
// files other than the outer file (i.e. one for each message, enum, and
// service type).
- void GenerateSiblings(const string& package_dir,
+ void GenerateSiblings(const std::string& package_dir,
GeneratorContext* generator_context,
- std::vector<string>* file_list,
- std::vector<string>* annotation_list);
+ std::vector<std::string>* file_list,
+ std::vector<std::string>* annotation_list);
- const string& java_package() { return java_package_; }
- const string& classname() { return classname_; }
+ const std::string& java_package() { return java_package_; }
+ const std::string& classname() { return classname_; }
private:
void GenerateDescriptorInitializationCodeForImmutable(io::Printer* printer);
@@ -97,8 +97,8 @@ class FileGenerator {
bool immutable_api_);
const FileDescriptor* file_;
- string java_package_;
- string classname_;
+ std::string java_package_;
+ std::string classname_;
std::vector<std::unique_ptr<MessageGenerator>> message_generators_;
std::vector<std::unique_ptr<ExtensionGenerator>> extension_generators_;
diff --git a/src/google/protobuf/compiler/java/java_generator.h b/src/google/protobuf/compiler/java/java_generator.h
index 6eefdd84..21873581 100644
--- a/src/google/protobuf/compiler/java/java_generator.h
+++ b/src/google/protobuf/compiler/java/java_generator.h
@@ -40,6 +40,8 @@
#include <string>
#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -49,16 +51,16 @@ namespace java {
// own protocol compiler binary and you want it to support Java output, you
// can do so by registering an instance of this CodeGenerator with the
// CommandLineInterface in your main() function.
-class LIBPROTOC_EXPORT JavaGenerator : public CodeGenerator {
+class PROTOC_EXPORT JavaGenerator : public CodeGenerator {
public:
JavaGenerator();
~JavaGenerator();
// implements CodeGenerator ----------------------------------------
bool Generate(const FileDescriptor* file,
- const string& parameter,
+ const std::string& parameter,
GeneratorContext* context,
- string* error) const;
+ std::string* error) const;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator);
@@ -69,4 +71,6 @@ class LIBPROTOC_EXPORT JavaGenerator : public CodeGenerator {
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h
index 375bd67d..93caa3dc 100644
--- a/src/google/protobuf/compiler/java/java_helpers.h
+++ b/src/google/protobuf/compiler/java/java_helpers.h
@@ -60,89 +60,89 @@ extern const char kThinSeparator[];
// annotation_file should be generated from the filename of the source file
// being annotated (which in turn must be a Java identifier plus ".java").
void PrintGeneratedAnnotation(io::Printer* printer, char delimiter = '$',
- const string& annotation_file = "");
+ const std::string& annotation_file = "");
// If a GeneratedMessageLite contains non-lite enums, then its verifier
// must be instantiated inline, rather than retrieved from the enum class.
void PrintEnumVerifierLogic(io::Printer* printer,
const FieldDescriptor* descriptor,
- const std::map<string, string>& variables,
+ const std::map<std::string, std::string>& variables,
const char* var_name,
const char* terminating_string,
bool enforce_lite);
// Converts a name to camel-case. If cap_first_letter is true, capitalize the
// first letter.
-string UnderscoresToCamelCase(const string& name, bool cap_first_letter);
+std::string UnderscoresToCamelCase(const std::string& name, bool cap_first_letter);
// Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
// "fooBarBaz" or "FooBarBaz", respectively.
-string UnderscoresToCamelCase(const FieldDescriptor* field);
-string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCamelCase(const FieldDescriptor* field);
+std::string UnderscoresToCapitalizedCamelCase(const FieldDescriptor* field);
// Similar, but for method names. (Typically, this merely has the effect
// of lower-casing the first letter of the name.)
-string UnderscoresToCamelCase(const MethodDescriptor* method);
+std::string UnderscoresToCamelCase(const MethodDescriptor* method);
// Similar to UnderscoresToCamelCase, but guarentees that the result is a
// complete Java identifier by adding a _ if needed.
-string CamelCaseFieldName(const FieldDescriptor* field);
+std::string CamelCaseFieldName(const FieldDescriptor* field);
// Get an identifier that uniquely identifies this type within the file.
// This is used to declare static variables related to this type at the
// outermost file scope.
-string UniqueFileScopeIdentifier(const Descriptor* descriptor);
+std::string UniqueFileScopeIdentifier(const Descriptor* descriptor);
// Strips ".proto" or ".protodevel" from the end of a filename.
-string StripProto(const string& filename);
+std::string StripProto(const std::string& filename);
// Gets the unqualified class name for the file. For each .proto file, there
// will be one Java class containing all the immutable messages and another
// Java class containing all the mutable messages.
// TODO(xiaofeng): remove the default value after updating client code.
-string FileClassName(const FileDescriptor* file, bool immutable = true);
+std::string FileClassName(const FileDescriptor* file, bool immutable = true);
// Returns the file's Java package name.
-string FileJavaPackage(const FileDescriptor* file);
-string FileJavaPackage(const FileDescriptor* file, bool immutable);
+std::string FileJavaPackage(const FileDescriptor* file);
+std::string FileJavaPackage(const FileDescriptor* file, bool immutable);
// Returns output directory for the given package name.
-string JavaPackageToDir(string package_name);
+std::string JavaPackageToDir(std::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.
// TODO(xiaofeng): this method is deprecated and should be removed in the
// future.
-string ToJavaName(const string& full_name,
+std::string ToJavaName(const std::string& full_name,
const FileDescriptor* file);
// TODO(xiaofeng): the following methods are kept for they are exposed
// publicly in //net/proto2/compiler/java/public/names.h. They return
// immutable names only and should be removed after mutable API is
// integrated into google3.
-string ClassName(const Descriptor* descriptor);
-string ClassName(const EnumDescriptor* descriptor);
-string ClassName(const ServiceDescriptor* descriptor);
-string ClassName(const FileDescriptor* descriptor);
+std::string ClassName(const Descriptor* descriptor);
+std::string ClassName(const EnumDescriptor* descriptor);
+std::string ClassName(const ServiceDescriptor* descriptor);
+std::string ClassName(const FileDescriptor* descriptor);
// Comma-separate list of option-specified interfaces implemented by the
// Message, to follow the "implements" declaration of the Message definition.
-string ExtraMessageInterfaces(const Descriptor* descriptor);
+std::string ExtraMessageInterfaces(const Descriptor* descriptor);
// Comma-separate list of option-specified interfaces implemented by the
// MutableMessage, to follow the "implements" declaration of the MutableMessage
// definition.
-string ExtraMutableMessageInterfaces(const Descriptor* descriptor);
+std::string ExtraMutableMessageInterfaces(const Descriptor* descriptor);
// Comma-separate list of option-specified interfaces implemented by the
// Builder, to follow the "implements" declaration of the Builder definition.
-string ExtraBuilderInterfaces(const Descriptor* descriptor);
+std::string ExtraBuilderInterfaces(const Descriptor* descriptor);
// Comma-separate list of option-specified interfaces extended by the
// MessageOrBuilder, to follow the "extends" declaration of the
// MessageOrBuilder definition.
-string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor);
+std::string ExtraMessageOrBuilderInterfaces(const Descriptor* descriptor);
// Get the unqualified Java class name for mutable messages. i.e. without
// package or outer classnames.
-inline string ShortMutableJavaClassName(const Descriptor* descriptor) {
+inline std::string ShortMutableJavaClassName(const Descriptor* descriptor) {
return descriptor->name();
}
@@ -179,14 +179,14 @@ inline bool IsOwnFile(const ServiceDescriptor* descriptor, bool immutable) {
// annotation data for that descriptor. `suffix` is usually empty, but may
// (e.g.) be "OrBuilder" for some generated interfaces.
template <typename Descriptor>
-string AnnotationFileName(const Descriptor* descriptor, const string& suffix) {
+std::string AnnotationFileName(const Descriptor* descriptor, const std::string& suffix) {
return descriptor->name() + suffix + ".java.pb.meta";
}
template <typename Descriptor>
void MaybePrintGeneratedAnnotation(Context* context, io::Printer* printer,
Descriptor* descriptor, bool immutable,
- const string& suffix = "") {
+ const std::string& suffix = "") {
if (context->options().annotate_code && IsOwnFile(descriptor, immutable)) {
PrintGeneratedAnnotation(printer, '$',
AnnotationFileName(descriptor, suffix));
@@ -195,7 +195,7 @@ void MaybePrintGeneratedAnnotation(Context* context, io::Printer* printer,
// Get the unqualified name that should be used for a field's field
// number constant.
-string FieldConstantName(const FieldDescriptor *field);
+std::string FieldConstantName(const FieldDescriptor *field);
// Returns the type of the FieldDescriptor.
// This does nothing interesting for the open source release, but is used for
@@ -229,9 +229,9 @@ const char* BoxedPrimitiveTypeName(JavaType type);
const char* FieldTypeName(const FieldDescriptor::Type field_type);
class ClassNameResolver;
-string DefaultValue(const FieldDescriptor* field, bool immutable,
+std::string DefaultValue(const FieldDescriptor* field, bool immutable,
ClassNameResolver* name_resolver);
-inline string ImmutableDefaultValue(const FieldDescriptor* field,
+inline std::string ImmutableDefaultValue(const FieldDescriptor* field,
ClassNameResolver* name_resolver) {
return DefaultValue(field, true, name_resolver);
}
@@ -267,50 +267,50 @@ inline bool HasGenericServices(const FileDescriptor *file, bool enforce_lite) {
// Methods for shared bitfields.
// Gets the name of the shared bitfield for the given index.
-string GetBitFieldName(int index);
+std::string GetBitFieldName(int index);
// Gets the name of the shared bitfield for the given bit index.
// Effectively, GetBitFieldName(bitIndex / 32)
-string GetBitFieldNameForBit(int bitIndex);
+std::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);
+std::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);
+std::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);
+std::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);
+std::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);
+std::string GenerateSetBitToLocal(int bitIndex);
// Does the same as GenerateGetBit but operates on the bit field on a local
// variable. This is used by the parsing constructor to record if a repeated
// field is mutable.
// Example: "((mutable_bitField1_ & 0x04) == 0x04)"
-string GenerateGetBitMutableLocal(int bitIndex);
+std::string GenerateGetBitMutableLocal(int bitIndex);
// Does the same as GenerateSetBit but operates on the bit field on a local
// variable. This is used by the parsing constructor to record if a repeated
// field is mutable.
// Example: "mutable_bitField1_ = (mutable_bitField1_ | 0x04)"
-string GenerateSetBitMutableLocal(int bitIndex);
+std::string GenerateSetBitMutableLocal(int bitIndex);
// Returns whether the JavaType is a reference type.
bool IsReferenceType(JavaType type);
@@ -398,7 +398,7 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) {
descriptor->file()->options().java_string_check_utf8();
}
-inline string GeneratedCodeVersionSuffix() {
+inline std::string GeneratedCodeVersionSuffix() {
return "V3";
}
@@ -410,7 +410,7 @@ inline void WriteIntToUtf16CharSequence(int value,
}
// Escape a UTF-16 character so it can be embedded in a Java string literal.
-void EscapeUtf16ToString(uint16 code, string* output);
+void EscapeUtf16ToString(uint16 code, std::string* output);
// Only the lowest two bytes of the return value are used. The lowest byte
// is the integer value of a j/c/g/protobuf/FieldType enum. For the other
diff --git a/src/google/protobuf/compiler/java/java_map_field.h b/src/google/protobuf/compiler/java/java_map_field.h
index 90c90eb2..b123b041 100644
--- a/src/google/protobuf/compiler/java/java_map_field.h
+++ b/src/google/protobuf/compiler/java/java_map_field.h
@@ -63,11 +63,11 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
ClassNameResolver* name_resolver_;
void GenerateMapGetters(io::Printer* printer) const;
};
diff --git a/src/google/protobuf/compiler/java/java_map_field_lite.h b/src/google/protobuf/compiler/java/java_map_field_lite.h
index 710617ae..df5fe64d 100644
--- a/src/google/protobuf/compiler/java/java_map_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_map_field_lite.h
@@ -62,11 +62,11 @@ class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator {
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
Context* context_;
ClassNameResolver* name_resolver_;
};
diff --git a/src/google/protobuf/compiler/java/java_message_field.h b/src/google/protobuf/compiler/java/java_message_field.h
index d70d8270..58344e55 100644
--- a/src/google/protobuf/compiler/java/java_message_field.h
+++ b/src/google/protobuf/compiler/java/java_message_field.h
@@ -82,11 +82,11 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
@@ -150,11 +150,11 @@ class RepeatedImmutableMessageFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
diff --git a/src/google/protobuf/compiler/java/java_message_field_lite.h b/src/google/protobuf/compiler/java/java_message_field_lite.h
index c9eb30b8..7e78ca4f 100644
--- a/src/google/protobuf/compiler/java/java_message_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_message_field_lite.h
@@ -79,11 +79,11 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
@@ -136,11 +136,11 @@ class RepeatedImmutableMessageFieldLiteGenerator
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index 85a7453d..a131e8cc 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -736,14 +736,14 @@ void ImmutableMessageLiteGenerator::GenerateSerializeOneExtensionRange(
void ImmutableMessageLiteGenerator::GenerateBuilder(io::Printer* printer) {
printer->Print(
- "public static Builder newBuilder() {\n"
- " return (Builder) DEFAULT_INSTANCE.createBuilder();\n"
- "}\n"
- "public static Builder newBuilder($classname$ prototype) {\n"
- " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n"
- "}\n"
- "\n",
- "classname", name_resolver_->GetImmutableClassName(descriptor_));
+ "public static Builder newBuilder() {\n"
+ " return (Builder) DEFAULT_INSTANCE.createBuilder();\n"
+ "}\n"
+ "public static Builder newBuilder($classname$ prototype) {\n"
+ " return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);\n"
+ "}\n"
+ "\n",
+ "classname", name_resolver_->GetImmutableClassName(descriptor_));
MessageBuilderLiteGenerator builderGenerator(descriptor_, context_);
builderGenerator.Generate(printer);
diff --git a/src/google/protobuf/compiler/java/java_name_resolver.h b/src/google/protobuf/compiler/java/java_name_resolver.h
index 90684da2..aa19f007 100644
--- a/src/google/protobuf/compiler/java/java_name_resolver.h
+++ b/src/google/protobuf/compiler/java/java_name_resolver.h
@@ -56,63 +56,63 @@ class ClassNameResolver {
~ClassNameResolver();
// Gets the unqualified outer class name for the file.
- string GetFileClassName(const FileDescriptor* file, bool immutable);
+ std::string GetFileClassName(const FileDescriptor* file, bool immutable);
// Gets the unqualified immutable outer class name of a file.
- string GetFileImmutableClassName(const FileDescriptor* file);
+ std::string GetFileImmutableClassName(const FileDescriptor* file);
// Gets the unqualified default immutable outer class name of a file
// (converted from the proto file's name).
- string GetFileDefaultImmutableClassName(const FileDescriptor* file);
+ std::string GetFileDefaultImmutableClassName(const FileDescriptor* file);
// Check whether there is any type defined in the proto file that has
// the given class name.
bool HasConflictingClassName(const FileDescriptor* file,
- const string& classname);
+ const std::string& classname);
// Gets the name of the outer class that holds descriptor information.
// Descriptors are shared between immutable messages and mutable messages.
// Since both of them are generated optionally, the descriptors need to be
// put in another common place.
- string GetDescriptorClassName(const FileDescriptor* file);
+ std::string GetDescriptorClassName(const FileDescriptor* file);
// Gets the fully-qualified class name corresponding to the given descriptor.
- string GetClassName(const Descriptor* descriptor, bool immutable);
- string GetClassName(const EnumDescriptor* descriptor, bool immutable);
- string GetClassName(const ServiceDescriptor* descriptor, bool immutable);
- string GetClassName(const FileDescriptor* descriptor, bool immutable);
+ std::string GetClassName(const Descriptor* descriptor, bool immutable);
+ std::string GetClassName(const EnumDescriptor* descriptor, bool immutable);
+ std::string GetClassName(const ServiceDescriptor* descriptor, bool immutable);
+ std::string GetClassName(const FileDescriptor* descriptor, bool immutable);
template<class DescriptorType>
- string GetImmutableClassName(const DescriptorType* descriptor) {
+ std::string GetImmutableClassName(const DescriptorType* descriptor) {
return GetClassName(descriptor, true);
}
template<class DescriptorType>
- string GetMutableClassName(const DescriptorType* descriptor) {
+ std::string GetMutableClassName(const DescriptorType* descriptor) {
return GetClassName(descriptor, false);
}
// Gets the fully qualified name of an extension identifier.
- string GetExtensionIdentifierName(const FieldDescriptor* descriptor,
+ std::string GetExtensionIdentifierName(const FieldDescriptor* descriptor,
bool immutable);
// Gets the fully qualified name for generated classes in Java convention.
// Nested classes will be separated using '$' instead of '.'
// For example:
// com.package.OuterClass$OuterMessage$InnerMessage
- string GetJavaImmutableClassName(const Descriptor* descriptor);
- string GetJavaImmutableClassName(const EnumDescriptor* descriptor);
+ std::string GetJavaImmutableClassName(const Descriptor* descriptor);
+ std::string GetJavaImmutableClassName(const EnumDescriptor* descriptor);
private:
// Get the full name of a Java class by prepending the Java package name
// or outer class name.
- string GetClassFullName(const string& name_without_package,
+ std::string GetClassFullName(const std::string& name_without_package,
const FileDescriptor* file,
bool immutable,
bool multiple_files);
// Get the Java Class style full name of a message.
- string GetJavaClassFullName(
- const string& name_without_package,
+ std::string GetJavaClassFullName(
+ const std::string& name_without_package,
const FileDescriptor* file,
bool immutable);
// Caches the result to provide better performance.
- std::map<const FileDescriptor*, string> file_immutable_outer_class_names_;
+ std::map<const FileDescriptor*, std::string> file_immutable_outer_class_names_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ClassNameResolver);
};
diff --git a/src/google/protobuf/compiler/java/java_names.h b/src/google/protobuf/compiler/java/java_names.h
index 39e8c51f..a8efbb49 100644
--- a/src/google/protobuf/compiler/java/java_names.h
+++ b/src/google/protobuf/compiler/java/java_names.h
@@ -57,41 +57,41 @@ namespace java {
//
// Returns:
// The fully-qualified Java class name.
-string ClassName(const Descriptor* descriptor);
+std::string ClassName(const Descriptor* descriptor);
// Requires:
// descriptor != NULL
//
// Returns:
// The fully-qualified Java class name.
-string ClassName(const EnumDescriptor* descriptor);
+std::string ClassName(const EnumDescriptor* descriptor);
// Requires:
// descriptor != NULL
//
// Returns:
// The fully-qualified Java class name.
-string ClassName(const FileDescriptor* descriptor);
+std::string ClassName(const FileDescriptor* descriptor);
// Requires:
// descriptor != NULL
//
// Returns:
// The fully-qualified Java class name.
-string ClassName(const ServiceDescriptor* descriptor);
+std::string ClassName(const ServiceDescriptor* descriptor);
// Requires:
// descriptor != NULL
//
// Returns:
// Java package name.
-string FileJavaPackage(const FileDescriptor* descriptor);
+std::string FileJavaPackage(const FileDescriptor* descriptor);
// Requires:
// descriptor != NULL
// Returns:
// Captialized camel case name field name.
-string CapitalizedFieldName(const FieldDescriptor* descriptor);
+std::string CapitalizedFieldName(const FieldDescriptor* descriptor);
// Requires:
// descriptor != NULL
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.h b/src/google/protobuf/compiler/java/java_primitive_field.h
index a1368057..185a268e 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.h
+++ b/src/google/protobuf/compiler/java/java_primitive_field.h
@@ -82,11 +82,11 @@ class ImmutablePrimitiveFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
@@ -143,11 +143,11 @@ class RepeatedImmutablePrimitiveFieldGenerator
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
diff --git a/src/google/protobuf/compiler/java/java_primitive_field_lite.h b/src/google/protobuf/compiler/java/java_primitive_field_lite.h
index c12e458c..6c05521f 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_primitive_field_lite.h
@@ -82,11 +82,11 @@ class ImmutablePrimitiveFieldLiteGenerator
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
@@ -143,11 +143,11 @@ class RepeatedImmutablePrimitiveFieldLiteGenerator
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
diff --git a/src/google/protobuf/compiler/java/java_service.h b/src/google/protobuf/compiler/java/java_service.h
index f34cd798..24b0ccaa 100644
--- a/src/google/protobuf/compiler/java/java_service.h
+++ b/src/google/protobuf/compiler/java/java_service.h
@@ -125,7 +125,7 @@ class ImmutableServiceGenerator : public ServiceGenerator {
const MethodDescriptor* method);
// Return the output type of the method.
- string GetOutput(const MethodDescriptor* method);
+ std::string GetOutput(const MethodDescriptor* method);
Context* context_;
ClassNameResolver* name_resolver_;
diff --git a/src/google/protobuf/compiler/java/java_shared_code_generator.h b/src/google/protobuf/compiler/java/java_shared_code_generator.h
index 1eb6feaf..2f09c3a9 100644
--- a/src/google/protobuf/compiler/java/java_shared_code_generator.h
+++ b/src/google/protobuf/compiler/java/java_shared_code_generator.h
@@ -70,8 +70,8 @@ class SharedCodeGenerator {
~SharedCodeGenerator();
void Generate(GeneratorContext* generator_context,
- std::vector<string>* file_list,
- std::vector<string>* annotation_file_list);
+ std::vector<std::string>* file_list,
+ std::vector<std::string>* annotation_file_list);
void GenerateDescriptors(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/java/java_string_field.h b/src/google/protobuf/compiler/java/java_string_field.h
index 7f9fa0ed..38fb8365 100644
--- a/src/google/protobuf/compiler/java/java_string_field.h
+++ b/src/google/protobuf/compiler/java/java_string_field.h
@@ -82,11 +82,11 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
@@ -141,11 +141,11 @@ class RepeatedImmutableStringFieldGenerator : public ImmutableFieldGenerator {
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
const int builderBitIndex_;
Context* context_;
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.h b/src/google/protobuf/compiler/java/java_string_field_lite.h
index 684d3b00..89d5c1ae 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.h
@@ -81,11 +81,11 @@ class ImmutableStringFieldLiteGenerator : public ImmutableFieldLiteGenerator {
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
protected:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;
@@ -137,11 +137,11 @@ class RepeatedImmutableStringFieldLiteGenerator
void GenerateHashCode(io::Printer* printer) const;
- string GetBoxedType() const;
+ std::string GetBoxedType() const;
private:
const FieldDescriptor* descriptor_;
- std::map<string, string> variables_;
+ std::map<std::string, std::string> variables_;
const int messageBitIndex_;
Context* context_;
ClassNameResolver* name_resolver_;