File indexing completed on 2025-01-31 10:11:56
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__
0010
0011 #include <string>
0012 #include <vector>
0013
0014 #include "absl/container/flat_hash_map.h"
0015 #include "google/protobuf/compiler/cpp/helpers.h"
0016 #include "google/protobuf/compiler/cpp/options.h"
0017 #include "google/protobuf/descriptor.h"
0018 #include "google/protobuf/generated_message_tctable_gen.h"
0019 #include "google/protobuf/io/printer.h"
0020 #include "google/protobuf/wire_format_lite.h"
0021
0022 namespace google {
0023 namespace protobuf {
0024 namespace compiler {
0025 namespace cpp {
0026
0027
0028
0029 class ParseFunctionGenerator {
0030 public:
0031 ParseFunctionGenerator(
0032 const Descriptor* descriptor, int max_has_bit_index,
0033 const std::vector<int>& has_bit_indices,
0034 const std::vector<int>& inlined_string_indices, const Options& options,
0035 MessageSCCAnalyzer* scc_analyzer,
0036 const absl::flat_hash_map<absl::string_view, std::string>& vars,
0037 int index_in_file_messages);
0038
0039
0040 void GenerateDataDecls(io::Printer* printer);
0041
0042
0043 void GenerateDataDefinitions(io::Printer* printer);
0044
0045 private:
0046 class GeneratedOptionProvider;
0047
0048
0049 void GenerateTailCallTable(io::Printer* printer);
0050 void GenerateFastFieldEntries(Formatter& format);
0051 void GenerateFieldEntries(Formatter& format);
0052 void GenerateFieldNames(Formatter& format);
0053
0054 const Descriptor* descriptor_;
0055 MessageSCCAnalyzer* scc_analyzer_;
0056 const Options& options_;
0057 absl::flat_hash_map<absl::string_view, std::string> variables_;
0058 std::unique_ptr<internal::TailCallTableInfo> tc_table_info_;
0059 std::vector<int> inlined_string_indices_;
0060 const std::vector<const FieldDescriptor*> ordered_fields_;
0061 int num_hasbits_;
0062 int index_in_file_messages_;
0063 };
0064
0065 }
0066 }
0067 }
0068 }
0069
0070 #endif