Yate
|
A named pointer class. More...
#include <yateclass.h>
Public Member Functions | |
NamedPointer (const char *name, GenObject *data=0, const char *value=0) | |
virtual | ~NamedPointer () |
GenObject * | userData () const |
GenObject * | takeData () |
void | userData (GenObject *data) |
void * | userObject (const String &name) const |
NamedPointer & | operator= (const char *value) |
virtual void * | getObject (const String &name) const |
Protected Member Functions | |
virtual void | changed () |
A named pointer class.
A named string holding a pointer to arbitrary data. The pointer is owned by the object: it will be released when the object is destroyed or the string value changed
NamedPointer | ( | const char * | name, |
GenObject * | data = 0 , |
||
const char * | value = 0 |
||
) |
Creates a new named pointer
name | Name of this pointer |
data | Initial pointer value. The pointer will be owned by this object |
value | Initial string value |
virtual ~NamedPointer | ( | ) | [virtual] |
Destructor. Release the pointer
virtual void changed | ( | ) | [protected, virtual] |
Called whenever the string value changed. Release the pointer
Reimplemented from String.
virtual void* getObject | ( | const String & | name | ) | const [virtual] |
Get a pointer to a derived class given that class name
name | Name of the class we are asking for |
Reimplemented from NamedString.
NamedPointer& operator= | ( | const char * | value | ) | [inline] |
String value assignment operator
Reimplemented from NamedString.
References NamedString::operator=().
GenObject* takeData | ( | ) |
Retrive the pointer carried by this object and release ownership. The caller will own the returned pointer
GenObject* userData | ( | ) | const [inline] |
Retrive the pointer carried by this object
void userData | ( | GenObject * | data | ) |
Set obscure data carried by this object. Note that a RefObject's reference counter should be increased before adding it to this named pointer
data | Pointer to arbitrary user data |
void* userObject | ( | const String & | name | ) | const [inline] |
Get a pointer to a derived class of user data given that class name
name | Name of the class we are asking for |