diff options
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_helpers.h')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_helpers.h | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index 5d30240..f99b5fe 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -35,18 +35,12 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ -#include <map> #include <string> #include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.pb.h> namespace google { namespace protobuf { - -namespace io { -class Printer; -} - namespace compiler { namespace cpp { @@ -103,12 +97,6 @@ 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); @@ -121,43 +109,27 @@ 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); - -// 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) { +// Do message classes in this file keep track of unknown fields? +inline bool HasUnknownFields(const FileDescriptor *file) { return file->options().optimize_for() != FileOptions::LITE_RUNTIME; } - -// Does this file have any enum type definitions? -bool HasEnumDefinitions(const FileDescriptor* file); - // Does this file have generated parsing, serialization, and other // standard methods for which reflection-based fallback implementations exist? -inline bool HasGeneratedMethods(const FileDescriptor* file) { +inline bool HasGeneratedMethods(const FileDescriptor *file) { return file->options().optimize_for() != FileOptions::CODE_SIZE; } -// Do message classes in this file have descriptor and reflection methods? -inline bool HasDescriptorMethods(const FileDescriptor* file) { +// Do message classes in this file have descriptor and refelction methods? +inline bool HasDescriptorMethods(const FileDescriptor *file) { return file->options().optimize_for() != FileOptions::LITE_RUNTIME; } // Should we generate generic services for this file? -inline bool HasGenericServices(const FileDescriptor* file) { +inline bool HasGenericServices(const FileDescriptor *file) { return file->service_count() > 0 && file->options().optimize_for() != FileOptions::LITE_RUNTIME && file->options().cc_generic_services(); @@ -175,28 +147,6 @@ inline bool HasFastArraySerialization(const FileDescriptor* file) { return file->options().optimize_for() == FileOptions::SPEED; } -// Returns whether we have to generate code with static initializers. -bool StaticInitializersForced(const FileDescriptor* file); - -// Prints 'with_static_init' if static initializers have to be used for the -// provided file. Otherwise emits both 'with_static_init' and -// 'without_static_init' using #ifdef. -void PrintHandlingOptionalStaticInitializers( - const FileDescriptor* file, io::Printer* printer, - const char* with_static_init, const char* without_static_init, - const char* var1 = NULL, const string& val1 = "", - const char* var2 = NULL, const string& val2 = ""); - -void PrintHandlingOptionalStaticInitializers( - const map<string, string>& vars, const FileDescriptor* file, - io::Printer* printer, const char* with_static_init, - 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 |