Orcus
Loading...
Searching...
No Matches
orcus::xmlns_repository Class Reference

#include <xml_namespace.hpp>

Public Member Functions

 xmlns_repository (const xmlns_repository &)=delete
xmlns_repositoryoperator= (const xmlns_repository &)=delete
 xmlns_repository (xmlns_repository &&other)
xmlns_repositoryoperator= (xmlns_repository &&)
void add_predefined_values (const xmlns_id_t *predefined_ns)
xmlns_context create_context ()
xmlns_id_t get_identifier (size_t index) const
std::string get_short_name (xmlns_id_t ns_id) const

Friends

class xmlns_context

Detailed Description

Central XML namespace repository that stores all namespaces that are used in the current session.

Warning
this class is not copyable, but is movable; however, the moved-from object will not be usable after the move.

Member Function Documentation

◆ add_predefined_values()

void orcus::xmlns_repository::add_predefined_values ( const xmlns_id_t * predefined_ns)

Add a set of predefined namespace values to the repository.

Parameters
predefined_nspredefined set of namespace values. This is a null-terminated array of xmlns_id_t. This xmlns_repository instance will assume that the instances of these xmlns_id_t values will be available throughout its life cycle; caller needs to ensure that they won't get deleted before the corresponding xmlns_repository instance is deleted.

◆ create_context()

xmlns_context orcus::xmlns_repository::create_context ( )

Create a context object associated with this namespace repository.

Warning
Since this context object references values stored in the repo, make sure that it will not out-live the repository object itself.
Returns
context object to use for a new XML stream.

◆ get_identifier()

xmlns_id_t orcus::xmlns_repository::get_identifier ( size_t index) const

Get XML namespace identifier from its numerical index.

Parameters
indexnumeric index of namespace.
Returns
valid namespace identifier, or XMLNS_UNKNOWN_ID if not found.

◆ get_short_name()

std::string orcus::xmlns_repository::get_short_name ( xmlns_id_t ns_id) const

See xmlns_context::get_short_name() for the explanation of this method, which works identically to it.