Adam Cozzette | 5aca728 | 2023-08-07 10:01:08 -0700 | [diff] [blame] | 1 | // Protocol Buffers - Google's data interchange format |
| 2 | // Copyright 2023 Google LLC. All rights reserved. |
Adam Cozzette | 5aca728 | 2023-08-07 10:01:08 -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 |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 7 | |
| 8 | #ifndef UPB_PROTOS_GENERATOR_GEN_UTILS_H_ |
| 9 | #define UPB_PROTOS_GENERATOR_GEN_UTILS_H_ |
| 10 | |
Protobuf Team Bot | 3e4de3c | 2023-05-25 11:57:07 -0700 | [diff] [blame] | 11 | #include <string> |
Protobuf Team Bot | 1b6beaa | 2023-02-24 17:04:34 -0800 | [diff] [blame] | 12 | #include <vector> |
| 13 | |
Mike Kruskal | 2b011bc | 2022-11-10 11:51:09 -0800 | [diff] [blame] | 14 | #include "google/protobuf/descriptor.pb.h" |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 15 | #include "google/protobuf/compiler/code_generator.h" |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 16 | #include "google/protobuf/descriptor.h" |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 17 | |
| 18 | namespace protos_generator { |
| 19 | |
| 20 | namespace protobuf = ::google::protobuf; |
| 21 | |
| 22 | enum class MessageClassType { |
| 23 | kMessage, |
| 24 | kMessageCProxy, |
| 25 | kMessageProxy, |
| 26 | kMessageAccess, |
| 27 | }; |
| 28 | |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 29 | inline bool IsMapEntryMessage(const protobuf::Descriptor* descriptor) { |
| 30 | return descriptor->options().map_entry(); |
| 31 | } |
Joshua Haberman | e41a2d7 | 2023-01-11 21:25:34 -0800 | [diff] [blame] | 32 | std::vector<const protobuf::EnumDescriptor*> SortedEnums( |
| 33 | const protobuf::FileDescriptor* file); |
| 34 | std::vector<const protobuf::Descriptor*> SortedMessages( |
| 35 | const protobuf::FileDescriptor* file); |
| 36 | std::vector<const protobuf::FieldDescriptor*> SortedExtensions( |
| 37 | const protobuf::FileDescriptor* file); |
| 38 | std::vector<const protobuf::FieldDescriptor*> FieldNumberOrder( |
| 39 | const protobuf::Descriptor* message); |
| 40 | |
Protobuf Team Bot | 1b6beaa | 2023-02-24 17:04:34 -0800 | [diff] [blame] | 41 | std::string ToCamelCase(const std::string& input, bool lower_first); |
| 42 | |
Protobuf Team Bot | 306123e | 2022-11-04 09:25:30 -0700 | [diff] [blame] | 43 | } // namespace protos_generator |
| 44 | |
| 45 | #endif // UPB_PROTOS_GENERATOR_GEN_UTILS_H_ |