File indexing completed on 2025-01-31 10:11:59
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_FIELD_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_FIELD_H__
0010
0011 #include <string>
0012
0013 #include "absl/container/btree_set.h"
0014 #include "absl/container/flat_hash_set.h"
0015 #include "google/protobuf/compiler/objectivec/field.h"
0016 #include "google/protobuf/compiler/objectivec/options.h"
0017 #include "google/protobuf/descriptor.h"
0018
0019 namespace google {
0020 namespace protobuf {
0021 namespace compiler {
0022 namespace objectivec {
0023
0024 class EnumFieldGenerator : public SingleFieldGenerator {
0025 friend FieldGenerator* FieldGenerator::Make(
0026 const FieldDescriptor* field,
0027 const GenerationOptions& generation_options);
0028
0029 EnumFieldGenerator(const EnumFieldGenerator&) = delete;
0030 EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete;
0031
0032 public:
0033 void GenerateCFunctionDeclarations(io::Printer* printer) const override;
0034 void GenerateCFunctionImplementations(io::Printer* printer) const override;
0035 void DetermineForwardDeclarations(absl::btree_set<std::string>* fwd_decls,
0036 bool include_external_types) const override;
0037 void DetermineNeededFiles(
0038 absl::flat_hash_set<const FileDescriptor*>* deps) const override;
0039
0040 protected:
0041 EnumFieldGenerator(const FieldDescriptor* descriptor,
0042 const GenerationOptions& generation_options);
0043 ~EnumFieldGenerator() override = default;
0044 };
0045
0046 class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator {
0047 friend FieldGenerator* FieldGenerator::Make(
0048 const FieldDescriptor* field,
0049 const GenerationOptions& generation_options);
0050
0051 public:
0052 void EmitArrayComment(io::Printer* printer) const override;
0053 void DetermineNeededFiles(
0054 absl::flat_hash_set<const FileDescriptor*>* deps) const override;
0055
0056 protected:
0057 RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor,
0058 const GenerationOptions& generation_options);
0059 ~RepeatedEnumFieldGenerator() override = default;
0060 };
0061
0062 }
0063 }
0064 }
0065 }
0066 #endif