File indexing completed on 2025-01-31 10:11:59
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__
0010
0011 #include <string>
0012
0013 #include "absl/container/flat_hash_map.h"
0014 #include "absl/strings/string_view.h"
0015 #include "google/protobuf/compiler/objectivec/options.h"
0016 #include "google/protobuf/descriptor.h"
0017 #include "google/protobuf/io/printer.h"
0018
0019 namespace google {
0020 namespace protobuf {
0021 namespace compiler {
0022 namespace objectivec {
0023
0024 class OneofGenerator {
0025 public:
0026 OneofGenerator(const OneofDescriptor* descriptor,
0027 const GenerationOptions& generation_options);
0028 ~OneofGenerator() = default;
0029
0030 OneofGenerator(const OneofGenerator&) = delete;
0031 OneofGenerator& operator=(const OneofGenerator&) = delete;
0032
0033 void SetOneofIndexBase(int index_base);
0034
0035 void GenerateCaseEnum(io::Printer* printer) const;
0036
0037 void GeneratePublicCasePropertyDeclaration(io::Printer* printer) const;
0038 void GenerateClearFunctionDeclaration(io::Printer* printer) const;
0039
0040 void GeneratePropertyImplementation(io::Printer* printer) const;
0041 void GenerateClearFunctionImplementation(io::Printer* printer) const;
0042
0043 std::string DescriptorName() const;
0044 std::string HasIndexAsString() const;
0045
0046 private:
0047 const OneofDescriptor* descriptor_;
0048 const GenerationOptions& generation_options_;
0049 absl::flat_hash_map<absl::string_view, std::string> variables_;
0050 };
0051
0052 }
0053 }
0054 }
0055 }
0056
0057 #endif