#include <ubrick.hpp>
Inheritance diagram for UBrick:
Public Member Functions | |
UBrick (u_modes b_modes=0) | |
standard constructor; see class UBrick and UBrick::~UBrick | |
virtual | ~UBrick () |
see important notes on recursive deletion | |
virtual const char * | getClassName () const |
returns the name of the class of this object. | |
void | setAutoUpdate (bool) |
specifies whether update() is invoked when set(), add() or remove() are called. | |
bool | isAutoUpdate () const |
virtual int | getParentCount () const |
returns the number of parents | |
virtual UGroup ** | getParents () const |
virtual UGroup ** | getParents (int &parent_count) const |
returns a copy of the object's parent list | |
virtual int | getParents (std::vector< UGroup * > &parent_vect) const |
returns a copy of the object's parent list (and the parent count) | |
virtual UGroup * | getParent (int pos) const |
returns the nth parent | |
virtual bool | isChildOf (class UGroup *possible_parent, bool indirect) const |
is this object a child of 'possible_parent'? | |
virtual void | removeFromParents (bool update_parents=true) |
removes the brick from all parents | |
bool | isBmode (u_modes some_Bmodes) const |
[impl] is ONE of these Brick modes verified ? (see class UMode for details). | |
u_modes | getBmodes () const |
[impl] returns current Brick mode bitmask. | |
void | setBmodes (u_modes bmodes, bool on_off) |
[impl] sets Brick modes to ON (resp OFF) if last arg is true (resp false). | |
void * | operator new (size_t) |
void | operator delete (void *) |
void | addRef () |
void | removeRef () |
u_count | getRefCount () const |
[impl] implementation: memory management. | |
virtual void | fire (class UEvent &, const class UOn &) const |
[impl] calls callback functions. | |
virtual class UProp * | propCast () |
virtual class UElem * | elemCast () |
virtual class UStr * | strCast () |
virtual class UGroup * | groupCast () |
virtual class UBox * | boxCast () |
virtual class UWin * | winCast () |
virtual class UGroup * | getSubGroup () |
[impl] implementation: simulates dynamic cast. | |
virtual void | addingTo (class ULink *selflink, class UGroup *parent) |
virtual void | removingFrom (class ULink *selflink, class UGroup *parent) |
virtual void | destructs () |
[impl] see important note on subclassing | |
Static Public Member Functions | |
const char * | getUbitVersion () |
returns the version of the Ubit package. | |
template<class CC> | |
bool | isInstance (const UBrick *_obj) |
is 'obj' an instance of 'CC' | |
void | error (const char *id, const char *msg) |
void | error (const char *id, const char *msg, long arg) |
void | error (const char *id, const char *msg, const char *arg) |
void | error (const char *id, const char *msg, const UStr &arg) |
void | error (const char *id, const char *msg, const std::string &arg) |
throws an error (and prints an error message) | |
Friends | |
class ULink & | operator/ (const UCond &, UBrick &) |
class ULink & | operator/ (const UCond &, UBrick *) |
conditional operator (for callback functions and conditionnal objects) |
IMPORTANT NOTES:
1. When an object is destroyed, its direct and indirect children are also destroyed except if:
2. C++ pointers and references are unsafe and should only be used for temporary variables. Ubit provides "smart pointers" that manage memory in a simple and safe way (see template uptr<>).
Objects pointed by smart pointers:
Hence, these objects pointed are automatically destroyed when needed:
uptr<UBox> box = new UBox(); uptr<UButton> btn = ubutton("my button"); box->add(*btn); btn = null; // 'btn' does not point any longer to the UButton box = null; // destroys the UBox and its UButton child // if they do no have other parents and are not // pointed by other smart pointers
3. Alternatively, C++ variables can also be "plain objects" instead of pointers. Objects created in this way are destroyed automatically. Note that:
void foo() { UStr str ="abcde"; } // the UStr is destroyed
4. The = operator copies the content of C++ objects. UBrick and most of its subclasses forbid this operator (the set() method must be used instead)
See also: UBrick::~UBrick and uptr<>
|
standard constructor; see class UBrick and UBrick::~UBrick argument 'b_mode' is used internally and should not be set by clients. |
|
see important notes on recursive deletion All destructors destroys the children and descendants of the object being deleted if:
Advices:
|
|
... inutile pour les UCONST!!!; Reimplemented in UMode, UPos, and UViewStyle. |
|
[impl] see important note on subclassing destructs() unlinks the object from its parents and destroys children (when applicable). Any class that redefines removingFrom() MUST HAVE A DESTRUCTOR that calls destructs(). |
|
throws an error (and prints an error message) arguments:
|
|
returns the nth parent args:
|
|
returns a copy of the object's parent list (and the parent count) args:
|
|
returns a copy of the object's parent list args:
|
|
is this object a child of 'possible_parent'? args:
|
|
removes the brick from all parents notes: 1) Ubit objects can have several parents! 2) this function is potentially dangerous: the UGroup::remove() and UGroup::removeAll() methods should be prefered when possible. |
|
... inutile pour les UCONST!!!; Reimplemented in UMode, UPos, and UViewStyle. |
|
conditional operator (for callback functions and conditionnal objects) this operator is used for specifying call-back functions or conditionnal objects (see classes UCall, UOn and UFlag). |