Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
| 2 | // Copyright 2023 Google LLC. All rights reserved. |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 3 | // |
Hong Shin | c482a8a | 2023-11-09 09:30:34 -0800 | [diff] [blame] | 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 |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 7 | |
Hong Shin | 096b139 | 2024-07-03 10:04:09 -0700 | [diff] [blame] | 8 | #ifndef PROTOBUF_COMPILER_HBP_GEN_NAMES_H_ |
| 9 | #define PROTOBUF_COMPILER_HBP_GEN_NAMES_H_ |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 10 | |
| 11 | #include <string> |
| 12 | |
| 13 | #include "google/protobuf/descriptor.pb.h" |
Hong Shin | 082cf00 | 2024-10-15 12:29:42 -0700 | [diff] [blame] | 14 | #include "google/protobuf/compiler/hpb/context.h" |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 15 | |
Hong Shin | 7a2b37f | 2024-07-09 15:42:34 -0700 | [diff] [blame] | 16 | namespace google::protobuf::hpb_generator { |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 17 | |
Hong Shin | 096b139 | 2024-07-03 10:04:09 -0700 | [diff] [blame] | 18 | namespace protobuf = ::proto2; |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 19 | |
Hong Shin | 7a2b37f | 2024-07-09 15:42:34 -0700 | [diff] [blame] | 20 | inline constexpr absl::string_view kNoPackageNamePrefix = "hpb_"; |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 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 | |
Hong Shin | 082cf00 | 2024-10-15 12:29:42 -0700 | [diff] [blame] | 31 | void WriteStartNamespace(const protobuf::FileDescriptor* file, Context& ctx); |
| 32 | void WriteEndNamespace(const protobuf::FileDescriptor* file, Context& ctx); |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 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); |
Hong Shin | 4535f86 | 2024-09-03 10:46:25 -0700 | [diff] [blame] | 39 | // Generate hpb::Ptr<const Model> to be used in accessors as public |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 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 | |
Hong Shin | 7a2b37f | 2024-07-09 15:42:34 -0700 | [diff] [blame] | 48 | } // namespace protobuf |
| 49 | } // namespace google::hpb_generator |
Adam Cozzette | 501ecec | 2023-09-26 14:36:20 -0700 | [diff] [blame] | 50 | |
Hong Shin | 096b139 | 2024-07-03 10:04:09 -0700 | [diff] [blame] | 51 | #endif // PROTOBUF_COMPILER_HBP_GEN_NAMES_H_ |