From f37d3cd42eb18433445c2e259cd71a1b2bd67be0 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 9 Jan 2015 17:00:53 +0100 Subject: added non-pretty output of XML serialization, changed DemoOutput accordingly and changed DemoOutputTest to have some kind of automatic inspection instead of visual inspection. --- src/core/XML.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/core/XML.hpp') diff --git a/src/core/XML.hpp b/src/core/XML.hpp index e55ecba..b05d4c6 100644 --- a/src/core/XML.hpp +++ b/src/core/XML.hpp @@ -73,9 +73,12 @@ public: * @param out is the output stream the serialized data shall be * written to. * @param doctype enables you to add a prefix specifying the doctype. + * @param pretty is a flag that manipulates whether newlines and tabs are + * used. */ void serialize(std::ostream &out, - const std::string &doctype = ""); + const std::string &doctype = "", + bool pretty = true); /** * This method just writes the XML representation of this node to the * output stream. @@ -83,8 +86,11 @@ public: * @param out the output stream the serialized data shall be written * to. * @param tabdepth the current tabdepth for prettier output. + * @param pretty is a flag that manipulates whether newlines and tabs are + * used. */ - virtual void doSerialize(std::ostream &out, unsigned int tabdepth) = 0; + virtual void doSerialize(std::ostream &out, unsigned int tabdepth, + bool pretty) = 0; /** * @return the parent XML element of this node. @@ -130,7 +136,8 @@ public: * * The end tag of this element. * */ - void doSerialize(std::ostream &out, unsigned int tabdepth) override; + void doSerialize(std::ostream &out, unsigned int tabdepth, + bool pretty) override; const ManagedVector &getChildren() const { return children; } @@ -155,7 +162,8 @@ public: * This just writes the text to the output. * */ - void doSerialize(std::ostream &out, unsigned int tabdepth) override; + void doSerialize(std::ostream &out, unsigned int tabdepth, + bool pretty) override; }; } -- cgit v1.2.3