The zen::Xml namespace.
More...
|
template<class String > |
XmlDoc | load (const String &filename) |
| Load XML document from a file. More...
|
|
template<class String > |
void | save (const XmlDoc &doc, const String &filename, const std::string &lineBreak="\r\n", const std::string &indent=" ") |
| Save XML document to a file. More...
|
|
template<class T > |
bool | readStruc (const XmlElement &input, T &value) |
| Convert XML element to structured user data. More...
|
|
template<class T > |
void | writeStruc (const T &value, XmlElement &output) |
| Convert structured user data into an XML element. More...
|
|
template<class T > |
bool | readText (const std::string &input, T &value) |
| Convert text to user data - used by XML elements and attributes. More...
|
|
template<class T > |
void | writeText (const T &value, std::string &output) |
| Convert user data into text - used by XML elements and attributes. More...
|
|
template<class String > |
void | saveStream (const std::string &stream, const String &filename) |
| Save byte stream to a file. More...
|
|
template<class String > |
std::string | loadStream (const String &filename) |
| Load byte stream from a file. More...
|
|
std::string | serialize (const XmlDoc &doc, const std::string &lineBreak="\r\n", const std::string &indent=" ") |
| Save XML document as a byte stream. More...
|
|
XmlDoc | parse (const std::string &stream) |
| Load XML document from a byte stream. More...
|
|
template<class String >
XmlDoc zen::load |
( |
const String & |
filename | ) |
|
Load XML document from a file.
Convenience function that does nothing more than calling loadStream() and parse().
- Template Parameters
-
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
- Parameters
-
- Returns
- The loaded XML document
- Exceptions
-
template<class String >
std::string zen::loadStream |
( |
const String & |
filename | ) |
|
Load byte stream from a file.
- Template Parameters
-
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
- Parameters
-
- Returns
- Output byte stream
- Exceptions
-
XmlDoc zen::parse |
( |
const std::string & |
stream | ) |
|
Load XML document from a byte stream.
- Parameters
-
- Returns
- Output XML document
- Exceptions
-
template<class T >
bool zen::readStruc |
( |
const XmlElement & |
input, |
|
|
T & |
value |
|
) |
| |
Convert XML element to structured user data.
- Parameters
-
input | The input XML element. |
value | Conversion target value. |
- Returns
- "true" if value was read successfully.
template<class T >
bool zen::readText |
( |
const std::string & |
input, |
|
|
T & |
value |
|
) |
| |
Convert text to user data - used by XML elements and attributes.
- Parameters
-
input | Input text. |
value | Conversion target value. |
- Returns
- "true" if value was read successfully.
template<class String >
void zen::save |
( |
const XmlDoc & |
doc, |
|
|
const String & |
filename, |
|
|
const std::string & |
lineBreak = "\r\n" , |
|
|
const std::string & |
indent = " " |
|
) |
| |
Save XML document to a file.
Convenience function that does nothing more than calling serialize() and saveStream().
- Template Parameters
-
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
- Parameters
-
doc | The XML document to save |
filename | Output file name |
lineBreak | Line break, default: carriage return + new line |
indent | Indentation, default: four space characters |
- Exceptions
-
template<class String >
void zen::saveStream |
( |
const std::string & |
stream, |
|
|
const String & |
filename |
|
) |
| |
Save byte stream to a file.
- Template Parameters
-
String | Arbitrary string-like type: e.g. std::string, wchar_t*, char[], wchar_t, wxString, MyStringClass, ... |
- Parameters
-
stream | Input byte stream |
filename | Output file name |
- Exceptions
-
std::string zen::serialize |
( |
const XmlDoc & |
doc, |
|
|
const std::string & |
lineBreak = "\r\n" , |
|
|
const std::string & |
indent = " " |
|
) |
| |
Save XML document as a byte stream.
- Parameters
-
doc | Input XML document |
lineBreak | Line break, default: carriage return + new line |
indent | Indentation, default: four space characters |
- Returns
- Output byte stream
template<class T >
void zen::writeStruc |
( |
const T & |
value, |
|
|
XmlElement & |
output |
|
) |
| |
Convert structured user data into an XML element.
- Parameters
-
value | The value to be converted. |
output | The output XML element. |
template<class T >
void zen::writeText |
( |
const T & |
value, |
|
|
std::string & |
output |
|
) |
| |
Convert user data into text - used by XML elements and attributes.
- Parameters
-
value | The value to be converted. |
output | Output text. |