• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google LLC.  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 PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
9 #define PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
10 
11 #include <string>
12 
13 #include "google/protobuf/descriptor.pb.h"
14 #include "google/protobuf/compiler/hpb/output.h"
15 
16 namespace google::protobuf::hpb_generator {
17 
18 namespace protobuf = ::proto2;
19 
20 inline constexpr absl::string_view kNoPackageNamePrefix = "hpb_";
21 
22 std::string ClassName(const protobuf::Descriptor* descriptor);
23 std::string QualifiedClassName(const protobuf::Descriptor* descriptor);
24 std::string QualifiedInternalClassName(const protobuf::Descriptor* descriptor);
25 
26 std::string CppSourceFilename(const google::protobuf::FileDescriptor* file);
27 std::string ForwardingHeaderFilename(const google::protobuf::FileDescriptor* file);
28 std::string UpbCFilename(const google::protobuf::FileDescriptor* file);
29 std::string CppHeaderFilename(const google::protobuf::FileDescriptor* file);
30 
31 void WriteStartNamespace(const protobuf::FileDescriptor* file, Output& output);
32 void WriteEndNamespace(const protobuf::FileDescriptor* file, Output& output);
33 
34 std::string CppConstType(const protobuf::FieldDescriptor* field);
35 std::string CppTypeParameterName(const protobuf::FieldDescriptor* field);
36 
37 std::string MessageBaseType(const protobuf::FieldDescriptor* field,
38                             bool is_const);
39 // Generate hpb::Ptr<const Model> to be used in accessors as public
40 // signatures.
41 std::string MessagePtrConstType(const protobuf::FieldDescriptor* field,
42                                 bool is_const);
43 std::string MessageCProxyType(const protobuf::FieldDescriptor* field,
44                               bool is_const);
45 std::string MessageProxyType(const protobuf::FieldDescriptor* field,
46                              bool is_const);
47 
48 }  // namespace protobuf
49 }  // namespace google::hpb_generator
50 
51 #endif  // PROTOBUF_COMPILER_HBP_GEN_NAMES_H_
52