MIRA
Public Types | Public Member Functions | List of all members
CopyableXMLDom Class Reference

#include <xml/macros/Utils.h>

Inheritance diagram for CopyableXMLDom:
Inheritance graph
[legend]

Public Types

typedef sibling_iterator iterator
 typedefs for backward compatibility More...
 
typedef const_sibling_iterator const_iterator
 
Public types.
typedef std::pair< std::string, std::string > Attribute
 An XML attribute. More...
 

Public Member Functions

 CopyableXMLDom ()=default
 
 CopyableXMLDom (CopyableXMLDom &&dom)
 
 CopyableXMLDom (const CopyableXMLDom &dom)
 
CopyableXMLDomoperator= (const CopyableXMLDom &dom)
 
void reflect (XMLDeserializer &r)
 
void clear ()
 Clears the whole content of this XMLDom document, i.e. More...
 
XMLDom clone ()
 Create and return a copy of the document. More...
 
std::string uri () const
 Get the URL of the document (i.e. More...
 
void setUri (const std::string &uri)
 Set the URL of the document (i.e. More...
 
std::string encoding () const
 Get the initial encoding of the document. More...
 
I/O operations.
void loadFromString (const std::string &buffer)
 Load and parse an XML document from memory. More...
 
void loadFromFile (const Path &filename, bool resolve=true)
 Load and parse an XML document from a file. More...
 
void saveToFile (const Path &filename, const std::string &encoding="UTF-8", bool resolve=true) const
 Save the XML document to a file. More...
 
void saveToFile (const Path &filename, bool resolve) const
 Save the XML document to a file, using encoding UTF-8. More...
 
std::string saveToString (const std::string &encoding="UTF-8") const
 Save the XML document to a string. More...
 
Iterators.
const_sibling_iterator croot () const
 Return a const sibling_iterator to the root node of the XML document. More...
 
const_sibling_iterator root () const
 Return a const sibling_iterator to the root node of the XML document. More...
 
sibling_iterator root ()
 Return a sibling_iterator to the root node of the XML document. More...
 

Iterator types.

typedef const_data_iterator< COMMENT_NODE > const_comment_iterator
 STL-conform typedefs. More...
 
typedef const_data_iterator< TEXT_NODE > const_content_iterator
 The const iterator for content. More...
 
typedef data_iterator< COMMENT_NODE > comment_iterator
 The iterator for comments. More...
 
typedef data_iterator< TEXT_NODE > content_iterator
 The iterator for content. More...
 
static constexpr size_t npos = std::numeric_limits<size_t>::max()
 

Member Typedef Documentation

◆ Attribute

typedef std::pair<std::string, std::string> Attribute
inherited

An XML attribute.

◆ iterator

typedef sibling_iterator iterator
inherited

typedefs for backward compatibility

◆ const_iterator

Constructor & Destructor Documentation

◆ CopyableXMLDom() [1/3]

CopyableXMLDom ( )
default

◆ CopyableXMLDom() [2/3]

CopyableXMLDom ( CopyableXMLDom &&  dom)
inline

◆ CopyableXMLDom() [3/3]

CopyableXMLDom ( const CopyableXMLDom dom)

Member Function Documentation

◆ operator=()

CopyableXMLDom& operator= ( const CopyableXMLDom dom)

◆ reflect()

void reflect ( XMLDeserializer r)
inline

◆ clear()

void clear ( )
inherited

Clears the whole content of this XMLDom document, i.e.

all nodes are destroyed and the XMLDom object has the same state as after calling it's constructor. Note: All iterators become invalid by calling this method. Accessing the iterators after calling this method will result in undefined behavior.

◆ clone()

XMLDom clone ( )
inherited

Create and return a copy of the document.

◆ loadFromString()

void loadFromString ( const std::string &  buffer)
inherited

Load and parse an XML document from memory.

Exceptions
XIOif the document could not be loaded.
Parameters
[in]bufferThe buffer.

◆ loadFromFile()

void loadFromFile ( const Path filename,
bool  resolve = true 
)
inherited

Load and parse an XML document from a file.

Exceptions
XFileNotFoundif file is not found.
XIOif the file/document could not be loaded.
Parameters
[in]filenameThe file name.
[in]resolveShould the filename be resolved (resolvePath())? Set to false if already resolved.

◆ saveToFile() [1/2]

void saveToFile ( const Path filename,
const std::string &  encoding = "UTF-8",
bool  resolve = true 
) const
inherited

Save the XML document to a file.

Exceptions
XInvalidConfigif the document is empty.
XIOif the file could not be saved.
Parameters
[in]filenameThe file name.
[in]encodingThe desired encoding.
[in]resolveShould the filename be resolved (resolvePath())? Set to false if already resolved.

◆ saveToFile() [2/2]

void saveToFile ( const Path filename,
bool  resolve 
) const
inherited

Save the XML document to a file, using encoding UTF-8.

Exceptions
XInvalidConfigif the document is empty.
XIOif the file could not be saved.
Parameters
[in]filenameThe file name.
[in]resolveShould the filename be resolved (resolvePath())? Set to false if already resolved.

◆ saveToString()

std::string saveToString ( const std::string &  encoding = "UTF-8") const
inherited

Save the XML document to a string.

Exceptions
XInvalidConfigif the document is empty.
XIOif the file could not be saved.
Parameters
[in]encodingThe desired encoding.
Returns
The string containing the xml document

◆ croot()

const_sibling_iterator croot ( ) const
inherited

Return a const sibling_iterator to the root node of the XML document.

◆ root() [1/2]

const_sibling_iterator root ( ) const
inlineinherited

Return a const sibling_iterator to the root node of the XML document.

◆ root() [2/2]

sibling_iterator root ( )
inherited

Return a sibling_iterator to the root node of the XML document.

◆ uri()

std::string uri ( ) const
inherited

Get the URL of the document (i.e.

the filename if loaded from file)

Returns
URL of the document

◆ setUri()

void setUri ( const std::string &  uri)
inherited

Set the URL of the document (i.e.

the filename if loaded from file)

◆ encoding()

std::string encoding ( ) const
inherited

Get the initial encoding of the document.

Returns
Encoding if any.

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