scram::xml::detail
Classes
| Name | |
|---|---|
| class | scram::xml::detail::FileStream <br>Adaptor for stdio FILE stream with write generic interface. |
| class | scram::xml::detail::Indenter <br>Manages XML element indentation upon output. |
Functions
| Name | |
|---|---|
| template <typename T > <br>std::enable_if_t< std::is_arithmetic_v< T >, T > | to(const std::string_view & value)<br>Gets a number from an XML value. |
| const char * | from_utf8(const xmlChar * xml_string)<br>Reinterprets the XML library UTF-8 string into C string. |
| const xmlChar * | to_utf8(const char * c_string)<br>Reinterprets C string as XML library UTF-8 string. |
| std::string_view | trim(const std::string_view & text)<br>Removes leading and trailing space characters from XML value string. |
| template <typename T > <br>T | GetError(xmlErrorPtr xml_error =nullptr)<br>Gets the last XML error converted from the library error codes. |
| template <typename T > <br>FileStream & | operator<<(FileStream & file, T && value)<br>Convenience wrapper to provide C++ stream-like interface. |
Attributes
| Name | |
|---|---|
| const char | kIndentChar <br>The whitespace character. |
| const int | kMaxIndent <br>The maximum number of characters. |
Functions Documentation
function to
template <typename T >
std::enable_if_t< std::is_arithmetic_v< T >, T > to(
const std::string_view & value
)Gets a number from an XML value.
Parameters:
- value The non-empty value string.
Exceptions:
- ValidityError The interpretation is unsuccessful.
Template Parameters:
- T Numeric type.
Return: The interpreted value.
function from_utf8
inline const char * from_utf8(
const xmlChar * xml_string
)Reinterprets the XML library UTF-8 string into C string.
Parameters:
- xml_string The string provided by the XML library.
Return: The same string adapted for use as C string.
function to_utf8
inline const xmlChar * to_utf8(
const char * c_string
)Reinterprets C string as XML library UTF-8 string.
Parameters:
- c_string The C byte-array encoding the XML string.
Return: The same string adapted for use in XML library functions.
Precondition: The C string has UTF-8 encoding.
function trim
inline std::string_view trim(
const std::string_view & text
)Removes leading and trailing space characters from XML value string.
Parameters:
- text The text in XML attribute or text nodes.
Return: View to the trimmed substring.
Precondition: The string is normalized by the XML parser.
function GetError
template <typename T >
T GetError(
xmlErrorPtr xml_error =nullptr
)Gets the last XML error converted from the library error codes.
Parameters:
- xml_error The error to translate. nullptr to retrieve the latest error in the library.
Template Parameters:
- T The SCRAM error type to convert XML error into.
Return: The exception object to be thrown.
function operator<<
template <typename T >
FileStream & operator<<(
FileStream & file,
T && value
)Convenience wrapper to provide C++ stream-like interface.
Attributes Documentation
variable kIndentChar
const char kIndentChar = ' ';The whitespace character.
variable kMaxIndent
const int kMaxIndent = 20;The maximum number of characters.
Updated on 2025-11-11 at 16:51:08 +0000
