Orcus
|
#include <xml_namespace.hpp>
Public Member Functions | |
xmlns_context (xmlns_context &&) | |
xmlns_context (const xmlns_context &r) | |
xmlns_context & | operator= (const xmlns_context &r) |
xmlns_context & | operator= (xmlns_context &&r) |
xmlns_id_t | push (std::string_view alias, std::string_view uri) |
void | pop (std::string_view alias) |
xmlns_id_t | get (std::string_view alias) const |
size_t | get_index (xmlns_id_t ns_id) const |
std::string | get_short_name (xmlns_id_t ns_id) const |
std::string_view | get_alias (xmlns_id_t ns_id) const |
std::vector< xmlns_id_t > | get_all_namespaces () const |
void | dump (std::ostream &os) const |
void | dump_state (std::ostream &os) const |
void | swap (xmlns_context &other) noexcept |
Friends | |
class | xmlns_repository |
XML namespace context. A new context should be used for each xml stream since the namespace keys themselves are not interned. Don't hold an instance of this class any longer than the life cycle of the xml stream it is used in.
An empty key value i.e. ""
is associated with a default namespace.
void orcus::xmlns_context::dump_state | ( | std::ostream & | os | ) | const |
Dump the internal state for debugging in YAML format.
xmlns_id_t orcus::xmlns_context::get | ( | std::string_view | alias | ) | const |
Get the currnet namespace identifier for a specified namespace alias.
alias | namespace alias to get the current namespace identifier for. |
std::string_view orcus::xmlns_context::get_alias | ( | xmlns_id_t | ns_id | ) | const |
Get an alias currently associated with a given namespace identifier.
ns_id | namespace identifier. |
size_t orcus::xmlns_context::get_index | ( | xmlns_id_t | ns_id | ) | const |
Get a unique index value associated with a specified identifier. An index value is guaranteed to be unique regardless of contexts.
ns_id | a namespace identifier to obtain index for. |
std::string orcus::xmlns_context::get_short_name | ( | xmlns_id_t | ns_id | ) | const |
Get a 'short' name associated with a specified identifier. A short name is a string value conveniently short enough for display purposes, but still guaranteed to be unique to the identifier it is associated with.
ns_id | a namespace identifier to obtain short name for. |
void orcus::xmlns_context::pop | ( | std::string_view | alias | ) |
Pop a namespace alias from the stack.
alias | namespace alias to pop from the stack. |
xmlns_id_t orcus::xmlns_context::push | ( | std::string_view | alias, |
std::string_view | uri ) |
Push a new namespace alias-value pair to the stack.
alias | namespace alias to push onto the stack. If the same alias is already present, this overwrites it until it gets popped off the stack. |
uri | namespace name to associate with the alias. |