Back to home page

EIC code displayed by LXR

 
 

    


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

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_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 // ParseFunctionGenerator generates the _InternalParse function for a message
0028 // (and any associated supporting members).
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   // Emits class-level data member declarations to `printer`:
0040   void GenerateDataDecls(io::Printer* printer);
0041 
0042   // Emits out-of-class data member definitions to `printer`:
0043   void GenerateDataDefinitions(io::Printer* printer);
0044 
0045  private:
0046   class GeneratedOptionProvider;
0047 
0048   // Generates the tail-call table definition.
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 }  // namespace cpp
0066 }  // namespace compiler
0067 }  // namespace protobuf
0068 }  // namespace google
0069 
0070 #endif  // GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__