From 050ccbd481e1c3d4f671995f8b501326784acc2c Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 18 Feb 2011 12:51:53 +0000 Subject: Don't convert everything to a string to print it, use boost apply_visitor and do it properly --- project2/console/consoleAppEngine.cpp | 6 +++--- project2/sqlRows.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/project2/console/consoleAppEngine.cpp b/project2/console/consoleAppEngine.cpp index 3c99f74..c0eac5e 100644 --- a/project2/console/consoleAppEngine.cpp +++ b/project2/console/consoleAppEngine.cpp @@ -139,7 +139,7 @@ ConsoleApplicationEngine::addAttr(const Glib::ustring & name, const Glib::ustrin fprintf(stdout, "%s::", ns.c_str()); } fprintf(stdout, "@%s = ", name.c_str()); - out(value); + boost::apply_visitor(out, value); fprintf(stdout, "\n"); } @@ -151,7 +151,7 @@ ConsoleApplicationEngine::addField(const Glib::ustring & name, const Glib::ustri fprintf(stdout, "%s::", ns.c_str()); } fprintf(stdout, "%s = ", name.c_str()); - out(value); + boost::apply_visitor(out, value); fprintf(stdout, "\n"); } @@ -159,7 +159,7 @@ void ConsoleApplicationEngine::setText(const VariableType & value) const { fprintf(stdout, "%*s = ", indent, ""); - out(value); + boost::apply_visitor(out, value); fprintf(stdout, "\n"); } diff --git a/project2/sqlRows.cpp b/project2/sqlRows.cpp index d33a09f..22dafa9 100644 --- a/project2/sqlRows.cpp +++ b/project2/sqlRows.cpp @@ -57,8 +57,7 @@ class HandleAsVariableType : public DB::HandleField { void floatingpoint(double d) { variable = d; } - void timestamp(const struct tm & t) - { + void timestamp(const struct tm & t) { variable = boost::shared_ptr(new boost::posix_time::ptime(boost::posix_time::ptime_from_tm(t))); } VariableType variable; -- cgit v1.2.3