A type that can hold any kind of value type. More...
#include <value_store.h>
Public Member Functions | |
template<class T > | |
ValueStore & | assimilate (T *obj) |
stores obj in this and takes over ownership of obj | |
void | clear () |
destroys and releases any stored value | |
bool | empty () const |
Returns true if holder does not contain a value. | |
void * | extract_raw () const |
ValueStore & | operator= (ValueStore other) |
stores a copy of other releasing any previous value | |
template<class T > | |
ValueStore & | operator= (const T &obj) |
stores a copy of obj releasing any previous value | |
void | surrender () |
surrenders any stored value without destroying it | |
void | swap (ValueStore &other) |
swaps this with other | |
const std::type_info & | type () const |
Returns the type of the stored value. | |
ValueStore () | |
creates an empty object | |
ValueStore (const ValueStore &other) | |
copies the value in other | |
template<class T > | |
ValueStore (const T &obj) | |
stores a copy of obj | |
~ValueStore () | |
releases any stored value | |
Private Types | |
enum | { call_extract = 0, vcall_clone = 1, vcall_destroy = 2, vcall_typeid = 3 } |
typedef detail::vptr_type | vptr_type |
Private Member Functions | |
void | clone (const void *obj, void **out) const |
void * | extract (void **o) const |
Private Attributes | |
void * | value_ |
vptr_type | vptr_ |
A type that can hold any kind of value type.
Definition at line 40 of file value_store.h.
typedef detail::vptr_type ProgramOptions::ValueStore::vptr_type [private] |
Definition at line 93 of file value_store.h.
anonymous enum [private] |
Definition at line 92 of file value_store.h.
creates an empty object
Definition at line 26 of file value_store.cpp.
ProgramOptions::ValueStore::ValueStore | ( | const ValueStore & | other | ) |
copies the value in other
Definition at line 30 of file value_store.cpp.
ProgramOptions::ValueStore::ValueStore | ( | const T & | obj | ) | [inline] |
stores a copy of obj
Definition at line 48 of file value_store.h.
releases any stored value
Definition at line 37 of file value_store.cpp.
ValueStore& ProgramOptions::ValueStore::assimilate | ( | T * | obj | ) | [inline] |
stores obj in this and takes over ownership of obj
Definition at line 68 of file value_store.h.
void ProgramOptions::ValueStore::clear | ( | ) |
destroys and releases any stored value
Definition at line 59 of file value_store.cpp.
void ProgramOptions::ValueStore::clone | ( | const void * | obj, |
void ** | out | ||
) | const [private] |
Definition at line 70 of file value_store.cpp.
bool ProgramOptions::ValueStore::empty | ( | ) | const [inline] |
Returns true if holder does not contain a value.
Definition at line 77 of file value_store.h.
void * ProgramOptions::ValueStore::extract | ( | void ** | o | ) | const [private] |
Definition at line 74 of file value_store.cpp.
void* ProgramOptions::ValueStore::extract_raw | ( | ) | const [inline] |
Definition at line 86 of file value_store.h.
ValueStore & ProgramOptions::ValueStore::operator= | ( | ValueStore | other | ) |
stores a copy of other releasing any previous value
Definition at line 40 of file value_store.cpp.
ValueStore& ProgramOptions::ValueStore::operator= | ( | const T & | obj | ) | [inline] |
stores a copy of obj releasing any previous value
Definition at line 59 of file value_store.h.
surrenders any stored value without destroying it
Definition at line 66 of file value_store.cpp.
void ProgramOptions::ValueStore::swap | ( | ValueStore & | other | ) |
swaps this with other
Definition at line 44 of file value_store.cpp.
const std::type_info & ProgramOptions::ValueStore::type | ( | ) | const |
Returns the type of the stored value.
Definition at line 49 of file value_store.cpp.
void* ProgramOptions::ValueStore::value_ [private] |
Definition at line 97 of file value_store.h.
vptr_type ProgramOptions::ValueStore::vptr_ [private] |
Definition at line 96 of file value_store.h.