| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
plist::NamedEnumeration< T > Class Template Reference#include <plistPrimitives.h>
Inheritance diagram for plist::NamedEnumeration< T >: ![]() Detailed Descriptiontemplate<typename T>
Provides an interface for the use of enumerations in a plist -- you can specify values by either the string name or the corresponding integer value.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| NamedEnumeration () | |
| constructor | |
| NamedEnumeration (const NamedEnumeration &ne) | |
| copy constructor | |
| NamedEnumeration (const T &v, const char *const *enumnames, unsigned int maxval) | |
| constructor, pass initial value, array of strings (the names), and the one-plus-maximum enum value (i.e. the number of enumeration values if they run sequentially from 0) | |
| NamedEnumeration (const T &v) | |
| automatic casting from the enumeration | |
| NamedEnumeration & | operator= (const T &v) |
| assignment from enumeration value (numeric) | |
| NamedEnumeration & | operator= (const std::string &v) |
| assignment from string | |
| NamedEnumeration & | operator= (const NamedEnumeration< T > &ne) |
| assignment | |
| const T & | operator * () const |
| value access | |
| operator T () const | |
| automatic casting to the enumeration value | |
| void | setNames (const char *const *enumnames, unsigned int maxval) |
| (re)set the array of names and one-plus-maximum enum value (i.e. the number of enumeration values if they run sequentially from 0) | |
| const char *const * | getNames () const |
| returns the array of names previously provided from constructor or setNames() | |
| const char * | getName (unsigned int i) const |
| returns the name for a particular index | |
| unsigned int | getMax () const |
| returns the one-past-maximum of enumeration values previously provided to constructor or setNames() | |
| void | loadXML (xmlNode *node) |
| interprets node as either a string holding the name, or a number corresponding to its index (name is preferred) | |
| void | saveXML (xmlNode *node) const |
| saves name of current value (if available, index used otherwise) into node | |
| void | set (const std::string &str) |
| assign a new value | |
| std::string | get () const |
| return current value as a string | |
| virtual NamedEnumeration< T > * | clone () const __attribute__((warn_unused_result)) |
| implements the clone function for NamedEnumeration<T> | |
Protected Member Functions | |
| unsigned int | findName (const char *name) |
| returns the enum corresponding to name | |
Protected Attributes | |
| T | val |
| storage of enum value | |
| const char *const * | names |
| pointer to array of names -- enum value must be able to serve as index for lookup | |
| unsigned int | max |
| one-plus-maximum enum value, i.e. the number of enum entries if they are ordered sequentially from 0 | |
| plist::NamedEnumeration< T >::NamedEnumeration | ( | ) | [inline] |
| plist::NamedEnumeration< T >::NamedEnumeration | ( | const NamedEnumeration< T > & | ne | ) | [inline] |
| plist::NamedEnumeration< T >::NamedEnumeration | ( | const T & | v, | |
| const char *const * | enumnames, | |||
| unsigned int | maxval | |||
| ) | [inline] |
constructor, pass initial value, array of strings (the names), and the one-plus-maximum enum value (i.e. the number of enumeration values if they run sequentially from 0)
Definition at line 293 of file plistPrimitives.h.
| plist::NamedEnumeration< T >::NamedEnumeration | ( | const T & | v | ) | [inline] |
| NamedEnumeration< T > * plist::NamedEnumeration< T >::clone | ( | ) | const [virtual] |
implements the clone function for NamedEnumeration<T>
Implements plist::ObjectBase.
Definition at line 382 of file plistPrimitives.h.
| unsigned int plist::NamedEnumeration< T >::findName | ( | const char * | name | ) | [inline, protected] |
returns the enum corresponding to name
Definition at line 364 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::loadXML(), and plist::NamedEnumeration< T >::set().
| std::string plist::NamedEnumeration< T >::get | ( | ) | const [inline, virtual] |
return current value as a string
Implements plist::PrimitiveBase.
Definition at line 352 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::saveXML().
| unsigned int plist::NamedEnumeration< T >::getMax | ( | ) | const [inline] |
returns the one-past-maximum of enumeration values previously provided to constructor or setNames()
Definition at line 304 of file plistPrimitives.h.
| const char* plist::NamedEnumeration< T >::getName | ( | unsigned int | i | ) | const [inline] |
| const char* const* plist::NamedEnumeration< T >::getNames | ( | ) | const [inline] |
returns the array of names previously provided from constructor or setNames()
Definition at line 302 of file plistPrimitives.h.
| void plist::NamedEnumeration< T >::loadXML | ( | xmlNode * | node | ) | [inline, virtual] |
interprets node as either a string holding the name, or a number corresponding to its index (name is preferred)
Reimplemented from plist::ObjectBase.
Definition at line 307 of file plistPrimitives.h.
| const T& plist::NamedEnumeration< T >::operator * | ( | ) | const [inline] |
| plist::NamedEnumeration< T >::operator T | ( | ) | const [inline] |
| NamedEnumeration& plist::NamedEnumeration< T >::operator= | ( | const NamedEnumeration< T > & | ne | ) | [inline] |
| NamedEnumeration& plist::NamedEnumeration< T >::operator= | ( | const std::string & | v | ) | [inline] |
| NamedEnumeration& plist::NamedEnumeration< T >::operator= | ( | const T & | v | ) | [inline] |
| void plist::NamedEnumeration< T >::saveXML | ( | xmlNode * | node | ) | const [inline, virtual] |
saves name of current value (if available, index used otherwise) into node
Implements plist::ObjectBase.
Definition at line 333 of file plistPrimitives.h.
| void plist::NamedEnumeration< T >::set | ( | const std::string & | str | ) | [inline, virtual] |
assign a new value
Implements plist::PrimitiveBase.
Definition at line 343 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::loadXML(), and plist::NamedEnumeration< T >::operator=().
| void plist::NamedEnumeration< T >::setNames | ( | const char *const * | enumnames, | |
| unsigned int | maxval | |||
| ) | [inline] |
(re)set the array of names and one-plus-maximum enum value (i.e. the number of enumeration values if they run sequentially from 0)
Definition at line 301 of file plistPrimitives.h.
unsigned int plist::NamedEnumeration< T >::max [protected] |
one-plus-maximum enum value, i.e. the number of enum entries if they are ordered sequentially from 0
Definition at line 379 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::findName(), plist::NamedEnumeration< T >::get(), plist::NamedEnumeration< T >::getMax(), plist::NamedEnumeration< T >::operator=(), plist::NamedEnumeration< T >::saveXML(), and plist::NamedEnumeration< T >::setNames().
const char* const* plist::NamedEnumeration< T >::names [protected] |
pointer to array of names -- enum value must be able to serve as index for lookup
Definition at line 378 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::findName(), plist::NamedEnumeration< T >::get(), plist::NamedEnumeration< T >::getName(), plist::NamedEnumeration< T >::getNames(), plist::NamedEnumeration< T >::operator=(), plist::NamedEnumeration< T >::saveXML(), and plist::NamedEnumeration< T >::setNames().
T plist::NamedEnumeration< T >::val [protected] |
storage of enum value
Definition at line 377 of file plistPrimitives.h.
Referenced by plist::NamedEnumeration< T >::get(), plist::NamedEnumeration< T >::loadXML(), plist::NamedEnumeration< T >::operator *(), plist::NamedEnumeration< T >::operator T(), plist::NamedEnumeration< T >::operator=(), plist::NamedEnumeration< T >::saveXML(), and plist::NamedEnumeration< T >::set().
|
Tekkotsu v3.0 |
Generated Wed Oct 4 00:05:24 2006 by Doxygen 1.4.7 |