Support Forum G3D Web Page |
Convenient iteration over the keys of a Any::TABLE, usually for implementing construction of an object from an Any. More...
Public Member Functions | |
AnyTableReader (const String &name, const Any &a) | |
Verifies that is a TABLE with the given name. More... | |
AnyTableReader (const Any &a) | |
Verifies that is a TABLE. More... | |
const Any & | any () const |
Return the underlying Any. More... | |
bool | containsUnread (const String &s) const |
void | get (const String &s, String &v, const String &errMsg="") |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over. More... | |
void | get (const String &s, uint8 &v, const String &errMsg="") |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over. More... | |
void | get (const String &s, uint16 &v, const String &errMsg="") |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over. More... | |
template<class T > | |
void | get (const String &s, Array< T > &v, const String &errMsg="") |
Read an entire array at once. More... | |
template<class T > | |
void | get (const String &s, Table< String, T > &v, const String &errMsg="") |
Read an entire table at once. More... | |
template<class ValueType > | |
void | get (const String &s, ValueType &v, const String &errMsg="") |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over. More... | |
template<class ValueType > | |
void | get (const String &s, ValueType &v, ValueType(*factory)(const Any &), const String &errMsg="") |
bool | getFilenameIfPresent (const String &s, String &v) |
Uses Any::resolveStringAsFilename. More... | |
template<class ValueType > | |
bool | getIfPresent (const String &s, ValueType &v) |
Get the value associated with a key only if the key is actually present. More... | |
template<class ValueType > | |
bool | getIfPresent (const String &s, ValueType &v, ValueType(*factory)(const Any &)) |
Helper method for reading values that depend on a factory design pattern. More... | |
bool | hasMore () const |
const Any & | operator[] (const String &s) |
Same as get() More... | |
void | setReadStatus (const String &s, bool read) |
Force the flag used for detecting if a field has been read. More... | |
void | verifyDone () const |
Verifies that all keys have been read. More... | |
Convenient iteration over the keys of a Any::TABLE, usually for implementing construction of an object from an Any.
Getting an element using either iteration or explicit requests consumes that element from the iterator (but not from the Any!) It is an error to consume the same element more than once from the same iterator.
Verifies that is a TABLE with the given name.
G3D::AnyTableReader::AnyTableReader | ( | const Any & | a | ) |
Verifies that is a TABLE.
|
inline |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over.
If key s does not appear in the any, throws a G3D::ParseError.
If a G3D::ParseError is thrown, errMsg (optional) is appended to the G3D::ParseError::message.
Assumes that if key s appears in the any it has not already been extracted by this iterator. If it has been read before, an assertion will fail in debug mode.
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over.
If key s does not appear in the any, throws a G3D::ParseError.
If a G3D::ParseError is thrown, errMsg (optional) is appended to the G3D::ParseError::message.
Assumes that if key s appears in the any it has not already been extracted by this iterator. If it has been read before, an assertion will fail in debug mode.
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over.
If key s does not appear in the any, throws a G3D::ParseError.
If a G3D::ParseError is thrown, errMsg (optional) is appended to the G3D::ParseError::message.
Assumes that if key s appears in the any it has not already been extracted by this iterator. If it has been read before, an assertion will fail in debug mode.
|
inline |
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over.
If key s does not appear in the any, throws a G3D::ParseError.
If a G3D::ParseError is thrown, errMsg (optional) is appended to the G3D::ParseError::message.
Assumes that if key s appears in the any it has not already been extracted by this iterator. If it has been read before, an assertion will fail in debug mode.
|
inline |
Get the value associated with a key only if the key is actually present.
If key s appears in the any, reads its value into v and removes that key from the ones available to iterate over.
If key s does not appear in the any, does nothing.
Assumes that if key s appears in the any it has not already been extracted by this iterator. If it has been read before, an assertion will fail in debug mode.
Referenced by G3D::Spline< UprightFrame >::init().
|
inline |
Helper method for reading values that depend on a factory design pattern.
E.g., replaces the idiom:
with
|
inline |
|
inline |
Force the flag used for detecting if a field has been read.
void G3D::AnyTableReader::verifyDone | ( | ) | const |
Verifies that all keys have been read.
Referenced by G3D::Spline< UprightFrame >::Spline().