Orcus
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
orcus::xml_name_t Struct Reference

#include <types.hpp>

Public Types

enum  to_string_type { use_alias , use_short_name }
 

Public Member Functions

 xml_name_t (xmlns_id_t _ns, std::string_view _name)
 
 xml_name_t (const xml_name_t &other)
 
xml_name_toperator= (const xml_name_t &other)
 
bool operator== (const xml_name_t &other) const noexcept
 
bool operator!= (const xml_name_t &other) const noexcept
 
std::string to_string (const xmlns_context &cxt, to_string_type type) const
 
std::string to_string (const xmlns_repository &repo) const
 

Public Attributes

xmlns_id_t ns
 
std::string_view name
 

Detailed Description

Represents a name with a normalized namespace in XML documents. This can be used either as an element name or as an attribute name.

Member Function Documentation

◆ to_string() [1/2]

std::string orcus::xml_name_t::to_string ( const xmlns_context cxt,
to_string_type  type 
) const

Convert a namespace-name value pair to a string representation with the namespace value converted to either an alias or a unique "short name". Refer to get_alias() and get_short_name() for the explanations of an alias and short name.

Parameters
cxtnamespace context object associated with the XML stream currently being parsed.
typepolicy on how to convert a namespace identifier to a string representation.
Returns
string representation of a namespace-name value pair.

◆ to_string() [2/2]

std::string orcus::xml_name_t::to_string ( const xmlns_repository repo) const

Convert a namespace-name value pair to a string representation with the namespace value converted to a unique "short name". Refer to get_short_name() for the explanations of a short name.

Parameters
reponamespace repository.
Returns
string representation of a namespace-name value pair.