#include <data.h>

Public Member Functions | |
| Data () | |
| Data (const Data &data) | |
| Data (const DataClass &blah) | |
| Data & | operator= (const Data &from) |
| ~Data () | |
| QString | type () const |
| bool | isNull () const |
| operator Symbol () const | |
| operator Token () const | |
| operator String () const | |
| Data & | operator+= (const Data &) |
| Data & | operator-= (const Data &) |
| Data & | operator/= (const Data &) |
| Data & | operator*= (const Data &) |
| bool & | operator!= (const Data &) |
| Data | getField (QString s) |
| void | setField (QString s, Data v) |
| bool & | operator== (const Data &) |
Public Attributes | |
| BASIC_TYPES | |
| ARRAY_TYPES | |
Protected Member Functions | |
| void | type_error (QString expected) const |
| void | visit (DataVisitor &v) |
Protected Attributes | |
| DataClass * | content |
Friends | |
| class | DataClass |
| class | DataVisitor |
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'
| Data::Data | ( | const Data & | data | ) |
| Data::Data | ( | const DataClass & | blah | ) |
| Data Data::getField | ( | QString | s | ) |
Value retrieval by string reference
References assert(), content, and DataClass::getField().
| bool Data::isNull | ( | ) | const |
true if the type of the content is Null false otherwise
Referenced by Index::read_idx().
| Data::operator String | ( | ) | const |
| 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
References content, and type_error().
| 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
References content, and type_error().
| 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
References assert().
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
References assert().
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
References assert().
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
References assert().
Empty function at the moment. Will assert itself. This function is necessary to allow the array templates to compile properly
References assert().
Will assign to this class by releasing the old content and refitting it with a pointer to the new. Reference counts are updated automatically.
References content.
| 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
References assert().
| void Data::setField | ( | QString | s, | |
| Data | v | |||
| ) |
Setting the values
References assert(), content, and DataClass::setField().
| QString Data::type | ( | ) | const [inline] |
Returns the type string of the data as a QString
References content, and DataClass::type_name().
Referenced by type_error().
| void Data::type_error | ( | QString | expected | ) | const [protected] |
called when a type error occurs. Currently this function exits the program
References assert(), data, printf(), and type().
Referenced by operator Symbol(), and operator Token().
| void Data::visit | ( | DataVisitor & | v | ) | [protected] |
References content, and DataClass::visit().
Referenced by DataVisitor::visit().
friend class DataClass [friend] |
friend class DataVisitor [friend] |
DataClass* Data::content [protected] |
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
Referenced by Data(), getField(), operator String(), operator Symbol(), operator Token(), operator=(), setField(), type(), visit(), and ~Data().
1.6.2