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>`

Collaboration diagram for Alembic::Util::ALEMBIC_VERSION_NS::TokenMap:
[legend]

## 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;.

Definition at line 60 of file TokenMap.h.

## 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 ...

Definition at line 89 of file TokenMap.h.

## const_reference

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

const_reference promoted from map_type::const_reference ...

Definition at line 105 of file TokenMap.h.

## 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 ...

Definition at line 97 of file TokenMap.h.

## 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 ...

Definition at line 77 of file TokenMap.h.

## iterator

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

iterator promoted from map_type::iterator ...

Definition at line 85 of file TokenMap.h.

## 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 ...

Definition at line 72 of file TokenMap.h.

## 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> ...

Definition at line 68 of file TokenMap.h.

## reference

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

reference promoted from map_type::reference ...

Definition at line 101 of file TokenMap.h.

## reverse_iterator

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

reverse_iterator promoted from map_type::reverse_iterator ...

Definition at line 93 of file TokenMap.h.

## 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>

Definition at line 81 of file TokenMap.h.

## Constructor & Destructor Documentation

## TokenMap() [1/2]

Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::TokenMap | ( |  | ) |

inline

Default constructor Map is initialized with no entries. Values can be added using The set and setUnique member functions.

Definition at line 113 of file TokenMap.h.

Referenced by exactMatch().

Here is the caller graph for this function:

## TokenMap() [2/2]

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

inline explicit

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.

Definition at line 121 of file TokenMap.h.

References set(), and setUnique().

Here is the call graph for this function:

## Member Function Documentation

## begin() [1/2]

iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::begin | ( |  | ) |

inline

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.

Definition at line 252 of file TokenMap.h.

References m_map.

## begin() [2/2]

const_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::begin | ( |  | ) | const

inline

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.

Definition at line 257 of file TokenMap.h.

References m_map.

## clear()

void Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::clear | ( |  | ) |

inline

Definition at line 193 of file TokenMap.h.

References m_map.

## end() [1/2]

iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::end | ( |  | ) |

inline

same as std::map end Returns an iterator corresponding to the end of the map.

Definition at line 261 of file TokenMap.h.

References m_map.

## end() [2/2]

const_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::end | ( |  | ) | const

inline

same as std::map end const Returns an const_iterator corresponding to the end of the map.

Definition at line 265 of file TokenMap.h.

References m_map.

## exactMatch()

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

inline

Return an exact match ...

Definition at line 298 of file TokenMap.h.

References TokenMap(), and m_map.

Referenced by Alembic::Util::ALEMBIC_VERSION_NS::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

## 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.

## operator[]()

std::string Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::operator[] | ( | const std::string & | token | ) | const

inline

This function is a shorthand for value It will not return a modifiable entry. To modify, setValue must be used.

Definition at line 229 of file TokenMap.h.

References value().

Here is the call graph for this function:

## rbegin() [1/2]

reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rbegin | ( |  | ) |

inline

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.

Definition at line 275 of file TokenMap.h.

References m_map.

## rbegin() [2/2]

const_reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rbegin | ( |  | ) | const

inline

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.

Definition at line 280 of file TokenMap.h.

References m_map.

## rend() [1/2]

reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rend | ( |  | ) |

inline

same as std::map rend Returns an reverse_iterator corresponding to the reverse end of the map.

Definition at line 285 of file TokenMap.h.

References m_map.

## rend() [2/2]

const_reverse_iterator Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rend | ( |  | ) | const

inline

same as std::map rend const Returns an const_reverse_iterator corresponding to the end of the map.

Definition at line 290 of file TokenMap.h.

References m_map.

## 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

Referenced by TokenMap().

Here is the caller graph for this function:

## 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

Referenced by TokenMap().

Here is the caller graph for this function:

## setValue()

void Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::setValue | ( | const std::string & | keyStr,
|  | const std::string & | valueStr )

inline

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.

Definition at line 239 of file TokenMap.h.

References m_map.

## size()

size_t Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::size | ( |  | ) | const

inline

This function returns the number of pairs. ...

Definition at line 201 of file TokenMap.h.

References m_map.

## tokenExists()

bool Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::tokenExists | ( | const std::string & | token | ) | const

inline

This function returns whether the map contains an entry for a particular token.

Definition at line 205 of file TokenMap.h.

References m_map.

## value()

std::string Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::value | ( | const std::string & | token | ) | const

inline

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.

Definition at line 213 of file TokenMap.h.

References m_map.

Referenced by operator[]().

Here is the caller graph for this function:

## Member Data Documentation

## m_map

map_type Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::m_map

protected

Definition at line 304 of file TokenMap.h.

Referenced by begin(), begin(), clear(), end(), end(), exactMatch(), rbegin(), rbegin(), rend(), rend(), setValue(), size(), tokenExists(), and value().

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

- opt/local/include/Alembic/Util/TokenMap.h