• 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_OBJECTIVEC_ENUM_H__
9 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
10 
11 #include <string>
12 #include <vector>
13 
14 #include "absl/container/flat_hash_set.h"
15 #include "google/protobuf/compiler/objectivec/options.h"
16 #include "google/protobuf/descriptor.h"
17 #include "google/protobuf/io/printer.h"
18 
19 namespace google {
20 namespace protobuf {
21 namespace compiler {
22 namespace objectivec {
23 
24 class EnumGenerator {
25  public:
26   EnumGenerator(const EnumDescriptor* descriptor,
27                 const GenerationOptions& generation_options);
28   ~EnumGenerator() = default;
29 
30   EnumGenerator(const EnumGenerator&) = delete;
31   EnumGenerator& operator=(const EnumGenerator&) = delete;
32 
33   void GenerateHeader(io::Printer* printer) const;
34   void GenerateSource(io::Printer* printer) const;
35 
name()36   const std::string& name() const { return name_; }
37 
38  private:
39   const EnumDescriptor* descriptor_;
40   const GenerationOptions& generation_options_;
41   std::vector<const EnumValueDescriptor*> base_values_;
42   std::vector<const EnumValueDescriptor*> all_values_;
43   absl::flat_hash_set<const EnumValueDescriptor*> alias_values_to_skip_;
44   const std::string name_;
45 };
46 
47 }  // namespace objectivec
48 }  // namespace compiler
49 }  // namespace protobuf
50 }  // namespace google
51 
52 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
53