• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // Generates C# code for a given .proto file.
9 
10 #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
11 #define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
12 
13 #include <string>
14 
15 #include "google/protobuf/compiler/code_generator.h"
16 
17 #include "google/protobuf/port_def.inc"
18 
19 namespace google {
20 namespace protobuf {
21 namespace compiler {
22 namespace csharp {
23 
24 // CodeGenerator implementation which generates a C# source file and
25 // header.  If you create your own protocol compiler binary and you want
26 // it to support C# output, you can do so by registering an instance of this
27 // CodeGenerator with the CommandLineInterface in your main() function.
28 class PROTOC_EXPORT Generator : public CodeGenerator {
29  public:
30   Generator();
31   ~Generator();
32   bool Generate(
33     const FileDescriptor* file,
34     const std::string& parameter,
35     GeneratorContext* generator_context,
36     std::string* error) const override;
37   uint64_t GetSupportedFeatures() const override;
GetMinimumEdition()38   Edition GetMinimumEdition() const override { return Edition::EDITION_PROTO2; }
GetMaximumEdition()39   Edition GetMaximumEdition() const override { return Edition::EDITION_2023; }
40   using CodeGenerator::GetEdition;
41 };
42 
43 }  // namespace csharp
44 }  // namespace compiler
45 }  // namespace protobuf
46 }  // namespace google
47 
48 #include "google/protobuf/port_undef.inc"
49 
50 #endif  // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
51