1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__ 9 #define GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__ 10 11 #include <string> 12 13 #include "google/protobuf/compiler/code_generator.h" 14 #include "google/protobuf/compiler/csharp/csharp_source_generator_base.h" 15 #include "google/protobuf/descriptor.h" 16 #include "google/protobuf/io/printer.h" 17 18 namespace google { 19 namespace protobuf { 20 namespace compiler { 21 namespace csharp { 22 23 class ReflectionClassGenerator : public SourceGeneratorBase { 24 public: 25 ReflectionClassGenerator(const FileDescriptor* file, const Options* options); 26 ~ReflectionClassGenerator(); 27 28 ReflectionClassGenerator(const ReflectionClassGenerator&) = delete; 29 ReflectionClassGenerator& operator=(const ReflectionClassGenerator&) = delete; 30 31 void Generate(io::Printer* printer); 32 33 private: 34 const FileDescriptor* file_; 35 36 std::string namespace_; 37 std::string reflectionClassname_; 38 std::string extensionClassname_; 39 40 void WriteIntroduction(io::Printer* printer); 41 void WriteDescriptor(io::Printer* printer); 42 void WriteGeneratedCodeInfo(const Descriptor* descriptor, 43 io::Printer* printer, 44 bool last); 45 }; 46 47 } // namespace csharp 48 } // namespace compiler 49 } // namespace protobuf 50 } // namespace google 51 52 #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REFLECTION_CLASS_H__ 53