diff options
author | jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-07-18 00:47:59 +0000 |
---|---|---|
committer | jieluo@google.com <jieluo@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-07-18 00:47:59 +0000 |
commit | 4de8f55113007fdc8e34107950e605fc0209d465 (patch) | |
tree | 92b7da8757a7740d9e1f2d3ead233542947d8c8c /src/google/protobuf/compiler/cpp/cpp_helpers.h | |
parent | c5553a3d18f80132b9079c5504bc0aa1f7f950a0 (diff) |
down integrate to svn
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_helpers.h')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_helpers.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 526e19cc..27444d5a 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -103,6 +103,12 @@ const char* PrimitiveTypeName(FieldDescriptor::CppType type); // methods of WireFormat. For example, TYPE_INT32 becomes "Int32". const char* DeclaredTypeMethodName(FieldDescriptor::Type type); +// Return the code that evaluates to the number when compiled. +string Int32ToString(int number); + +// Return the code that evaluates to the number when compiled. +string Int64ToString(int64 number); + // Get code that evaluates to the field's default value. string DefaultValue(const FieldDescriptor* field); @@ -115,14 +121,23 @@ string GlobalAddDescriptorsName(const string& filename); // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename); +// Return the qualified C++ name for a file level symbol. +string QualifiedFileLevelSymbol(const string& package, const string& name); + // Return the name of the ShutdownFile() function for a given file. string GlobalShutdownFileName(const string& filename); // Escape C++ trigraphs by escaping question marks to \? string EscapeTrigraphs(const string& to_escape); -// Do message classes in this file keep track of unknown fields? -inline bool HasUnknownFields(const FileDescriptor* file) { +// Escaped function name to eliminate naming conflict. +string SafeFunctionName(const Descriptor* descriptor, + const FieldDescriptor* field, + const string& prefix); + +// Do message classes in this file use UnknownFieldSet? +// Otherwise, messages will store unknown fields in a string +inline bool UseUnknownFieldSet(const FileDescriptor* file) { return file->options().optimize_for() != FileOptions::LITE_RUNTIME; } @@ -178,6 +193,11 @@ void PrintHandlingOptionalStaticInitializers( const char* without_static_init); +// Returns true if the field's CPPTYPE is string or message. +bool IsStringOrMessage(const FieldDescriptor* field); + +string UnderscoresToCamelCase(const string& input, bool cap_next_letter); + } // namespace cpp } // namespace compiler } // namespace protobuf |