Back to home page

EIC code displayed by LXR

 
 

    


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

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_CSHARP_MESSAGE_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 #include "google/protobuf/compiler/code_generator.h"
0015 #include "google/protobuf/compiler/csharp/csharp_source_generator_base.h"
0016 #include "google/protobuf/compiler/csharp/csharp_helpers.h"
0017 
0018 namespace google {
0019 namespace protobuf {
0020 namespace compiler {
0021 namespace csharp {
0022 
0023 class FieldGeneratorBase;
0024 
0025 class MessageGenerator : public SourceGeneratorBase {
0026  public:
0027   MessageGenerator(const Descriptor* descriptor, const Options* options);
0028   ~MessageGenerator();
0029 
0030   MessageGenerator(const MessageGenerator&) = delete;
0031   MessageGenerator& operator=(const MessageGenerator&) = delete;
0032 
0033   void GenerateCloningCode(io::Printer* printer);
0034   void GenerateFreezingCode(io::Printer* printer);
0035   void GenerateFrameworkMethods(io::Printer* printer);
0036   void Generate(io::Printer* printer);
0037 
0038  private:
0039   const Descriptor* descriptor_;
0040   std::vector<const FieldDescriptor*> fields_by_number_;
0041   int has_bit_field_count_;
0042   bool has_extension_ranges_;
0043 
0044   void GenerateMessageSerializationMethods(io::Printer* printer);
0045   void GenerateWriteToBody(io::Printer* printer, bool use_write_context);
0046   void GenerateMergingMethods(io::Printer* printer);
0047   void GenerateMainParseLoop(io::Printer* printer, bool use_parse_context);
0048 
0049   int GetPresenceIndex(const FieldDescriptor* descriptor);
0050   FieldGeneratorBase* CreateFieldGeneratorInternal(
0051       const FieldDescriptor* descriptor);
0052 
0053   bool HasNestedGeneratedTypes();
0054 
0055   void AddDeprecatedFlag(io::Printer* printer);
0056   void AddSerializableAttribute(io::Printer* printer);
0057 
0058   std::string class_name();
0059   std::string full_class_name();
0060 
0061   // field descriptors sorted by number
0062   const std::vector<const FieldDescriptor*>& fields_by_number();
0063 };
0064 
0065 }  // namespace csharp
0066 }  // namespace compiler
0067 }  // namespace protobuf
0068 }  // namespace google
0069 
0070 #endif  // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__