blob: 6cd5f7d3a0c2841d8d292c29b3ef61ef859b73a2 [file] [log] [blame]
Adam Cozzette5aca7282023-08-07 10:01:08 -07001// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google LLC. All rights reserved.
Adam Cozzette5aca7282023-08-07 10:01:08 -07003//
Hong Shinc482a8a2023-11-09 09:30:34 -08004// 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 Bot306123e2022-11-04 09:25:30 -07007
8#ifndef UPB_PROTOS_GENERATOR_GEN_UTILS_H_
9#define UPB_PROTOS_GENERATOR_GEN_UTILS_H_
10
Protobuf Team Bot3e4de3c2023-05-25 11:57:07 -070011#include <string>
Protobuf Team Bot1b6beaa2023-02-24 17:04:34 -080012#include <vector>
13
Mike Kruskal2b011bc2022-11-10 11:51:09 -080014#include "google/protobuf/descriptor.pb.h"
Protobuf Team Bot306123e2022-11-04 09:25:30 -070015#include "google/protobuf/compiler/code_generator.h"
Protobuf Team Bot306123e2022-11-04 09:25:30 -070016#include "google/protobuf/descriptor.h"
Protobuf Team Bot306123e2022-11-04 09:25:30 -070017
18namespace protos_generator {
19
20namespace protobuf = ::google::protobuf;
21
22enum class MessageClassType {
23 kMessage,
24 kMessageCProxy,
25 kMessageProxy,
26 kMessageAccess,
27};
28
Protobuf Team Bot306123e2022-11-04 09:25:30 -070029inline bool IsMapEntryMessage(const protobuf::Descriptor* descriptor) {
30 return descriptor->options().map_entry();
31}
Joshua Habermane41a2d72023-01-11 21:25:34 -080032std::vector<const protobuf::EnumDescriptor*> SortedEnums(
33 const protobuf::FileDescriptor* file);
34std::vector<const protobuf::Descriptor*> SortedMessages(
35 const protobuf::FileDescriptor* file);
36std::vector<const protobuf::FieldDescriptor*> SortedExtensions(
37 const protobuf::FileDescriptor* file);
38std::vector<const protobuf::FieldDescriptor*> FieldNumberOrder(
39 const protobuf::Descriptor* message);
40
Protobuf Team Bot1b6beaa2023-02-24 17:04:34 -080041std::string ToCamelCase(const std::string& input, bool lower_first);
42
Protobuf Team Bot306123e2022-11-04 09:25:30 -070043} // namespace protos_generator
44
45#endif // UPB_PROTOS_GENERATOR_GEN_UTILS_H_