LibreOffice Module tools (master) 1
Public Member Functions | Private Attributes | List of all members
tools::XmlWriter Class Referencefinal

XmlWriter writes a XML to a SvStream. More...

#include <XmlWriter.hxx>

Public Member Functions

 XmlWriter (SvStream *pStream)
 
 ~XmlWriter ()
 
bool startDocument (sal_Int32 nIndent=2, bool bWriteXmlHeader=true)
 
void endDocument ()
 
void startElement (const char *sName)
 
void startElement (const OString &sName)
 
void startElement (const OString &sPrefix, const OString &sName, const OString &sNamespaceUri)
 
void endElement ()
 
void attribute (const char *sTagName, const OString &aValue)
 
void attribute (const OString &sTagName, const OString &aValue)
 
void attribute (const char *sTagName, std::u16string_view aValue)
 
void attribute (const char *sTagName, sal_Int32 aNumber)
 
void attributeDouble (const char *sTagName, double aNumber)
 
void attributeBase64 (const char *sTagName, std::vector< sal_uInt8 > const &rValueInBytes)
 
void attributeBase64 (const char *sTagName, std::vector< char > const &rValueInBytes)
 
void content (const OString &sValue)
 
void content (std::u16string_view sValue)
 
void element (const char *sName)
 

Private Attributes

std::unique_ptr< XmlWriterImplmpImpl
 

Detailed Description

XmlWriter writes a XML to a SvStream.

It uses libxml2 for writing but hides all the internal libxml2 workings and uses types that are native for LO development.

The codepage used for XML is always "utf-8" and the output is indented by default so it is easier to read.

Definition at line 34 of file XmlWriter.hxx.

Constructor & Destructor Documentation

◆ XmlWriter()

tools::XmlWriter::XmlWriter ( SvStream pStream)

Definition at line 48 of file XmlWriter.cxx.

◆ ~XmlWriter()

tools::XmlWriter::~XmlWriter ( )

Definition at line 53 of file XmlWriter.cxx.

References endDocument(), and mpImpl.

Member Function Documentation

◆ attribute() [1/4]

void tools::XmlWriter::attribute ( const char *  sTagName,
const OString &  aValue 
)

Definition at line 124 of file XmlWriter.cxx.

References mpImpl, name, and value.

Referenced by attribute(), and attributeDouble().

◆ attribute() [2/4]

void tools::XmlWriter::attribute ( const char *  sTagName,
sal_Int32  aNumber 
)

Definition at line 143 of file XmlWriter.cxx.

References attribute(), and name.

◆ attribute() [3/4]

void tools::XmlWriter::attribute ( const char *  sTagName,
std::u16string_view  aValue 
)

Definition at line 138 of file XmlWriter.cxx.

References attribute(), name, OUStringToOString(), and value.

◆ attribute() [4/4]

void tools::XmlWriter::attribute ( const OString &  sTagName,
const OString &  aValue 
)

Definition at line 131 of file XmlWriter.cxx.

References mpImpl, name, and value.

◆ attributeBase64() [1/2]

void tools::XmlWriter::attributeBase64 ( const char *  sTagName,
std::vector< char > const &  rValueInBytes 
)

Definition at line 116 of file XmlWriter.cxx.

References mpImpl, and pName.

◆ attributeBase64() [2/2]

void tools::XmlWriter::attributeBase64 ( const char *  sTagName,
std::vector< sal_uInt8 > const &  rValueInBytes 
)

Definition at line 110 of file XmlWriter.cxx.

References attributeBase64(), and pName.

Referenced by attributeBase64().

◆ attributeDouble()

void tools::XmlWriter::attributeDouble ( const char *  sTagName,
double  aNumber 
)

Definition at line 148 of file XmlWriter.cxx.

References attribute(), and name.

◆ content() [1/2]

void tools::XmlWriter::content ( const OString &  sValue)

Definition at line 153 of file XmlWriter.cxx.

References mpImpl.

Referenced by content().

◆ content() [2/2]

void tools::XmlWriter::content ( std::u16string_view  sValue)

Definition at line 159 of file XmlWriter.cxx.

References content(), and OUStringToOString().

◆ element()

void tools::XmlWriter::element ( const char *  sName)

Definition at line 164 of file XmlWriter.cxx.

References endElement(), sName, and startElement().

◆ endDocument()

void tools::XmlWriter::endDocument ( )

Definition at line 74 of file XmlWriter.cxx.

References mpImpl.

Referenced by ~XmlWriter().

◆ endElement()

void tools::XmlWriter::endElement ( )

Definition at line 108 of file XmlWriter.cxx.

References mpImpl.

Referenced by element().

◆ startDocument()

bool tools::XmlWriter::startDocument ( sal_Int32  nIndent = 2,
bool  bWriteXmlHeader = true 
)

Definition at line 59 of file XmlWriter.cxx.

References mpImpl.

◆ startElement() [1/3]

void tools::XmlWriter::startElement ( const char *  sName)

Definition at line 96 of file XmlWriter.cxx.

References mpImpl, and pName.

Referenced by element().

◆ startElement() [2/3]

void tools::XmlWriter::startElement ( const OString &  sName)

Definition at line 102 of file XmlWriter.cxx.

References mpImpl.

◆ startElement() [3/3]

void tools::XmlWriter::startElement ( const OString &  sPrefix,
const OString &  sName,
const OString &  sNamespaceUri 
)

Definition at line 82 of file XmlWriter.cxx.

References mpImpl, sName, and sPrefix.

Member Data Documentation

◆ mpImpl

std::unique_ptr<XmlWriterImpl> tools::XmlWriter::mpImpl
private

The documentation for this class was generated from the following files: