You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/08/03 19:16:04 UTC
git commit: THRIFT-2639 c_glib: Expose as properties members of
generated structs Client: C-glib Patch: Simon South
Repository: thrift
Updated Branches:
refs/heads/master f341c590d -> a0b867411
THRIFT-2639 c_glib: Expose as properties members of generated structs
Client: C-glib
Patch: Simon South
Fixes error: 'to_string' is not a member of 'std' for non-C++11 conformant compilers
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a0b86741
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a0b86741
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a0b86741
Branch: refs/heads/master
Commit: a0b86741169b8ef0a1e663154db447517bd89b0b
Parents: f341c59
Author: Jens Geyer <je...@apache.org>
Authored: Sun Aug 3 19:13:01 2014 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Sun Aug 3 19:14:11 2014 +0200
----------------------------------------------------------------------
compiler/cpp/src/generate/t_c_glib_generator.cc | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/a0b86741/compiler/cpp/src/generate/t_c_glib_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 807b628..feef575 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -2448,10 +2448,7 @@ void t_c_glib_generator::generate_object(t_struct *tstruct) {
string param_spec_function_name = "g_param_spec_int";
string min_value;
string max_value;
- string default_value =
- std::to_string((member_value != NULL) ?
- member_value->get_integer() :
- 0);
+ ostringstream default_value;
switch (base_type) {
case t_base_type::TYPE_BYTE:
@@ -2479,9 +2476,6 @@ void t_c_glib_generator::generate_object(t_struct *tstruct) {
param_spec_function_name = "g_param_spec_double";
min_value = "-INFINITY";
max_value = "INFINITY";
- if (member_value != NULL) {
- default_value = std::to_string(member_value->get_double());
- }
break;
default:
@@ -2491,6 +2485,15 @@ void t_c_glib_generator::generate_object(t_struct *tstruct) {
break;
}
+ if (member_value != NULL) {
+ default_value <<
+ (base_type == t_base_type::TYPE_DOUBLE ?
+ member_value->get_double() :
+ member_value->get_integer());
+ } else {
+ default_value << "0";
+ }
+
args_indent += string(param_spec_function_name.length() + 2, ' ');
f_types_impl_ <<
param_spec_function_name << " (\"" << member_name << "\"," << endl <<
@@ -2498,7 +2501,7 @@ void t_c_glib_generator::generate_object(t_struct *tstruct) {
args_indent << "NULL," << endl <<
args_indent << min_value << "," << endl <<
args_indent << max_value << "," << endl <<
- args_indent << default_value << "," << endl <<
+ args_indent << default_value.str() << "," << endl <<
args_indent << "G_PARAM_READWRITE));" << endl;
}