MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / XmlWriter

Class XmlWriter

tests/catch.hpp:5336–5404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5334 };
5335
5336 class XmlWriter {
5337 public:
5338
5339 class ScopedElement {
5340 public:
5341 ScopedElement( XmlWriter* writer );
5342
5343 ScopedElement( ScopedElement&& other ) noexcept;
5344 ScopedElement& operator=( ScopedElement&& other ) noexcept;
5345
5346 ~ScopedElement();
5347
5348 ScopedElement& writeText( std::string const& text, bool indent = true );
5349
5350 template<typename T>
5351 ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
5352 m_writer->writeAttribute( name, attribute );
5353 return *this;
5354 }
5355
5356 private:
5357 mutable XmlWriter* m_writer = nullptr;
5358 };
5359
5360 XmlWriter( std::ostream& os = Catch::cout() );
5361 ~XmlWriter();
5362
5363 XmlWriter( XmlWriter const& ) = delete;
5364 XmlWriter& operator=( XmlWriter const& ) = delete;
5365
5366 XmlWriter& startElement( std::string const& name );
5367
5368 ScopedElement scopedElement( std::string const& name );
5369
5370 XmlWriter& endElement();
5371
5372 XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );
5373
5374 XmlWriter& writeAttribute( std::string const& name, bool attribute );
5375
5376 template<typename T>
5377 XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {
5378 ReusableStringStream rss;
5379 rss << attribute;
5380 return writeAttribute( name, rss.str() );
5381 }
5382
5383 XmlWriter& writeText( std::string const& text, bool indent = true );
5384
5385 XmlWriter& writeComment( std::string const& text );
5386
5387 void writeStylesheetRef( std::string const& url );
5388
5389 XmlWriter& writeBlankLine();
5390
5391 void ensureTagClosed();
5392
5393 private:

Callers

nothing calls this directly

Calls 1

strMethod · 0.80

Tested by

no test coverage detected