|
||||
File indexing completed on 2025-01-31 10:11:59
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 // Author: kenton@google.com (Kenton Varda) 0009 // Based on original Protocol Buffers design by 0010 // Sanjay Ghemawat, Jeff Dean, and others. 0011 // 0012 // Provides a mechanism for mapping a descriptor to the 0013 // fully-qualified name of the corresponding Java class. 0014 0015 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__ 0016 #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__ 0017 0018 #include <string> 0019 0020 #include "absl/strings/string_view.h" 0021 #include "google/protobuf/compiler/java/options.h" 0022 #include "google/protobuf/descriptor.h" 0023 0024 // Must be last. 0025 #include "google/protobuf/port_def.inc" 0026 0027 namespace google { 0028 namespace protobuf { 0029 0030 class Descriptor; 0031 class EnumDescriptor; 0032 class FileDescriptor; 0033 class FieldDescriptor; 0034 class ServiceDescriptor; 0035 0036 namespace compiler { 0037 namespace java { 0038 0039 // Requires: 0040 // descriptor != NULL 0041 // 0042 // Returns: 0043 // The fully-qualified Java class name. 0044 std::string ClassName(const Descriptor* descriptor); 0045 0046 // Requires: 0047 // descriptor != NULL 0048 // 0049 // Returns: 0050 // The fully-qualified Java class name. 0051 std::string ClassName(const EnumDescriptor* descriptor); 0052 0053 // Requires: 0054 // descriptor != NULL 0055 // 0056 // Returns: 0057 // The fully-qualified Java class name. 0058 std::string ClassName(const FileDescriptor* descriptor); 0059 0060 // Requires: 0061 // descriptor != NULL 0062 // 0063 // Returns: 0064 // The fully-qualified Java class name. 0065 std::string ClassName(const ServiceDescriptor* descriptor); 0066 0067 // Requires: 0068 // descriptor != NULL 0069 // 0070 // Returns: 0071 // Java package name. 0072 std::string FileJavaPackage(const FileDescriptor* descriptor, 0073 Options options = {}); 0074 0075 // Requires: 0076 // descriptor != NULL 0077 // 0078 // Returns: 0079 // Java package directory. 0080 std::string JavaPackageDirectory(const FileDescriptor* file); 0081 0082 // Requires: 0083 // descriptor != NULL 0084 // 0085 // Returns: 0086 // The unqualified Java class name. 0087 std::string FileClassName(const FileDescriptor* file); 0088 0089 // Requires: 0090 // descriptor != NULL 0091 // Returns: 0092 // Capitalized camel case field name. 0093 std::string CapitalizedFieldName(const FieldDescriptor* field); 0094 0095 // Requires: 0096 // descriptor != NULL 0097 // Returns: 0098 // Capitalized camel case oneof name. 0099 std::string CapitalizedOneofName(const OneofDescriptor* oneof); 0100 0101 // Returns: 0102 // Converts a name to camel-case. If cap_first_letter is true, capitalize the 0103 // first letter. 0104 std::string UnderscoresToCamelCase(absl::string_view input, 0105 bool cap_next_letter); 0106 // Requires: 0107 // field != NULL 0108 // Returns: 0109 // Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes 0110 // "fooBarBaz" or "FooBarBaz", respectively. 0111 std::string UnderscoresToCamelCase(const FieldDescriptor* field); 0112 0113 // Requires: 0114 // method != NULL 0115 // Returns: 0116 // Similar, but for method names. (Typically, this merely has the effect 0117 // of lower-casing the first letter of the name.) 0118 std::string UnderscoresToCamelCase(const MethodDescriptor* method); 0119 0120 // Requires: 0121 // field != NULL 0122 // Returns: 0123 // Same as UnderscoresToCamelCase, but checks for reserved keywords 0124 std::string UnderscoresToCamelCaseCheckReserved(const FieldDescriptor* field); 0125 0126 0127 } // namespace java 0128 } // namespace compiler 0129 } // namespace protobuf 0130 } // namespace google 0131 0132 #include "google/protobuf/port_undef.inc" 0133 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |