File indexing completed on 2025-01-31 10:11:59
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_IMPORT_WRITER_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_IMPORT_WRITER_H__
0010
0011 #include <string>
0012 #include <vector>
0013
0014 #include "absl/container/flat_hash_map.h"
0015 #include "google/protobuf/descriptor.h"
0016
0017 namespace google {
0018 namespace protobuf {
0019 namespace compiler {
0020 namespace objectivec {
0021
0022
0023
0024 class ImportWriter {
0025 public:
0026 ImportWriter(const std::string& generate_for_named_framework,
0027 const std::string& named_framework_to_proto_path_mappings_path,
0028 const std::string& runtime_import_prefix,
0029 bool for_bundled_proto);
0030 ~ImportWriter() = default;
0031
0032 void AddFile(const FileDescriptor* file, const std::string& header_extension);
0033 void AddRuntimeImport(const std::string& header_name);
0034
0035
0036 std::string ModuleForFile(const FileDescriptor* file);
0037
0038 void PrintFileImports(io::Printer* p) const;
0039 void PrintRuntimeImports(io::Printer* p, bool default_cpp_symbol) const;
0040
0041 private:
0042 void ParseFrameworkMappings();
0043
0044 const std::string generate_for_named_framework_;
0045 const std::string named_framework_to_proto_path_mappings_path_;
0046 const std::string runtime_import_prefix_;
0047 absl::flat_hash_map<std::string, std::string> proto_file_to_framework_name_;
0048 bool for_bundled_proto_;
0049 bool need_to_parse_mapping_file_;
0050
0051 std::vector<std::string> protobuf_imports_;
0052 std::vector<std::string> other_framework_imports_;
0053 std::vector<std::string> other_imports_;
0054 };
0055
0056 }
0057 }
0058 }
0059 }
0060
0061 #endif