diff options
-rw-r--r-- | project2/xml/xmlPresenter.cpp | 20 | ||||
-rw-r--r-- | project2/xml/xmlPresenter.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/project2/xml/xmlPresenter.cpp b/project2/xml/xmlPresenter.cpp index 9982a43..075518c 100644 --- a/project2/xml/xmlPresenter.cpp +++ b/project2/xml/xmlPresenter.cpp @@ -153,6 +153,26 @@ XmlPresenter::addAttribute(const Glib::ustring & name, const Glib::ustring & ns, } } +void +XmlPresenter::addNamedValue(const Glib::ustring & name, const VariableType & value) const +{ + if (!value.isNull()) { + pushSub(name, Glib::ustring()); + addText(value); + popSub(); + } +} + +void +XmlPresenter::addNamedValue(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const +{ + if (!value.isNull()) { + pushSub(name, ns); + addText(value); + popSub(); + } +} + class XmlNodeWriter : public boost::static_visitor<bool> { public: XmlNodeWriter(xmlpp::Element * n) : node(n) { } diff --git a/project2/xml/xmlPresenter.h b/project2/xml/xmlPresenter.h index 744ef3d..79d9634 100644 --- a/project2/xml/xmlPresenter.h +++ b/project2/xml/xmlPresenter.h @@ -30,6 +30,8 @@ class XmlPresenter : public Presenter, public ContentPresenter, public SourceOf< void pushSub(const Glib::ustring & name, const Glib::ustring & ns) const; void addAttribute(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const; void addText(const VariableType & value) const; + void addNamedValue(const Glib::ustring & name, const VariableType & value) const; + void addNamedValue(const Glib::ustring & name, const Glib::ustring & ns, const VariableType & value) const; void popSub() const; void addNewArray(const Glib::ustring&, bool objects) const; void finishArray(bool objects) const; |