diff options
Diffstat (limited to 'src/google/protobuf/descriptor.h')
-rw-r--r-- | src/google/protobuf/descriptor.h | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 115d4ddc..08caab2e 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -123,6 +123,10 @@ class GeneratedMessageReflection; // Defined in command_line_interface.cc namespace compiler { class CommandLineInterface; +namespace cpp { +// Defined in helpers.h +class Formatter; +} // namespace cpp } // namespace compiler namespace descriptor_unittest { @@ -210,7 +214,7 @@ class LIBPROTOBUF_EXPORT LazyDescriptor { const Descriptor* descriptor_; const string* name_; - GoogleOnceDynamic* once_; + internal::once_flag* once_; const FileDescriptor* file_; }; } // namespace internal @@ -245,9 +249,8 @@ class LIBPROTOBUF_EXPORT Descriptor { // Get options for this message type. These are specified in the .proto file // by placing lines like "option foo = 1234;" in the message definition. - // Allowed options are defined by MessageOptions in - // google/protobuf/descriptor.proto, and any available extensions of that - // message. + // Allowed options are defined by MessageOptions in descriptor.proto, and any + // available extensions of that message. const MessageOptions& options() const; // Write the contents of this Descriptor into the given DescriptorProto. @@ -420,10 +423,11 @@ class LIBPROTOBUF_EXPORT Descriptor { typedef MessageOptions OptionsType; // Allows tests to test CopyTo(proto, true). - friend class ::google::protobuf::descriptor_unittest::DescriptorTest; + friend class descriptor_unittest::DescriptorTest; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // Fill the json_name field of FieldDescriptorProto. void CopyJsonNameTo(DescriptorProto* proto) const; @@ -683,9 +687,8 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { // Get the FieldOptions for this field. This includes things listed in // square brackets after the field definition. E.g., the field: // optional string text = 1 [ctype=CORD]; - // has the "ctype" option set. Allowed options are defined by FieldOptions - // in google/protobuf/descriptor.proto, and any available extensions of that - // message. + // has the "ctype" option set. Allowed options are defined by FieldOptions in + // descriptor.proto, and any available extensions of that message. const FieldOptions& options() const; // See Descriptor::CopyTo(). @@ -720,7 +723,8 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { typedef FieldOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // Fill the json_name field of FieldDescriptorProto. void CopyJsonNameTo(FieldDescriptorProto* proto) const; @@ -753,7 +757,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptor { // Otherwise, it has the same value as camelcase_name_. const string* json_name_; const FileDescriptor* file_; - GoogleOnceDynamic* type_once_; + internal::once_flag* type_once_; static void TypeOnceInit(const FieldDescriptor* to_init); void InternalTypeOnceInit() const; mutable Type type_; @@ -850,7 +854,8 @@ class LIBPROTOBUF_EXPORT OneofDescriptor { typedef OneofOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // See Descriptor::DebugString(). void DebugString(int depth, string* contents, @@ -915,8 +920,8 @@ class LIBPROTOBUF_EXPORT EnumDescriptor { // Get options for this enum type. These are specified in the .proto file by // placing lines like "option foo = 1234;" in the enum definition. Allowed - // options are defined by EnumOptions in google/protobuf/descriptor.proto, - // and any available extensions of that message. + // options are defined by EnumOptions in descriptor.proto, and any available + // extensions of that message. const EnumOptions& options() const; // See Descriptor::CopyTo(). @@ -975,7 +980,8 @@ class LIBPROTOBUF_EXPORT EnumDescriptor { typedef EnumOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // Looks up a value by number. If the value does not exist, dynamically // creates a new EnumValueDescriptor for that value, assuming that it was @@ -1055,11 +1061,10 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptor { // The type of this value. Never NULL. const EnumDescriptor* type() const; - // Get options for this enum value. These are specified in the .proto file - // by adding text like "[foo = 1234]" after an enum value definition. - // Allowed options are defined by EnumValueOptions in - // google/protobuf/descriptor.proto, and any available extensions of that - // message. + // Get options for this enum value. These are specified in the .proto file by + // adding text like "[foo = 1234]" after an enum value definition. Allowed + // options are defined by EnumValueOptions in descriptor.proto, and any + // available extensions of that message. const EnumValueOptions& options() const; // See Descriptor::CopyTo(). @@ -1083,7 +1088,8 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptor { typedef EnumValueOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // See Descriptor::DebugString(). void DebugString(int depth, string *contents, @@ -1129,9 +1135,8 @@ class LIBPROTOBUF_EXPORT ServiceDescriptor { // Get options for this service type. These are specified in the .proto file // by placing lines like "option foo = 1234;" in the service definition. - // Allowed options are defined by ServiceOptions in - // google/protobuf/descriptor.proto, and any available extensions of that - // message. + // Allowed options are defined by ServiceOptions in descriptor.proto, and any + // available extensions of that message. const ServiceOptions& options() const; // The number of methods this service defines. @@ -1163,7 +1168,8 @@ class LIBPROTOBUF_EXPORT ServiceDescriptor { typedef ServiceOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // See Descriptor::DebugString(). void DebugString(string *contents, const DebugStringOptions& options) const; @@ -1222,8 +1228,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptor { // Get options for this method. These are specified in the .proto file by // placing lines like "option foo = 1234;" in curly-braces after a method // declaration. Allowed options are defined by MethodOptions in - // google/protobuf/descriptor.proto, and any available extensions of that - // message. + // descriptor.proto, and any available extensions of that message. const MethodOptions& options() const; // See Descriptor::CopyTo(). @@ -1247,7 +1252,8 @@ class LIBPROTOBUF_EXPORT MethodDescriptor { typedef MethodOptions OptionsType; // Allows access to GetLocationPath for annotations. - friend class ::google::protobuf::io::Printer; + friend class io::Printer; + friend class compiler::cpp::Formatter; // See Descriptor::DebugString(). void DebugString(int depth, string *contents, @@ -1283,7 +1289,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptor { class LIBPROTOBUF_EXPORT FileDescriptor { public: // The filename, relative to the source tree. - // e.g. "google/protobuf/descriptor.proto" + // e.g. "foo/bar/baz.proto" const string& name() const; // The package, e.g. "google.protobuf.compiler". @@ -1345,8 +1351,7 @@ class LIBPROTOBUF_EXPORT FileDescriptor { // Get options for this file. These are specified in the .proto file by // placing lines like "option foo = 1234;" at the top level, outside of any // other definitions. Allowed options are defined by FileOptions in - // google/protobuf/descriptor.proto, and any available extensions of that - // message. + // descriptor.proto, and any available extensions of that message. const FileOptions& options() const; // Syntax of this file. @@ -1417,7 +1422,7 @@ class LIBPROTOBUF_EXPORT FileDescriptor { const string* name_; const string* package_; const DescriptorPool* pool_; - GoogleOnceDynamic* dependencies_once_; + internal::once_flag* dependencies_once_; static void DependenciesOnceInit(const FileDescriptor* to_init); void InternalDependenciesOnceInit() const; @@ -1793,7 +1798,7 @@ class LIBPROTOBUF_EXPORT DescriptorPool { // If fallback_database_ is NULL, this is NULL. Otherwise, this is a mutex // which must be locked while accessing tables_. - Mutex* mutex_; + internal::WrappedMutex* mutex_; // See constructor. DescriptorDatabase* fallback_database_; @@ -2000,7 +2005,7 @@ inline const string& EnumDescriptor::reserved_name(int index) const { inline FieldDescriptor::Type FieldDescriptor::type() const { if (type_once_) { - type_once_->Init(&FieldDescriptor::TypeOnceInit, this); + internal::call_once(*type_once_, &FieldDescriptor::TypeOnceInit, this); } return type_; } @@ -2133,6 +2138,6 @@ inline const FieldDescriptor* OneofDescriptor::field(int index) const { } } // namespace protobuf - } // namespace google + #endif // GOOGLE_PROTOBUF_DESCRIPTOR_H__ |