Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:11:56

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2008 Google Inc.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__
0010 
0011 #include <string>
0012 
0013 #include "absl/strings/string_view.h"
0014 
0015 // Must be included last.
0016 #include "google/protobuf/port_def.inc"
0017 
0018 namespace google {
0019 namespace protobuf {
0020 
0021 class Descriptor;
0022 class EnumDescriptor;
0023 class EnumValueDescriptor;
0024 class FieldDescriptor;
0025 class FileDescriptor;
0026 
0027 namespace compiler {
0028 namespace cpp {
0029 
0030 // Returns the fully qualified C++ namespace.
0031 //
0032 // For example, if you had:
0033 //   package foo.bar;
0034 //   message Baz { message Moo {} }
0035 // Then the qualified namespace for Moo would be:
0036 //   ::foo::bar
0037 PROTOC_EXPORT std::string Namespace(const FileDescriptor* d);
0038 PROTOC_EXPORT std::string Namespace(const Descriptor* d);
0039 PROTOC_EXPORT std::string Namespace(const FieldDescriptor* d);
0040 PROTOC_EXPORT std::string Namespace(const EnumDescriptor* d);
0041 
0042 // Returns the unqualified C++ name.
0043 //
0044 // For example, if you had:
0045 //   package foo.bar;
0046 //   message Baz { message Moo {} }
0047 // Then the non-qualified version would be:
0048 //   Baz_Moo
0049 PROTOC_EXPORT std::string ClassName(const Descriptor* descriptor);
0050 PROTOC_EXPORT std::string ClassName(const EnumDescriptor* enum_descriptor);
0051 
0052 // Returns the fully qualified C++ name.
0053 //
0054 // For example, if you had:
0055 //   package foo.bar;
0056 //   message Baz { message Moo {} }
0057 // Then the qualified ClassName for Moo would be:
0058 //   ::foo::bar::Baz_Moo
0059 PROTOC_EXPORT std::string QualifiedClassName(const Descriptor* d);
0060 PROTOC_EXPORT std::string QualifiedClassName(const EnumDescriptor* d);
0061 PROTOC_EXPORT std::string QualifiedExtensionName(const FieldDescriptor* d);
0062 
0063 // Get the (unqualified) name that should be used for this field in C++ code.
0064 // The name is coerced to lower-case to emulate proto1 behavior.  People
0065 // should be using lowercase-with-underscores style for proto field names
0066 // anyway, so normally this just returns field->name().
0067 PROTOC_EXPORT std::string FieldName(const FieldDescriptor* field);
0068 
0069 // Requires that this field is in a oneof. Returns the (unqualified) case
0070 // constant for this field.
0071 PROTOC_EXPORT std::string OneofCaseConstantName(const FieldDescriptor* field);
0072 // Returns the quafilied case constant for this field.
0073 PROTOC_EXPORT std::string QualifiedOneofCaseConstantName(
0074     const FieldDescriptor* field);
0075 
0076 // Get the (unqualified) name that should be used for this enum value in C++
0077 // code.
0078 PROTOC_EXPORT std::string EnumValueName(const EnumValueDescriptor* enum_value);
0079 
0080 // Strips ".proto" or ".protodevel" from the end of a filename.
0081 PROTOC_EXPORT std::string StripProto(absl::string_view filename);
0082 
0083 }  // namespace cpp
0084 }  // namespace compiler
0085 }  // namespace protobuf
0086 }  // namespace google
0087 
0088 #include "google/protobuf/port_undef.inc"
0089 
0090 #endif  // GOOGLE_PROTOBUF_COMPILER_CPP_NAMES_H__