ubit
Public Member Functions | Static Public Attributes | Friends | List of all members
ubit::UArgs Class Reference

Argument list (for passing arguments to constructor or add functions). More...

#include <uargs.hpp>

Public Member Functions

 UArgs (UNode *)
 
 UArgs (UNode &)
 
 UArgs (const char *)
 
 UArgs (const UChild &)
 
 UArgs (const UArgs &)
 
 UArgs (const UArgsImpl &)
 
bool operator! () const
 returns true is this arglist is empty.
 
bool empty () const
 returns true is this arglist is empty.
 
UArgsoperator+= (const UArgs &arglist2)
 adds the children contained in 'arglist2' to this arglist.
 

Static Public Attributes

static const UArgs none
 the empty arglist.
 

Friends

class UElem
 
class UArgsImpl
 
const UArgsImploperator+ (const UArgsImpl &, const char *c_string)
 adds a C String to this arglist (note that the string content is duplicated).
 
const UArgsImploperator+ (const UArgsImpl &, UNode *)
 adds a UNode to this arglist (UNode is the base class for objects that can be part of the scene graph).
 
const UArgsImploperator+ (const UArgsImpl &, UNode &)
 adds a UNode to this arglist (UNode is the base class for objects that can be part of the scene graph).
 
const UArgsImploperator+ (const UArgsImpl &, const UChild &)
 adds a UChild to this arglist. More...
 
const UArgsImploperator+ (const UArgsImpl &, const UArgs &)
 adds the children contained in 'arglist2' to this arglist.
 

Detailed Description

Argument list (for passing arguments to constructor or add functions).

UArgs makes it possible to create "additive" argument lists by using the + operator.

A UArg object may either hold a single object pointer or reference, or a list of object pointers or references separated by + operators, example:

  class UButton : public UBox {
    UButton(UArgs arglist);
    ....
  };
  void foo() {
    UButton* b = new UButton(UPix::disquette + "Save" + ucall(obj, saveFunc));
    ...
  }

UArgs::none is the empty arglist.

Friends And Related Function Documentation

§ operator+

const UArgsImpl& operator+ ( const UArgsImpl ,
const UChild  
)
friend

adds a UChild to this arglist.

a UChild holds a UNode (UNode is the base class for objects that can be part of the scene graph) and, possibly, a UCond (a condition that specifies if this node is active). Example:

   UOn::action / ucall(obj, &MyObj::foo)

This statement is stored in a UChild where UOn::action corresponds to the condition and ucall(...) to the corresponding UNode (which is, in this example a callback object that will fire: obj->foo()). Note however that the condition part is generally null in which case the corresponding object is always active.


The documentation for this class was generated from the following files: