HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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. More...
 
 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. More...
 
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. More...
 
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. More...
 
std::string get (char pairSeparator= ';', char assignSeparator= '=', bool check=false) const
 This function turns the map back into a doubly-tokenized string. More...
 
void clear ()
 
size_t size () const
 This function returns the number of pairs. ... More...
 
bool tokenExists (const std::string &token) const
 This function returns whether the map contains an entry for a particular token. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
iterator end ()
 same as std::map end Returns an iterator corresponding to the end of the map. More...
 
const_iterator end () const
 same as std::map end const Returns an const_iterator corresponding to the end of the map. More...
 
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. More...
 
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. More...
 
reverse_iterator rend ()
 same as std::map rend Returns an reverse_iterator corresponding to the reverse end of the map. More...
 
const_reverse_iterator rend () const
 same as std::map rend const Returns an const_reverse_iterator corresponding to the end of the map. More...
 
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 promoted from map_type::iterator ...

Definition at line 89 of file TokenMap.h.

const_reference promoted from map_type::const_reference ...

Definition at line 105 of file TokenMap.h.

const_reverse_iterator promoted from map_type::const_reverse_iterator ...

Definition at line 97 of file TokenMap.h.

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

Definition at line 77 of file TokenMap.h.

iterator promoted from map_type::iterator ...

Definition at line 85 of file TokenMap.h.

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

Definition at line 72 of file TokenMap.h.

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

Definition at line 68 of file TokenMap.h.

reference promoted from map_type::reference ...

Definition at line 101 of file TokenMap.h.

reverse_iterator promoted from map_type::reverse_iterator ...

Definition at line 93 of file TokenMap.h.

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

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.

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

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.

Member Function Documentation

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.

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.

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

Definition at line 193 of file TokenMap.h.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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

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.

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.

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.

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.

Member Data Documentation

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

Definition at line 304 of file TokenMap.h.


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