From dd27e31351be89bc0c28183fc347d6082bca1e36 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 16 Jul 2015 21:50:28 +0200 Subject: cmXMLWriter: overload Element() method for empty elements --- Source/cmXMLWriter.cxx | 7 +++++++ Source/cmXMLWriter.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index f9b3b49..ab9939a 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -67,6 +67,13 @@ void cmXMLWriter::EndElement() this->ElementOpen = false; } +void cmXMLWriter::Element(const char* name) +{ + this->CloseStartElement(); + this->ConditionalLineBreak(!this->IsContent, this->Elements.size()); + this->Output << '<' << name << "/>"; +} + void cmXMLWriter::BreakAttributes() { this->BreakAttrib = true; diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index c38c0de..c839a62 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -41,6 +41,8 @@ public: this->Output << name << "=\"" << SafeAttribute(value) << '"'; } + void Element(const char* name); + template void Element(std::string const& name, T const& value) { -- cgit v0.12