Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:11:59

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2008 Google Inc.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
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 }  // namespace objectivec
0063 }  // namespace compiler
0064 }  // namespace protobuf
0065 }  // namespace google
0066 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_FIELD_H__