tokens

Defined in header: <orcus/tokens.hpp>

class tokens

XML token store that provides mapping of integral token indentifiers and their original names. Instances of this class are typically used as global constants.

Note

The string values for the original token names should be static values whose values and memory addresses remain unchanged during the life cycle of the instance that references them.

Note

This class is not copy-constructible.

Public Functions

tokens() = delete
tokens(const tokens&) = delete
tokens(const char *const *token_names, size_t token_name_count)
~tokens()
bool is_valid_token(xml_token_t token) const

Check if a token returned from get_token() method is valid.

Returns:

true if valid, false otherwise.

xml_token_t get_token(std::string_view name) const

Get token from a specified name.

Parameters:

name – textural token name

Returns:

token value representing the given textural token.

std::string_view get_token_name(xml_token_t token) const

Get textural token name from a token value.

Parameters:

token – numeric token value

Returns:

textural token name, or empty string in case the given token is not valid.