![]() |
|
A map with string keys and VtValue values. More...
#include <dictionary.h>
Public Types | |
| typedef _Map::key_type | key_type |
| typedef _Map::mapped_type | mapped_type |
| typedef _Map::value_type | value_type |
| typedef _Map::allocator_type | allocator_type |
| typedef _Map::size_type | size_type |
| typedef Iterator< _Map *, _Map::iterator > | iterator |
| typedef Iterator< _Map const *, _Map::const_iterator > | const_iterator |
Public Member Functions | |
| TF_MALLOC_TAG_NEW ("Vt", "VtDictionary") | |
| VtDictionary () | |
Creates an empty VtDictionary. | |
| VtDictionary (int size) | |
Creates an empty VtDictionary with at least size buckets. | |
| template<class _InputIterator > | |
| VtDictionary (_InputIterator f, _InputIterator l) | |
Creates a VtDictionary with a copy of a range. | |
| VT_API | VtDictionary (VtDictionary const &other) |
Creates a copy of the supplied VtDictionary. | |
| VT_API | VtDictionary (VtDictionary &&other)=default |
Creates a new VtDictionary by moving the supplied VtDictionary. | |
| VT_API | VtDictionary (std::initializer_list< value_type > init) |
| Creates a new VtDictionary from a braced initializer list. | |
| VT_API VtDictionary & | operator= (VtDictionary const &other) |
| Copy assignment operator. | |
| VT_API VtDictionary & | operator= (VtDictionary &&other)=default |
| Move assignment operator. | |
| VT_API VtValue & | operator[] (const std::string &key) |
Returns a reference to the VtValue that is associated with a particular key. | |
| VT_API size_type | count (const std::string &key) const |
Counts the number of elements whose key is key. | |
| VT_API size_type | count (const char *key) const |
Counts the number of elements whose key is key. | |
| VT_API size_type | erase (const std::string &key) |
Erases the element whose key is key. | |
| VT_API iterator | erase (iterator it) |
Erases the element pointed to by it. | |
| VT_API iterator | erase (iterator f, iterator l) |
| Erases all elements in a range. | |
| VT_API void | clear () |
| Erases all of the elements. | |
| VT_API iterator | find (const std::string &key) |
Finds an element whose key is key. | |
| VT_API iterator | find (const char *key) |
Finds an element whose key is key. | |
| VT_API const_iterator | find (const std::string &key) const |
Finds an element whose key is key. | |
| VT_API const_iterator | find (const char *key) const |
Finds an element whose key is key. | |
| VT_API iterator | begin () |
Returns an iterator pointing to the beginning of the VtDictionary. | |
| VT_API const_iterator | begin () const |
Returns an iterator pointing to the beginning of the VtDictionary. | |
| VT_API iterator | end () |
Returns an iterator pointing to the end of the VtDictionary. | |
| VT_API const_iterator | end () const |
Returns an iterator pointing to the end of the VtDictionary. | |
| VT_API size_type | size () const |
| Returns the size of the VtDictionary. | |
| VT_API bool | empty () const |
true if the VtDictionary's size is 0. | |
| VT_API void | swap (VtDictionary &dict) |
Swaps the contents of two VtDictionaries. | |
| template<class _InputIterator > | |
| void | insert (_InputIterator f, _InputIterator l) |
Inserts a range into the VtDictionary. | |
| VT_API std::pair< iterator, bool > | insert (const value_type &obj) |
Inserts obj into the VtDictionary. | |
| VT_API VtValue const * | GetValueAtPath (std::string const &keyPath, char const *delimiters=":") const |
Return a pointer to the value at keyPath if one exists. | |
| VT_API VtValue const * | GetValueAtPath (std::vector< std::string > const &keyPath) const |
Return a pointer to the value at keyPath if one exists. | |
| VT_API void | SetValueAtPath (std::string const &keyPath, VtValue const &value, char const *delimiters=":") |
Set the value at keyPath to value. | |
| VT_API void | SetValueAtPath (std::vector< std::string > const &keyPath, VtValue const &value) |
Set the value at keyPath to value. | |
| VT_API void | EraseValueAtPath (std::string const &keyPath, char const *delimiters=":") |
| Erase the value at keyPath. | |
| VT_API void | EraseValueAtPath (std::vector< std::string > const &keyPath) |
| Erase the value at keyPath. | |
Friends | |
| void | swap (VtDictionary &lhs, VtDictionary &rhs) |
| size_t | hash_value (VtDictionary const &dict) |
A map with string keys and VtValue values.
VtDictionary converts to and from a python dictionary as long as each element contains either
For a list of functions that can manipulate VtDictionary objects, see the
VtDictionary Functions group page .
Definition at line 52 of file dictionary.h.
| typedef _Map::allocator_type allocator_type |
Definition at line 186 of file dictionary.h.
| typedef Iterator<_Map const*, _Map::const_iterator> const_iterator |
Definition at line 190 of file dictionary.h.
| typedef Iterator<_Map*, _Map::iterator> iterator |
Definition at line 189 of file dictionary.h.
| typedef _Map::key_type key_type |
Definition at line 183 of file dictionary.h.
| typedef _Map::mapped_type mapped_type |
Definition at line 184 of file dictionary.h.
| typedef _Map::size_type size_type |
Definition at line 187 of file dictionary.h.
| typedef _Map::value_type value_type |
Definition at line 185 of file dictionary.h.
|
inline |
Creates an empty VtDictionary.
Definition at line 193 of file dictionary.h.
|
inlineexplicit |
Creates an empty VtDictionary with at least size buckets.
Definition at line 196 of file dictionary.h.
|
inline |
Creates a VtDictionary with a copy of a range.
Definition at line 200 of file dictionary.h.
| VT_API VtDictionary | ( | VtDictionary const & | other | ) |
Creates a copy of the supplied VtDictionary.
|
default |
Creates a new VtDictionary by moving the supplied VtDictionary.
| VT_API VtDictionary | ( | std::initializer_list< value_type > | init | ) |
Creates a new VtDictionary from a braced initializer list.
| VT_API iterator begin | ( | ) |
Returns an iterator pointing to the beginning of the VtDictionary.
| VT_API const_iterator begin | ( | ) | const |
Returns an iterator pointing to the beginning of the VtDictionary.
| VT_API void clear | ( | ) |
Erases all of the elements.
| VT_API size_type count | ( | const char * | key | ) | const |
Counts the number of elements whose key is key.
| VT_API size_type count | ( | const std::string & | key | ) | const |
Counts the number of elements whose key is key.
| VT_API bool empty | ( | ) | const |
true if the VtDictionary's size is 0.
| VT_API iterator end | ( | ) |
Returns an iterator pointing to the end of the VtDictionary.
| VT_API const_iterator end | ( | ) | const |
Returns an iterator pointing to the end of the VtDictionary.
| VT_API size_type erase | ( | const std::string & | key | ) |
Erases the element whose key is key.
| VT_API iterator erase | ( | iterator | f, |
| iterator | l | ||
| ) |
Erases all elements in a range.
| VT_API iterator erase | ( | iterator | it | ) |
Erases the element pointed to by it.
| VT_API void EraseValueAtPath | ( | std::string const & | keyPath, |
| char const * | delimiters = ":" |
||
| ) |
Erase the value at keyPath.
keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. If no such element exists at keyPath, do nothing. If keyPath identifies a sub-dictionary, erase the entire sub-dictionary.
| VT_API void EraseValueAtPath | ( | std::vector< std::string > const & | keyPath | ) |
Erase the value at keyPath.
If no such element exists at keyPath, do nothing. If keyPath identifies a sub-dictionary, erase the entire sub-dictionary.
| VT_API iterator find | ( | const char * | key | ) |
Finds an element whose key is key.
| VT_API const_iterator find | ( | const char * | key | ) | const |
Finds an element whose key is key.
| VT_API iterator find | ( | const std::string & | key | ) |
Finds an element whose key is key.
| VT_API const_iterator find | ( | const std::string & | key | ) | const |
Finds an element whose key is key.
| VT_API VtValue const * GetValueAtPath | ( | std::string const & | keyPath, |
| char const * | delimiters = ":" |
||
| ) | const |
Return a pointer to the value at keyPath if one exists.
keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. keyPath may identify a leaf element or an entire sub-dictionary. Return null if no such element at keyPath exists.
| VT_API VtValue const * GetValueAtPath | ( | std::vector< std::string > const & | keyPath | ) | const |
Return a pointer to the value at keyPath if one exists.
keyPath may identify a leaf element or an entire sub-dictionary. Return null if no such element at keyPath exists.
|
inline |
Inserts a range into the VtDictionary.
Definition at line 313 of file dictionary.h.
| VT_API std::pair< iterator, bool > insert | ( | const value_type & | obj | ) |
Inserts obj into the VtDictionary.
|
default |
Move assignment operator.
| VT_API VtDictionary & operator= | ( | VtDictionary const & | other | ) |
Copy assignment operator.
| VT_API VtValue & operator[] | ( | const std::string & | key | ) |
Returns a reference to the VtValue that is associated with a particular key.
| VT_API void SetValueAtPath | ( | std::string const & | keyPath, |
| VtValue const & | value, | ||
| char const * | delimiters = ":" |
||
| ) |
Set the value at keyPath to value.
keyPath is a delimited string of sub-dictionary names. Key path elements are produced by calling TfStringTokenize() with keyPath and delimiters. Create sub-dictionaries as necessary according to the path elements in keyPath. If keyPath identifies a full sub-dictionary, replace the entire sub-dictionary with value.
| VT_API void SetValueAtPath | ( | std::vector< std::string > const & | keyPath, |
| VtValue const & | value | ||
| ) |
Set the value at keyPath to value.
Create sub-dictionaries as necessary according to the path elements in keyPath. If keyPath identifies a full sub-dictionary, replace the entire sub-dictionary with value.
| VT_API size_type size | ( | ) | const |
Returns the size of the VtDictionary.
| VT_API void swap | ( | VtDictionary & | dict | ) |
Swaps the contents of two VtDictionaries.
|
friend |
Definition at line 303 of file dictionary.h.
|
friend |
Definition at line 299 of file dictionary.h.