File indexing completed on 2025-01-31 10:11:59
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
0010
0011 #include <cstddef>
0012 #include <memory>
0013 #include <string>
0014 #include <vector>
0015
0016 #include "absl/container/btree_set.h"
0017 #include "absl/container/flat_hash_set.h"
0018 #include "google/protobuf/compiler/objectivec/field.h"
0019 #include "google/protobuf/compiler/objectivec/oneof.h"
0020 #include "google/protobuf/compiler/objectivec/options.h"
0021 #include "google/protobuf/descriptor.h"
0022 #include "google/protobuf/io/printer.h"
0023
0024 namespace google {
0025 namespace protobuf {
0026 namespace compiler {
0027 namespace objectivec {
0028
0029 class ExtensionGenerator;
0030
0031 class MessageGenerator {
0032 public:
0033 MessageGenerator(const std::string& file_description_name,
0034 const Descriptor* descriptor,
0035 const GenerationOptions& generation_options);
0036 ~MessageGenerator() = default;
0037
0038 MessageGenerator(const MessageGenerator&) = delete;
0039 MessageGenerator& operator=(const MessageGenerator&) = delete;
0040
0041 void AddExtensionGenerators(
0042 std::vector<std::unique_ptr<ExtensionGenerator>>* extension_generators);
0043
0044 void GenerateMessageHeader(io::Printer* printer) const;
0045 void GenerateSource(io::Printer* printer) const;
0046 void DetermineObjectiveCClassDefinitions(
0047 absl::btree_set<std::string>* fwd_decls) const;
0048 void DetermineForwardDeclarations(absl::btree_set<std::string>* fwd_decls,
0049 bool include_external_types) const;
0050 void DetermineNeededFiles(
0051 absl::flat_hash_set<const FileDescriptor*>* deps) const;
0052
0053
0054 bool IncludesOneOfDefinition() const { return !oneof_generators_.empty(); }
0055
0056 private:
0057 const std::string file_description_name_;
0058 const Descriptor* descriptor_;
0059 const GenerationOptions& generation_options_;
0060 FieldGeneratorMap field_generators_;
0061 const std::string class_name_;
0062 const std::string deprecated_attribute_;
0063 std::vector<const ExtensionGenerator*> extension_generators_;
0064 std::vector<std::unique_ptr<OneofGenerator>> oneof_generators_;
0065 size_t sizeof_has_storage_;
0066 };
0067
0068 }
0069 }
0070 }
0071 }
0072
0073 #endif