Loading...
Searching...
No Matches
Alembic::Util::ALEMBIC_VERSION_NS::TokenMap Class Reference

A wrapper around std::map that serializes and deserializes the map into a doubly-tokenized string, usually of the form token=value;token=value;token=value;. More...

`#include <TokenMap.h>`

## Public Types

typedef std::map< std::string, std::string > | map_type
typedef map_type::key_type | key_type
typedef std::string | data_type
typedef map_type::value_type | value_type
typedef map_type::iterator | iterator
typedef map_type::const_iterator | const_iterator
typedef map_type::reverse_iterator | reverse_iterator
typedef map_type::const_reverse_iterator | const_reverse_iterator
typedef map_type::reference | reference
typedef map_type::const_reference | const_reference

## Public Member Functions

| TokenMap ()
| Default constructor Map is initialized with no entries. Values can be added using The set and setUnique member functions.
| TokenMap (const std::string &config, char pairSeparator=';', char assignSeparator='=', bool unique=false, bool quiet=true)
| Explicit constructor Map is initialized from given string, using the delimiter scheme as presented. If the 'unique' bool is 'true', it will use the setUnique function, obeying the 'quiet' bool accordingly. Otherwise it will use the set function.
void | set (const std::string &config, char pairSeparator=';', char assignSeparator='=')
| This function sets the token/value pairs in the map by deserializing them from a doubly-delimited string.
void | setUnique (const std::string &config, char pairSeparator=';', char assignSeparator='=', bool quiet=true)
| This function sets only unique (not already stored) token/value pairs by deserializing them from a doubly-delimited string.
std::string | get (char pairSeparator=';', char assignSeparator='=', bool check=false) const
| This function turns the map back into a doubly-tokenized string.
void | clear ()
size_t | size () const
| This function returns the number of pairs. ...
bool | tokenExists (const std::string &token) const
| This function returns whether the map contains an entry for a particular token.
std::string | value (const std::string &token) const
| This function returns the string value associated with a particular token, or the empty string "" if the map does not contain this token-value pair.
std::string | operator[] (const std::string &token) const
| This function is a shorthand for value It will not return a modifiable entry. To modify, setValue must be used.
void | setValue (const std::string &keyStr, const std::string &valueStr)
| This function sets the value of a token. It will either add a new token-value pair if the map does not already contain this token, or it will overwrite the value for this token if it already exists. You can use the tokenExists function to manage uniqueness guarantees.
iterator | begin ()
| same as std::map begin Returns an iterator corresponding to the beginning of the map or the end of the map if the map is empty.
const_iterator | begin () const
| same as std::map begin const Returns a const_iterator corresponding to the beginning of the map or the end of the map if the map is empty.
iterator | end ()
| same as std::map end Returns an iterator corresponding to the end of the map.
const_iterator | end () const
| same as std::map end const Returns an const_iterator corresponding to the end of the map.
reverse_iterator | rbegin ()
| same as std::map rbegin Returns an reverse_iterator corresponding to the reverse_beginning of the map or the reverse_end of the map if the map is empty.
const_reverse_iterator | rbegin () const
| same as std::map rbegin const Returns a const_reverse_iterator corresponding to the beginning of the map or the end of the map if the map is empty.
reverse_iterator | rend ()
| same as std::map rend Returns an reverse_iterator corresponding to the reverse end of the map.
const_reverse_iterator | rend () const
| same as std::map rend const Returns an const_reverse_iterator corresponding to the end of the map.
bool | exactMatch (const TokenMap &iOther) const

## Protected Attributes

map_type | m_map

## Detailed Description

A wrapper around std::map that serializes and deserializes the map into a doubly-tokenized string, usually of the form token=value;token=value;token=value;.

## Member Typedef Documentation

## const_iterator

typedef map_type::const_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::const_iterator

const_iterator promoted from map_type::iterator ...

## const_reference

typedef map_type::const_reference Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::const_reference

const_reference promoted from map_type::const_reference ...

## const_reverse_iterator

typedef map_type::const_reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::const_reverse_iterator

const_reverse_iterator promoted from map_type::const_reverse_iterator ...

## data_type

typedef std::string Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::data_type

data_type promoted from map_type::data_type, which is std::string ...

## iterator

typedef map_type::iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::iterator

iterator promoted from map_type::iterator ...

## key_type

typedef map_type::key_type Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::key_type

key_type promoted from map_type::key_type, which is std::string ...

## map_type

typedef std::map<std::string,std::string> Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::map_type

The map_type is std::map<std::string,std::string> ...

## reference

typedef map_type::reference Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::reference

reference promoted from map_type::reference ...

## reverse_iterator

typedef map_type::reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::reverse_iterator

reverse_iterator promoted from map_type::reverse_iterator ...

## value_type

typedef map_type::value_type Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::value_type

value_type promoted from map_type::value_type, which is std::pair<std::string, std::string>

## Member Function Documentation

## exactMatch()

bool Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::exactMatch | ( | const TokenMap & | iOther | ) | const

inline

Return an exact match ...

## get()

std::string Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::get | ( | char | pairSeparator = ';',
|  | char | assignSeparator = '=',
|  | bool | check = false ) const

This function turns the map back into a doubly-tokenized string.

The passed delimiters are used to delimit the string, and they have default values. Checking is optionally performed (based on the 'check' bool) to make sure neither the tokens nor values contain the delimiter characters, and an Alembic::Util::Exception is thrown if a conflict is detected.

## set()

void Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::set | ( | const std::string & | config,
|  | char | pairSeparator = ';',
|  | char | assignSeparator = '=' )

This function sets the token/value pairs in the map by deserializing them from a doubly-delimited string.

Using default copy constructor ...

Using default assignment operator. ...

The delimiter scheme defaults to: "token=value;token=value;token=value" but may be overridden using the optional separator arguments. Values are added to the map one-by-one, overwriting any values that were there before. To avoid overwriting, use the setUnique function, which can silently or rigidly deal with conflicts

## setUnique()

void Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::setUnique | ( | const std::string & | config,
|  | char | pairSeparator = ';',
|  | char | assignSeparator = '=',
|  | bool | quiet = true )

This function sets only unique (not already stored) token/value pairs by deserializing them from a doubly-delimited string.

The delimiter scheme and rules are the same as set , the main difference here is that the class will not overwrite values that already exist. If the function is called with the default value of 'true' for the 'quiet' parameter, it will simply not write those values. Otherwise, it will throw a Alembic::Util::Exception

The documentation for this class was generated from the following files:

- Util/TokenMap.h
- Util/TokenMap.cpp