|
ubit
|
Base class of most Ubit objects (SEE DETAILS!). More...
#include <uobject.hpp>
Classes | |
| struct | MetaClass |
| struct | Modes |
| [Impl] internal object modes. More... | |
| struct | UConst |
Public Types | |
| typedef unsigned char | State |
| typedef short | PtrCount |
Public Member Functions | |
| UObject (const UObject &) | |
| UObject & | operator= (const UObject &) |
| virtual const UClass & | getClass () const |
| instance method that returns the metaclass of this object. More... | |
| const UStr & | getClassName () const |
| returns getClass().getName(). | |
| virtual void | error (const char *function_name, const char *format,...) const |
| prints out an error message. More... | |
| virtual void | warning (const char *function_name, const char *format,...) const |
| prints out a warning message: More... | |
| bool | isDeletable () const |
| checks if this object can be destroyed by 'delete'. More... | |
| bool | isConst () const |
| checks whether the content of this object can be modified ( More... | |
| UObject & | setConst () |
| specifies that the content of this object cannot be modified. More... | |
| bool | isAutoUpdate () const |
| return current update policy: More... | |
| UObject & | setAutoUpdate (bool state=true) |
| changes the update policy of this object when its is modified. More... | |
| bool | isIgnoringChangeCallbacks () const |
| return true if change callbacks are fired. | |
| UObject & | ignoreChangeCallbacks (bool state) |
| change callbacks are not fired if argument is true. | |
| virtual UNode * | toNode () |
| dynamic cast: returns this object if it derives from UNode and null otherwise. | |
| virtual const UNode * | toNode () const |
| dynamic cast: returns this object if it derives from UNode and null otherwise. | |
| virtual UAttr * | toAttr () |
| dynamic cast: returns this object if it derives from UAttr and null otherwise. | |
| virtual const UAttr * | toAttr () const |
| dynamic cast: returns this object if it derives from UAttr and null otherwise. | |
| virtual UElem * | toElem () |
| dynamic cast: returns this object if it derives from UElem and null otherwise. | |
| virtual const UElem * | toElem () const |
| dynamic cast: returns this object if it derives from UElem and null otherwise. | |
| virtual UData * | toData () |
| dynamic cast: returns this object if it derives from UData and null otherwise. | |
| virtual const UData * | toData () const |
| dynamic cast: returns this object if it derives from UData and null otherwise. | |
| virtual UStr * | toStr () |
| dynamic cast: returns this object if it derives from UStr and null otherwise. | |
| virtual const UStr * | toStr () const |
| dynamic cast: returns this object if it derives from UStr and null otherwise. | |
| virtual UCall * | toCall () |
| dynamic cast: returns this object if it derives from UCall and null otherwise. | |
| virtual const UCall * | toCall () const |
| dynamic cast: returns this object if it derives from UCall and null otherwise. | |
| virtual UBox * | toBox () |
| dynamic cast: returns this object if it derives from UBox and null otherwise. | |
| virtual const UBox * | toBox () const |
| dynamic cast: returns this object if it derives from UBox and null otherwise. | |
| virtual UWin * | toWin () |
| dynamic cast: returns this object if it derives from UWin and null otherwise. | |
| virtual const UWin * | toWin () const |
| dynamic cast: returns this object if it derives from UWin and null otherwise. | |
| virtual UMenu * | toMenu () |
| dynamic cast: returns this object if it derives from UMenu and null otherwise. | |
| virtual const UMenu * | toMenu () const |
| dynamic cast: returns this object if it derives from UMenu and null otherwise. | |
| State | getState () const |
| returns the current object state. | |
| void | setState (State s) |
| changes the object state. | |
| PtrCount | getPtrCount () const |
| [impl] returns the number of uptr<> smart pointers that are pointing to this object. | |
| bool | checkConst () const |
| [impl] produces an error if this object is logically constant ( More... | |
| bool | isDestructed () const |
| [impl] this object has been destructed (but memory has not been freed yet). | |
| bool | isDestructing () const |
| [impl] this object is being destructed (one of its destructors has been called). | |
| virtual bool | hasSceneGraphParent () const |
| void * | operator new (size_t) |
| < [impl] returns true if there is at least one scene graph parent (redefined by UNode). More... | |
| void | operator delete (void *) |
| delete operator is forbidden on instances that derive from UObject. | |
| void | addPtr () const |
| [Impl] a uptr is added to this object. | |
| void | removePtr () const |
| [Impl] a uptr is removed from this object. | |
Static Public Member Functions | |
| static const char * | getVersion () |
| returns the version of the Ubit package. | |
| static const UClass & | Class () |
| class method that returns the metaclass of this class. More... | |
| static UStyle * | createStyle () |
Static Public Attributes | |
| static UConst | UCONST |
| UCONST can be given as an argument to some constructors to make the object constant. More... | |
Protected Attributes | |
| PtrCount | ptr_count |
| Modes | omodes |
| State | ostate |
Friends | |
| class | UNode |
| class | UUpdateContext |
| class | UAppliImpl |
| class | USelection |
| class | UPtr |
Base class of most Ubit objects (SEE DETAILS!).
UObject is the base class for (almost) all Ubit objects. Its main subclasses are UNode, UAttr, UElem that play the same role as Node, Attribute and Element in a XML/DOM model and UBox and UWin that are the base classes for widgets and windows.
class UColor: public UAttr { public: UCLASS("UColor", UColor, new UColor) ..... };
UCLASS redefines getClass() and Class() which return a metaclass that describes the corresponding Ubit class (see UClass). getClass() is an instance method, Class() a static method.
Note that:
class MyClass : public UObject { .... };
uptr<MyClass> p1 = new MyClass(); // p1 points to a new MyClass object uptr<MyClass> p2 = p1; // p2 points to the same object
p1 = null; // (null = 0) does nothing because p2 also points to the object p2 = null; // destroys the object as no other uptr<> points on it
| bool UObject::checkConst | ( | ) | const |
[impl] produces an error if this object is logically constant (
|
inlinestatic |
class method that returns the metaclass of this class.
|
virtual |
prints out an error message.
this method displays an error message (on std::cerr by default) :
Reimplemented in ubit::UErrorHandler.
|
inlinevirtual |
instance method that returns the metaclass of this object.
Class() and getClass() return a metaclass (see UClass) that describes this class. Class() is a class method, while getClass() is an instance method.
WARNING: Class() and getClass() must be redefined by ALL Ubit classes. This can be done by invoking the UCLASS macro (see UNode) in the public section
Reimplemented in ubit::UDefaultBlockElement, ubit::UDefaultInlineElement, and ubit::UDefaultAttribute.
|
inline |
return current update policy:
|
inline |
checks whether the content of this object can be modified (
|
inline |
checks if this object can be destroyed by 'delete'.
objects that were allocated in the heap or in static memory, or that are plain fields of other objects cannot be destroyed by using 'delete'.
| void * UObject::operator new | ( | size_t | sz | ) |
< [impl] returns true if there is at least one scene graph parent (redefined by UNode).
[impl] internal memory management.
| UObject & UObject::setAutoUpdate | ( | bool | state = true | ) |
changes the update policy of this object when its is modified.
if 'state' is true, the object if automatically updated when modified
| UObject & UObject::setConst | ( | ) |
specifies that the content of this object cannot be modified.
an attempt to modify the content of this object will then produce an error. Notes:
|
virtual |
|
static |
UCONST can be given as an argument to some constructors to make the object constant.
an attempt to modify the value of this object will produce an error. Note that constness can't be changed once set.
1.8.12