Thrift-627: should c++ have setters for optional fields?
client: c++
patch: Eric Rannaud

Updated optional setter patch to preserve case within generated code.



git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1139283 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 8fb3e64..ec2e15b 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -198,7 +198,6 @@
   std::string argument_list(t_struct* tstruct, bool name_params=true, bool start_comma=false);
   std::string type_to_enum(t_type* ttype);
   std::string local_reflection_name(const char*, t_type* ttype, bool external=false);
-  std::string get_cap_name(std::string name);
 
   void generate_enum_constant_list(std::ofstream& f,
                                    const vector<t_enum_value*>& constants,
@@ -288,14 +287,6 @@
 };
 
 /**
- * Uppercases the first letter of the name
- */
-std::string t_cpp_generator::get_cap_name(std::string name) {
-  name[0] = toupper(name[0]);
-  return name;
-}
-
-/**
  * Prepares for file generation by opening up the necessary file output
  * streams.
  */
@@ -916,7 +907,7 @@
     }
     out <<
       endl <<
-      indent() << "void __set" << get_cap_name((*m_iter)->get_name()) <<
+      indent() << "void __set_" << (*m_iter)->get_name() <<
         "(" << type_name((*m_iter)->get_type(), false, true);
     out << " val) {" << endl << indent() <<
       indent() << (*m_iter)->get_name() << " = val;" << endl;