Browse Source

cmXMLWriter: overload Element() method for empty elements

Daniel Pfeifer 10 years ago
parent
commit
dd27e31351
2 changed files with 9 additions and 0 deletions
  1. 7 0
      Source/cmXMLWriter.cxx
  2. 2 0
      Source/cmXMLWriter.h

+ 7 - 0
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;

+ 2 - 0
Source/cmXMLWriter.h

@@ -41,6 +41,8 @@ public:
     this->Output << name << "=\"" << SafeAttribute(value) << '"';
     }
 
+  void Element(const char* name);
+
   template <typename T>
   void Element(std::string const& name, T const& value)
     {