From c1c741cb0c6e0d920f60c9862556a5dd4e68da2e Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Sat, 13 Sep 2008 20:07:58 +0200 Subject: [PATCH] fixed a method generation bug with inarg --- tools/Makefile.am | 3 ++- tools/xml2cpp.cpp | 9 +++++---- tools/xml2cpp.h | 11 +++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 8ee021c..a443202 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -6,7 +6,8 @@ AM_CPPFLAGS = \ $(dbus_CFLAGS) \ $(xml_CFLAGS) \ -I$(top_srcdir)/include \ - -I$(top_builddir)/include + -I$(top_builddir)/include \ + -Wall if CROSS_COMPILING libdbus_cxx_la = $(BUILD_LIBDBUS_CXX_DIR)/src/libdbus-c++-1.la diff --git a/tools/xml2cpp.cpp b/tools/xml2cpp.cpp index 2fb988e..545296e 100644 --- a/tools/xml2cpp.cpp +++ b/tools/xml2cpp.cpp @@ -475,7 +475,8 @@ void generate_proxy(Xml::Document &doc, const char *filename) if (!arg_name.length()) { - arg_name = "argin" + j; + arg_name = "argin"; + arg_name += toString (j); } // generate extra code to wrap object @@ -561,7 +562,7 @@ void generate_proxy(Xml::Document &doc, const char *filename) if (!arg_name.length()) { - arg_name = "argout" + i; + arg_name = "argout" + toString (i); } if (arg_object.length()) @@ -673,7 +674,7 @@ void generate_proxy(Xml::Document &doc, const char *filename) // use a default if no arg name given if (!arg_name.length()) { - arg_name = "arg"; + arg_name = "arg" + toString (i); } body << arg_name << ";" << endl; @@ -700,7 +701,7 @@ void generate_proxy(Xml::Document &doc, const char *filename) if (!arg_name.length()) { - arg_name = "arg" + j; + arg_name = "arg" + toString (j); } if (arg_object.length()) diff --git a/tools/xml2cpp.h b/tools/xml2cpp.h index 84f53fe..9752426 100644 --- a/tools/xml2cpp.h +++ b/tools/xml2cpp.h @@ -31,6 +31,17 @@ #include #include +#include +#include + +/// create std::string from any number +template +std::string toString (const T &thing, int w = 0, int p = 0) +{ + std::ostringstream os; + os << std::setw(w) << std::setprecision(p) << thing; + return os.str(); +} #include "xml.h"