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_OPTIONS_H__ 9 #define GOOGLE_PROTOBUF_COMPILER_CSHARP_OPTIONS_H__ 10 11 #include <string> 12 13 namespace google { 14 namespace protobuf { 15 namespace compiler { 16 namespace csharp { 17 18 // Generator options (used by csharp_generator.cc): 19 struct Options { OptionsOptions20 Options() 21 : file_extension(".cs"), 22 base_namespace(""), 23 base_namespace_specified(false), 24 internal_access(false), 25 serializable(false), 26 strip_nonfunctional_codegen(false) {} 27 // Extension of the generated file. Defaults to ".cs" 28 std::string file_extension; 29 // Base namespace to use to create directory hierarchy. Defaults to "". 30 // This option allows the simple creation of a conventional C# file layout, 31 // where directories are created relative to a project-specific base 32 // namespace. For example, in a project with a base namespace of PetShop, a 33 // proto of user.proto with a C# namespace of PetShop.Model.Shared would 34 // generate Model/Shared/User.cs underneath the specified --csharp_out 35 // directory. 36 // 37 // If no base namespace is specified, all files are generated in the 38 // --csharp_out directory, with no subdirectories created automatically. 39 std::string base_namespace; 40 // Whether the base namespace has been explicitly specified by the user. 41 // This is required as the base namespace can be explicitly set to the empty 42 // string, meaning "create a full directory hierarchy, starting from the first 43 // segment of the namespace." 44 bool base_namespace_specified; 45 // Whether the generated classes should have accessibility level of "internal". 46 // Defaults to false that generates "public" classes. 47 bool internal_access; 48 // Whether the generated classes should have a global::System.Serializable attribute added 49 // Defaults to false 50 bool serializable; 51 // If true, strip out nonfunctional codegen. 52 bool strip_nonfunctional_codegen; 53 }; 54 55 } // namespace csharp 56 } // namespace compiler 57 } // namespace protobuf 58 } // namespace google 59 60 #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_OPTIONS_H__ 61