From 647e604b57ce384154397095bbeef0063224d9d4 Mon Sep 17 00:00:00 2001 From: randomdan Date: Tue, 4 Oct 2011 00:43:38 +0000 Subject: Include broken down date and time parts in XML output --- project2/xml/Jamfile.jam | 2 ++ project2/xml/xmlPresenter.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/project2/xml/Jamfile.jam b/project2/xml/Jamfile.jam index be45dc6..8a4a5cc 100644 --- a/project2/xml/Jamfile.jam +++ b/project2/xml/Jamfile.jam @@ -5,6 +5,7 @@ alias libxslt : : : : "`pkg-config --cflags libexslt`" "`pkg-config --libs libexslt`" ; lib boost_filesystem : : boost_filesystem ; +lib boost_date_time : : boost_date_time ; cpp-pch pch : pch.hpp : ../../libmisc @@ -23,6 +24,7 @@ lib p2xml : ../url//p2url libxslt boost_filesystem + boost_date_time : : ../uuid//p2uuid . diff --git a/project2/xml/xmlPresenter.cpp b/project2/xml/xmlPresenter.cpp index 6d4ddeb..58321ba 100644 --- a/project2/xml/xmlPresenter.cpp +++ b/project2/xml/xmlPresenter.cpp @@ -4,6 +4,8 @@ #include "variables.h" #include "appEngine.h" #include +#include +#include DECLARE_COMPONENT_LOADER("xml", XmlPresenter, PresenterLoader) @@ -87,6 +89,11 @@ XmlPresenter::addText(const VariableType & value) const { if (!value.get()) { nodeStack.back()->add_child_text(value); + // Special cases + if (const boost::posix_time::ptime * dt = value.get()) { + nodeStack.back()->set_attribute("time", boost::posix_time::to_simple_string(dt->time_of_day())); + nodeStack.back()->set_attribute("date", boost::gregorian::to_iso_extended_string(dt->date())); + } } } -- cgit v1.2.3