![]() |
BlitzMax Extended
0.8.11
Pushing Blitz to the Max.
|
The root type which all other objects extend. More...
Go to the source code of this file.
Data Structures | |
struct | BBObject |
Basic BlitzMax object data type. More... | |
Defines | |
#define | BBNULL (&bbNullObject) |
General purpose NULL object pointer. | |
Functions | |
BBObject * | bbObjectNew (const BBClass *clas) |
Creates a new instance of a class. | |
void | bbObjectFree (BBObject *obj) |
Frees an object from memory. | |
void | bbObjectCtor (BBObject *obj) |
Initializes a generic object. | |
void | bbObjectDtor (BBObject *obj) |
Deinitializes a generic object. | |
BBString * | bbObjectToString (const BBObject *obj) |
Gives the memory location of an object in a string. | |
BBInt | bbObjectCompare (const BBObject *obj, const BBObject *rhs) |
Compares the memory location of two objects. | |
BBObject * | bbObjectSendMessage (const BBObject *obj, const BBObject *src) |
Does not perform any action. | |
BBObject * | bbObjectClone (const BBObject *obj) |
Creates an exact clone of the given object. | |
void | bbObjectReserved () |
Throws a warning that the called virtual function is reserved for future use. | |
Variables | |
BBClass | bbObjectClass |
The parent class to all other user-defined classes. | |
BBObject | bbNullObject |
A compile time instance representing a NULL object. |
The root type which all other objects extend.
While classes contain information and functionality for all instances of a kind. An object is one of said instances and holds variables ("Field") that describe its current state. These member variables can be modified via the virtual functions from the respective BBClass.
#define BBNULL (&bbNullObject) |
General purpose NULL object pointer.
Can be used as a NULL pointer for all BBObject* and user-defined types.
Referenced by bbExceptionInitCause(), bbNullFunctionExceptionCreate(), bbNullMethodExceptionCreate(), bbNullObjectExceptionCreate(), bbOutOfDataExceptionCreate(), bbStringFromChar(), and bbStringFromUTF8String().
BBObject* bbObjectClone | ( | const BBObject * | obj | ) |
Creates an exact clone of the given object.
Cloning means that the returned object is a completely new instance with the exact same property ("Field") values as the given one.
This default implementatin reads the necessary information for creating a new class instance from the debug_scope property of the given object's class. Every "Field" declaration that is found, is then copied depending on its type:
All primitive data types are copied by value using memcpy. The complex ones (BBObject, BBString & BBArray) are copied by reference, which means the cloned object's members point to the same instance.
If the given object is either NULL, does not have a valid class or is a pointer to bbNullObject, BBNULL is returned.
obj | Any class instance |
BBInt bbObjectCompare | ( | const BBObject * | obj, |
const BBObject * | rhs | ||
) |
Compares the memory location of two objects.
obj | The object to compare with |
rhs | The righthand side object to compare against the first one |
void bbObjectCtor | ( | BBObject * | obj | ) |
Initializes a generic object.
This sets the object's "clas" member to bbObjectClass.
obj | A pointer to any object |
void bbObjectDtor | ( | BBObject * | obj | ) |
Deinitializes a generic object.
This sets the object's "clas" member to NULL.
obj | A pointer to any object |
void bbObjectFree | ( | BBObject * | obj | ) |
Frees an object from memory.
Calls the class' destructor on the given obj
. In single-threaded mode this also deallocates the instance using the GC.
obj | A pointer to the object to be freed |
BBObject* bbObjectNew | ( | const BBClass * | clas | ) |
Creates a new instance of a class.
This allocates a new object with the GC and initializes it with the given class' constructor function.
All new instances of user defined classes (BlitzMax "Type") are created with this function. The compiler calls it whenever he comes across the "New" keyword in BlitzMax code.
clas | The class of the object to create |
void bbObjectReserved | ( | ) |
Throws a warning that the called virtual function is reserved for future use.
BBObject* bbObjectSendMessage | ( | const BBObject * | obj, |
const BBObject * | src | ||
) |
Does not perform any action.
This is only a place holder for the named virtual function in each class.
obj | The object |
src | The source |
BBString* bbObjectToString | ( | const BBObject * | obj | ) |
Gives the memory location of an object in a string.
obj | The object of which the memory location is returned |
The parent class to all other user-defined classes.
It contains default implementations for all named virtual functions that are used if a class (and its parents) do not defined their own.