• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 #ifndef GOOGLE_PROTOBUF_COMPILER_PHP_NAMES_H__
9 #define GOOGLE_PROTOBUF_COMPILER_PHP_NAMES_H__
10 
11 #include "google/protobuf/descriptor.h"
12 
13 #include <string>
14 
15 #include "absl/strings/string_view.h"
16 #include "google/protobuf/port_def.inc"
17 
18 namespace google {
19 namespace protobuf {
20 namespace compiler {
21 namespace php {
22 
23 // Whether or not a name is reserved.
24 PROTOC_EXPORT bool IsReservedName(absl::string_view name);
25 
26 // A prefix to stick in front of reserved names to avoid clashes.
27 PROTOC_EXPORT std::string ReservedNamePrefix(absl::string_view classname,
28                                              const FileDescriptor* file);
29 
30 // A prefix to stick in front of all class names.
31 PROTOC_EXPORT std::string ClassNamePrefix(absl::string_view classname,
32                                           const Descriptor* desc);
33 PROTOC_EXPORT std::string ClassNamePrefix(absl::string_view classname,
34                                           const EnumDescriptor* desc);
35 
36 // To skip reserved keywords in php, some generated classname are prefixed.
37 // Other code generators may need following API to figure out the actual
38 // classname.
39 PROTOC_EXPORT std::string GeneratedClassName(const Descriptor* desc);
40 PROTOC_EXPORT std::string GeneratedClassName(const EnumDescriptor* desc);
41 PROTOC_EXPORT std::string GeneratedClassName(const ServiceDescriptor* desc);
42 
43 }  // namespace php
44 }  // namespace compiler
45 }  // namespace protobuf
46 }  // namespace google
47 
48 #include "google/protobuf/port_undef.inc"
49 
50 #endif  // GOOGLE_PROTOBUF_COMPILER_PHP_NAMES_H__
51