Data Class Reference
[Data]
#include <data.h>
List of all members.
Detailed Description
The class 'Data' represents a generic dataclass. It will take care to count the references of the content it refers to and will deallocate when the reference counter reaches zero. It will also automatically copy local allocated objects towards the heap when necessary.
All data is shared explicitly, thus a dataclass can be passed along as if it were a pointer itself. The content will be explicitly shared. Data should never be assigned in such a way that loops occur.
The dataclass provides functions for easy downcasting, with automatically included runtime type-check.
The data class is not supposed to have subclasses since it merely forms a wrapper around the actual content, which should be subclassed from the class 'DataClass'
Definition at line 202 of file data.h.
Constructor & Destructor Documentation
Will create a data object with Null as contents
Definition at line 95 of file data.cpp.
Data::Data |
( |
const Data & |
data |
) |
|
Will copy the data by taking a memory copy of the content. If the content is not yet allocated on the heap it will be copied as well. The copy is only of the internal references. The data objects behave explicitly shared.
Definition at line 101 of file data.cpp.
Will take a copy of the given class, which can be anything, ranging from Null, Numbers, Floats, Arrays to Tokens... The copy is only of the internal references. The data objects behave explicitly shared.
Definition at line 107 of file data.cpp.
Will decrease the reference count.
Definition at line 112 of file data.cpp.
Member Function Documentation
Data Data::getField |
( |
QString |
s |
) |
|
Value retrieval by string reference
Definition at line 180 of file data.cpp.
bool Data::isNull |
( |
|
) |
const |
true if the type of the content is Null false otherwise
Definition at line 130 of file data.cpp.
Data::operator String |
( |
|
) |
const |
Converts the data to a String by passing it back as a String value. If the type is not a symbol a type_error is cast
Definition at line 162 of file data.cpp.
Data::operator Symbol |
( |
|
) |
const |
Converts the data to a Symbol by passing it back as a Symbol value. If the type is not a symbol a type_error is cast
Definition at line 155 of file data.cpp.
Data::operator Token |
( |
|
) |
const |
Converts the data to a Token by passing it back as a Token value. If the type is not a symbol a type_error is cast
Definition at line 168 of file data.cpp.
bool& Data::operator!= |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 341 of file data.h.
Data& Data::operator*= |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 331 of file data.h.
Data& Data::operator+= |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 304 of file data.h.
Data& Data::operator-= |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 313 of file data.h.
Data& Data::operator/= |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 322 of file data.h.
Data & Data::operator= |
( |
const Data & |
from |
) |
|
Will assign to this class by releasing the old content and refitting it with a pointer to the new. Reference counts are updated automatically.
Definition at line 120 of file data.cpp.
bool& Data::operator== |
( |
const Data & |
|
) |
[inline] |
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
Definition at line 361 of file data.h.
void Data::setField |
( |
QString |
s, |
|
|
Data |
v | |
|
) |
| | |
Setting the values
Definition at line 186 of file data.cpp.
QString Data::type |
( |
|
) |
const [inline] |
Returns the type string of the data as a QString
Definition at line 258 of file data.h.
void Data::type_error |
( |
QString |
expected |
) |
const [protected] |
called when a type error occurs. Currently this function exits the program
Definition at line 79 of file data.cpp.
Friends And Related Function Documentation
Member Data Documentation
The actual content of this Data object. This is the only field and is copied along. The Data class has ownership over this pointer and will deallocate it as soon as the content its reference count reaches zero
Definition at line 213 of file data.h.
The documentation for this class was generated from the following files: