#include <catch_xmlwriter.h>
Definition at line 33 of file catch_xmlwriter.h.
◆ XmlWriter() [1/2]
Catch::XmlWriter::XmlWriter |
( |
std::ostream & | os = Catch::cout() | ) |
|
◆ ~XmlWriter()
Catch::XmlWriter::~XmlWriter |
( |
| ) |
|
◆ XmlWriter() [2/2]
Catch::XmlWriter::XmlWriter |
( |
XmlWriter const & | | ) |
|
|
delete |
◆ endElement()
Definition at line 214 of file catch_xmlwriter.cpp.
214 {
215 newlineIfNecessary();
216 m_indent = m_indent.substr( 0, m_indent.size()-2 );
217 if( m_tagIsOpen ) {
218 m_os << "/>";
219 m_tagIsOpen = false;
220 }
221 else {
222 m_os << m_indent << "</" << m_tags.back() << ">";
223 }
224 m_os << std::endl;
225 m_tags.pop_back();
226 return *this;
227 }
◆ ensureTagClosed()
void Catch::XmlWriter::ensureTagClosed |
( |
| ) |
|
Definition at line 269 of file catch_xmlwriter.cpp.
269 {
270 if( m_tagIsOpen ) {
271 m_os << ">" << std::endl;
272 m_tagIsOpen = false;
273 }
274 }
◆ operator=()
◆ scopedElement()
Definition at line 208 of file catch_xmlwriter.cpp.
208 {
209 ScopedElement scoped( this );
211 return scoped;
212 }
XmlWriter & startElement(std::string const &name)
◆ startElement()
XmlWriter & Catch::XmlWriter::startElement |
( |
std::string const & | name | ) |
|
Definition at line 198 of file catch_xmlwriter.cpp.
198 {
200 newlineIfNecessary();
201 m_os << m_indent <<
'<' <<
name;
202 m_tags.push_back(
name );
203 m_indent += " ";
204 m_tagIsOpen = true;
205 return *this;
206 }
◆ writeAttribute() [1/3]
XmlWriter & Catch::XmlWriter::writeAttribute |
( |
std::string const & | name, |
|
|
bool | attribute ) |
Definition at line 235 of file catch_xmlwriter.cpp.
235 {
236 m_os <<
' ' <<
name <<
"=\"" << ( attribute ?
"true" :
"false" ) <<
'"';
237 return *this;
238 }
◆ writeAttribute() [2/3]
XmlWriter & Catch::XmlWriter::writeAttribute |
( |
std::string const & | name, |
|
|
std::string const & | attribute ) |
◆ writeAttribute() [3/3]
XmlWriter & Catch::XmlWriter::writeAttribute |
( |
std::string const & | name, |
|
|
T const & | attribute ) |
|
inline |
Definition at line 74 of file catch_xmlwriter.h.
74 {
75 ReusableStringStream rss;
76 rss << attribute;
78 }
XmlWriter & writeAttribute(std::string const &name, std::string const &attribute)
◆ writeBlankLine()
XmlWriter & Catch::XmlWriter::writeBlankLine |
( |
| ) |
|
◆ writeComment()
XmlWriter & Catch::XmlWriter::writeComment |
( |
std::string const & | text | ) |
|
Definition at line 252 of file catch_xmlwriter.cpp.
252 {
254 m_os << m_indent <<
"<!--" <<
text <<
"-->";
255 m_needsNewline = true;
256 return *this;
257 }
◆ writeStylesheetRef()
void Catch::XmlWriter::writeStylesheetRef |
( |
std::string const & | url | ) |
|
Definition at line 259 of file catch_xmlwriter.cpp.
259 {
260 m_os <<
"<?xml-stylesheet type=\"text/xsl\" href=\"" <<
url <<
"\"?>\n";
261 }
◆ writeText()
XmlWriter & Catch::XmlWriter::writeText |
( |
std::string const & | text, |
|
|
bool | indent = true ) |
Definition at line 240 of file catch_xmlwriter.cpp.
240 {
242 bool tagWasOpen = m_tagIsOpen;
244 if( tagWasOpen && indent )
245 m_os << m_indent;
246 m_os << XmlEncode( text );
247 m_needsNewline = true;
248 }
249 return *this;
250 }
The documentation for this class was generated from the following files: