From: Jens Geyer Date: Tue, 28 May 2013 01:09:04 +0000 (+0200) Subject: THRIFT-1977 C# compiler should generate constant files prefixed with thrift file... X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d3c71827f87cc25a6469af5fd8f30e38454832e1;p=common%2Fthrift.git THRIFT-1977 C# compiler should generate constant files prefixed with thrift file name Patch: Deniss Afonin & Jens Geyer --- diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc index a1041fd9..26f1bdf9 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -291,7 +291,7 @@ void t_csharp_generator::generate_consts(std::vector consts) { if (consts.empty()){ return; } - string f_consts_name = namespace_dir_ + "/Constants.cs"; + string f_consts_name = namespace_dir_ + '/' + program_name_ + ".Constants.cs"; ofstream f_consts; f_consts.open(f_consts_name.c_str()); @@ -302,7 +302,7 @@ void t_csharp_generator::generate_consts(std::vector consts) { start_csharp_namespace(f_consts); indent(f_consts) << - "public class Constants" << endl; + "public static class " << program_name_ << "Constants" << endl; scope_up(f_consts); vector::iterator c_iter; @@ -372,7 +372,7 @@ void t_csharp_generator::print_const_def_value(std::ofstream& out, string name, } void t_csharp_generator::print_const_constructor(std::ofstream& out, std::vector consts) { - indent(out) << "static Constants()" << endl; + indent(out) << "static " << program_name_ << "Constants()" << endl; scope_up(out); vector::iterator c_iter; for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {