All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Valuable::Node Class Reference

Base class for objects that include member variables with automatic IO. More...

#include <Valuable/Node.hpp>

Inheritance diagram for Valuable::Node:
Valuable::Attribute Patterns::NotCopyable Valuable::Serializable Extensions::MissileCmd::Score Extensions::TimeLine::ItemState Luminous::GLKeyStone Luminous::Mipmap Luminous::MultiHead Luminous::MultiHead::Area Luminous::MultiHead::Window Luminous::PostProcessFilter Luminous::RGBCube Luminous::TextLayout MultiWidgets::Application MultiWidgets::KeyboardWidget::KeyboardLineDef MultiWidgets::KeyboardWidget::KeyDef MultiWidgets::RippleOverlayWidget::CircleObstacle Resonant::Module Resonant::SoundRectangle Stylish::Styleable Valuable::FileWatcher WebBrowserCef::WebPage

Public Types

typedef container::const_iterator const_iterator
 
typedef Radiant::ArrayMap
< QByteArray, Attribute * > 
container
 Container for attributes, key is the attribute name.
 
typedef container::iterator iterator
 Iterator for the container.
 
typedef std::function< void(Radiant::BinaryData &)> ListenerFuncBd
 Listener function type that takes a BinaryData reference as a parameter, similar to eventProcess.
 
typedef std::function< void()> ListenerFuncVoid
 Default listener function type.
 
enum  ListenerType { DIRECT =1, AFTER_UPDATE =2, AFTER_UPDATE_ONCE =4 }
 Types of event listeners. More...
 
typedef int64_t Uuid
 Unique identifier type.
 
- Public Types inherited from Valuable::Attribute
enum  Layer {
  DEFAULT = 0, STYLE, USER, STYLE_IMPORTANT,
  LAYER_COUNT, LAYER_CURRENT
}
 Attribute has multiple independent attribute values on LAYER_COUNT different layers. More...
 
typedef std::function< void()> ListenerFunc
 Callback function type in the listener API.
 
enum  ListenerRole { DELETE_ROLE = 1 << 0, CHANGE_ROLE = 1 << 1, ALL_ROLES = (CHANGE_ROLE << 1) -1 }
 Different listener roles, used when adding a new listener.
 
enum  ValueUnit {
  VU_UNKNOWN, VU_PXS, VU_PERCENTAGE, VU_EMS,
  VU_EXS
}
 Units of a value. More...
 

Valuable Attributes

Node::Uuid id = generateId()
 Returns the unique id. More...
 

Public Member Functions

bool acceptsEvent (const QByteArray &messageId) const
 Returns true if this object accepts event 'id' in eventProcess.
 
bool addAttribute (Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
bool addAttribute (const QByteArray &name, Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects.
 
template<typename Widget >
bool addAttribute (const QByteArray &name, const Radiant::IntrusivePtr< Widget > &attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
long addListener (const QByteArray &attribute, v8::Persistent< v8::Function > func, int role=Attribute::CHANGE_ROLE)
 Add a JavaScript attribute listener to attribute belonging this Node. More...
 
virtual Attributeattribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
template<typename T >
AttributeT< T > * attribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
const containerattributes () const
 
void clearValues (Layer layer)
 Clears all Attribute values of the given layer. More...
 
void debugDump ()
 Prints the contents of this Attribute to the terminal.
 
virtual bool deserialize (const ArchiveElement &element)
 De-serializes this object (and its children) from a DOM node.
 
void eventAddDeprecated (const QByteArray &deprecatedId, const QByteArray &newId)
 Register a deprecated event that is automatically converted to new event id and a warning is issued when it is used. More...
 
void eventAddIn (const QByteArray &messageId)
 Registers a new event that this class handles in eventProcess.
 
template<typename Widget >
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Radiant::IntrusivePtr< Widget > &listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Valuable::Node *listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, Node *dstNode, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, Node *dstNode, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
void eventAddOut (const QByteArray &eventId)
 Registers a new event this class can send with eventSend.
 
const QSet< QByteArray > & eventInNames () const
 Returns set of all registered IN events.
 
unsigned eventListenerCount () const
 Returns the number of event listeners.
 
const QSet< QByteArray > & eventOutNames () const
 Returns set of all registered OUT events.
 
void eventPassingEnable (bool enable)
 Control whether events are passed.
 
template<typename Widget >
int eventRemoveListener (Radiant::IntrusivePtr< Widget > &listener)
 Removes all events from this object to given listener. More...
 
template<typename Widget >
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Radiant::IntrusivePtr< Widget > &listener=Radiant::IntrusivePtr< Widget >())
 Removes events from this object that match the parameters. More...
 
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Valuable::Node *listener=0)
 Removes event listeners from this object. More...
 
int eventRemoveListener (Valuable::Node *listener)
 Removes all events from this object to given listener. More...
 
bool eventRemoveListener (long listenerId)
 Removes event listener with given id. More...
 
void eventSend (const QByteArray &eventId, Radiant::BinaryData &bd)
 Sends an event and bd to all listeners on this eventId.
 
void eventSend (const QByteArray &eventId)
 Sends an event to all listeners on this eventId.
 
template<typename P1 >
void eventSend (const QByteArray &eventId, const P1 &p1)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Sends an event to all listeners on this eventId. More...
 
unsigned eventSourceCount () const
 Returns the number of event sources.
 
Uuid id () const
 Returns the unique id.
 
bool isBeingDestroyed () const
 Returns true if we are about to delete this object. More...
 
bool loadFromFileXML (const QString &filename)
 Reads this object (and its children) from an XML file.
 
bool loadFromMemoryXML (const QByteArray &buffer)
 Reads this object (and its children) from a memory buffer.
 
 Node (Node *host, const QByteArray &name="", bool transit=false)
 Constructs a new Node and adds it under the given host. More...
 
 Node (Node &&node)
 Moves a node, including all its attributes, events etc. More...
 
Nodeoperator= (Node &&node)
 Moves a node, replacing this. More...
 
virtual bool readElement (const ArchiveElement &element)
 Handles a serialization element that lacks automatic handlers. More...
 
void removeAttribute (Attribute *const attribute)
 Removes an Attribute from the list of attribute objects.
 
bool saveToFileXML (const QString &filename, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to an XML file.
 
bool saveToMemoryXML (QByteArray &buffer, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to binary data buffer.
 
virtual ArchiveElement serialize (Archive &doc) const
 Serializes this object (and its children) to a DOM node.
 
virtual void setAsDefaults ()
 Sets the current USER attribute value as the default value and clears the USER value. More...
 
void setId (Uuid newId)
 Sets the unique id. More...
 
template<class T >
bool setValue (const QByteArray &name, const T &v)
 Uses a query string to find a Attribute, and sets a new value to that if found. More...
 
bool setValue (const QByteArray &name, v8::Handle< v8::Value > v)
 Set attribute value from JavaScript. More...
 
- Public Member Functions inherited from Valuable::Attribute
long addListener (ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (Node *listener, ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (v8::Persistent< v8::Function > func, int role=CHANGE_ROLE)
 Adds a JavaScript listener that is invoked whenever the value is changed. More...
 
virtual float asFloat (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in a floating point number. More...
 
virtual int asInt (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in an integer. More...
 
virtual QString asString (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object to a string. More...
 
 Attribute (const Attribute &o)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
 Attribute (Node *host, const QByteArray &name, bool transit=false)
 Constructs a new value object and attaches it to its host. More...
 
virtual void clearValue (Layer layer)
 Unsets the value from a specific layer. More...
 
virtual void emitChange ()
 Invokes the change valueChanged function of all listeners.
 
virtual void eventProcess (const QByteArray &id, Radiant::BinaryData &data)
 Process a message. More...
 
void eventProcessFloat (const char *id, float v)
 Utility function for sending a float message to the object.
 
void eventProcessInt (const char *id, int v)
 Utility function for sending an int message to the object.
 
void eventProcessString (const char *id, const QString &str)
 Utility function for sending string message to the object.
 
void eventProcessString (const char *id, const char *str)
 Utility function for sending string message to the object.
 
void eventProcessVector2 (const char *id, Nimble::Vector2)
 Utility function for sending a Nimble::Vector2f message to the object.
 
void eventProcessVector3 (const char *id, Nimble::Vector3)
 Utility function for sending a Vector3 message to the object.
 
void eventProcessVector4 (const char *id, Nimble::Vector4)
 Utility function for sending a Vector4 message to the object.
 
virtual bool handleShorthand (const Valuable::StyleValue &value, Radiant::ArrayMap< Valuable::Attribute *, Valuable::StyleValue > &expanded)
 If attribute supports shorthand properties, this should be used to parse those. More...
 
Nodehost () const
 The host object of the value object (is any). More...
 
virtual bool isChanged () const
 
virtual bool isValueDefinedOnLayer (Layer layer) const
 Check if the given layer defines a value. More...
 
bool layerForSerialization (SerializationOptions flags, Layer &layer) const
 
const QByteArray & name () const
 Returns the name of the object.
 
const Attributeoperator= (const Attribute &)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
AttributeownerShorthand () const
 
QByteArray path () const
 Returns the path (separated by '/'s) from the root.
 
void removeHost ()
 Sets the host pointer to zero and removes this object from the host. More...
 
bool removeListener (Node *listener, int role=ALL_ROLES)
 Removes a listener from the listener list. More...
 
bool removeListener (long id)
 Removes a listener from the listener list. More...
 
void removeListeners (int role=ALL_ROLES)
 Removes listeners from the listener list.
 
virtual bool set (float v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (int v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const QString &v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector2f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector3f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector4f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const StyleValue &value, Layer layer=USER)
 Sets the value of the object.
 
void setName (const QByteArray &s)
 Sets the name of the object.
 
void setOwnerShorthand (Attribute *owner)
 
virtual QByteArray type () const
 Get the type id of the attribute. More...
 
- Public Member Functions inherited from Valuable::Serializable
virtual bool deserializeXML (const DOMElement &element)
 Deserializes (reads) this object from an XML element. More...
 
bool isSerializable () const
 
void setSerializable (bool v)
 

Static Public Member Functions

static bool copyValues (const Node &from, Node &to)
 Copies attribute values from one node to another. More...
 
static void disableQueue ()
 Disables all AFTER_UPDATE event processing, no new events will be accepted and the current queue will be cleared. More...
 
static Uuid generateId ()
 Generates a unique identifier. More...
 
static void invokeAfterUpdate (ListenerFuncVoid function)
 Queue function to be called in the main thread after the next update() More...
 
static int processQueue ()
 Triggers any pending AFTER_UPDATE-events. More...
 
static void reEnableQueue ()
 Enables queue after calling disableQueue. More...
 
static void setFatalOnEventMismatch (bool haltApplication)
 Controls what to do when an event mismatch is detected The default behavior is to output a warning to the terminal (haltApplication = false). More...
 

Protected Member Functions

virtual void attributeAdded (Attribute *attribute)
 This is called when new attribute is added to Node. More...
 
virtual void attributeRemoved (Attribute *attribute)
 This is called when attribute is removed from Node. More...
 
Nodesender ()
 Get the sender of the event, only valid in DIRECT events. More...
 
void setBeingDestroyed ()
 Sets 'isBeginDestroyed' flag to true and removes all event listeners to this object. More...
 
- Protected Member Functions inherited from Valuable::Attribute
virtual void emitDelete ()
 Invokes the change valueDeleted function of all listeners.
 

Friends

class Attribute
 

Detailed Description

Base class for objects that include member variables with automatic IO.

This base class has a list of Valuable::Attribute child objects (aka member variables) that are named with unique string.

Deleting the child objects is the responsibility of the inherited classes, Node simply maintains a list of children.

Examples:
BookExample.cpp.

Member Enumeration Documentation

enum Valuable::Node::ListenerType

Types of event listeners.

Enumerator
DIRECT 

Listener will activate immediately when an event is sent.

Listener is executed in the thread the event is sent.

AFTER_UPDATE 

Listener activation is delayed to happen after update.

Listener is executed in the main thread.

AFTER_UPDATE_ONCE 

Listener activation is delayed to happen after update.

Duplicate events are merged, so the listener activates only once even if multiple events were sent. Listener is executed in the main thread.

Constructor & Destructor Documentation

Valuable::Node::Node ( Node host,
const QByteArray &  name = "",
bool  transit = false 
)

Constructs a new Node and adds it under the given host.

Parameters
hostHost of this node. Parent in node-hierarchy
nameName of this object.
transitShould the object changes be transmitted.
Valuable::Node::Node ( Node &&  node)

Moves a node, including all its attributes, events etc.

Parameters
nodenode to move

Member Function Documentation

bool Valuable::Node::addAttribute ( Attribute *const  attribute)

Adds a new Attribute to the list of attribute objects.

Copies the name of the attribute from the given object. After successful adding of attribute to node, the node handle memory management of attribute.

Parameters
attributeAttribute to be added
Returns
True if attribute was successfully added, false otherwise
template<typename Widget >
bool Valuable::Node::addAttribute ( const QByteArray &  name,
const Radiant::IntrusivePtr< Widget > &  attribute 
)
inline

Adds a new Attribute to the list of attribute objects.

Copies the name of the attribute from the given object. After successful adding of attribute to node, the node handle memory management of attribute.

Parameters
attributeAttribute to be added
Returns
True if attribute was successfully added, false otherwise
long Valuable::Node::addListener ( const QByteArray &  attribute,
v8::Persistent< v8::Function >  func,
int  role = Attribute::CHANGE_ROLE 
)

Add a JavaScript attribute listener to attribute belonging this Node.

Parameters
attributeAttribute name
funcJavaScript function to call whenever attribute is changed/deleted
rolewhen should the listener function be called
Returns
listener id that can be used to remove the listener with Attribute::removeListener
virtual Attribute* Valuable::Node::attribute ( const QByteArray &  name) const
virtual

Gets an Attribute with the given name.

Parameters
nameAttribute name to search for
Returns
Null if no object can be found

Reimplemented from Valuable::Attribute.

template<typename T >
AttributeT<T>* Valuable::Node::attribute ( const QByteArray &  name) const
inlinevirtual

Gets an Attribute with the given name.

Parameters
nameAttribute name to search for
Returns
Null if no object can be found

Reimplemented from Valuable::Attribute.

virtual void Valuable::Node::attributeAdded ( Attribute attribute)
protectedvirtual

This is called when new attribute is added to Node.

Parameters
attributeadded attribute
virtual void Valuable::Node::attributeRemoved ( Attribute attribute)
protectedvirtual

This is called when attribute is removed from Node.

Parameters
attributeremoved attribute
const container& Valuable::Node::attributes ( ) const
inline
Returns
attribute container
void Valuable::Node::clearValues ( Layer  layer)

Clears all Attribute values of the given layer.

Parameters
layerlayer to clear
static bool Valuable::Node::copyValues ( const Node from,
Node to 
)
static

Copies attribute values from one node to another.

Parameters
fromsource node
totarget node
Returns
true if copying was successful
static void Valuable::Node::disableQueue ( )
static

Disables all AFTER_UPDATE event processing, no new events will be accepted and the current queue will be cleared.

void Valuable::Node::eventAddDeprecated ( const QByteArray &  deprecatedId,
const QByteArray &  newId 
)

Register a deprecated event that is automatically converted to new event id and a warning is issued when it is used.

Parameters
deprecatedIddeprecated event id
newIdreplacing event id
template<typename Widget >
long Valuable::Node::eventAddListener ( const QByteArray &  eventId,
const QByteArray &  messageId,
Radiant::IntrusivePtr< Widget > &  listener,
ListenerType  listenerType = DIRECT,
const Radiant::BinaryData defaultData = 0 
)
inline

Add an event listener to this object.

This function is part of the event passing framework. After calling this, listener will get the messages with id messageId whenever this object has events with eventId. This function can fail if the Node is being destroyed while calling this function.

Parameters
eventIdthe event id to match when in the eventSend. Corresponds to the first parameter in eventSend
messageIdthe event id to use when delivering the event to listener. This is the first parameter in eventProcess
listenerthe listening widget. Receives events and handles them in eventProcess -function
listenerTypedefines when to send events to listener
defaultDatathe default binary data to be used when delivering the message, used only if eventSend doesn't include BinaryData
Returns
event id or -1 on failure
See Also
eventRemoveListener
Examples:
PostProcessingExample.cpp, and VirtualInputExample.cpp.
long Valuable::Node::eventAddListener ( const QByteArray &  eventId,
const QByteArray &  messageId,
Valuable::Node listener,
ListenerType  listenerType = DIRECT,
const Radiant::BinaryData defaultData = 0 
)

Add an event listener to this object.

This function is part of the event passing framework. After calling this, listener will get the messages with id messageId whenever this object has events with eventId. This function can fail if the Node is being destroyed while calling this function.

Parameters
eventIdthe event id to match when in the eventSend. Corresponds to the first parameter in eventSend
messageIdthe event id to use when delivering the event to listener. This is the first parameter in eventProcess
listenerthe listening object. Receives events and handles them in eventProcess -function
listenerTypedefines when to send events to listener
defaultDatathe default binary data to be used when delivering the message, used only if eventSend doesn't include BinaryData
Returns
event id or -1 on failure
See Also
eventRemoveListener
long Valuable::Node::eventAddListener ( const QByteArray &  eventId,
ListenerFuncVoid  func,
ListenerType  listenerType = DIRECT 
)

Add an event listener to this object.

This function is part of the event passing framework. After calling this, func will be called whenever this object has events with eventId. This function can fail if the Node is being destroyed while calling this function.

Parameters
eventIdthe event id to match when in the eventSend. Corresponds to the first parameter in eventSend
functhe listener callback
listenerTypedefines when to call the callback
Returns
event id or -1 on failure
See Also
eventRemoveListener
long Valuable::Node::eventAddListenerBd ( const QByteArray &  eventId,
ListenerFuncBd  func,
ListenerType  listenerType = DIRECT 
)

Add an event listener to this object.

This function is part of the event passing framework. After calling this, func will be called whenever this object has events with eventId. This function can fail if the Node is being destroyed while calling this function.

Parameters
eventIdthe event id to match when in the eventSend. Corresponds to the first parameter in eventSend
functhe listener callback that will get event BinaryData as a parameter
listenerTypedefines when to call the callback
Returns
event id or -1 on failure
See Also
eventRemoveListener
template<typename Widget >
int Valuable::Node::eventRemoveListener ( Radiant::IntrusivePtr< Widget > &  listener)
inline

Removes all events from this object to given listener.

Parameters
listenerevent listener
Returns
number of events removed
template<typename Widget >
int Valuable::Node::eventRemoveListener ( const QByteArray &  eventId = QByteArray(),
const QByteArray &  messageId = QByteArray(),
Radiant::IntrusivePtr< Widget > &  listener = Radiant::IntrusivePtr<Widget>() 
)
inline

Removes events from this object that match the parameters.

Parameters
eventIdevent id or null QByteArray to match all event ids
messageIdmessage id or null QByteArray to match all message ids
listenerevent listener or nullptr to match all listeners
Returns
number of events removed
int Valuable::Node::eventRemoveListener ( const QByteArray &  eventId = QByteArray(),
const QByteArray &  messageId = QByteArray(),
Valuable::Node listener = 0 
)

Removes event listeners from this object.

// Remove all event links between two widgets:
myWidget1->eventRemoveListener(myWidget2);
// Remove selected event links between two widgets:
myWidget1->eventRemoveListener("interaction-begin", myWidget3);
myWidget1->eventRemoveListener(QByteArray(), "clear", myWidget4);
// Remove all selected events to any other widgets
myWidget1->eventRemoveListener("single-tap");
Parameters
eventIdThe name of the originating event that should be cleared. If this parameter is null (QByteArray()), then all originating events are matched.
messageIdThe name of of the destination event that should be cleared. If this parameter is null (QByteArray()), then all destination events are matched.
listenerThe target object for which the events should be cleared. If this parameter is null, then all objects are matched.
Returns
number of event listener links removed
int Valuable::Node::eventRemoveListener ( Valuable::Node listener)
inline

Removes all events from this object to given listener.

Parameters
listenerevent listener
Returns
number of events removed
bool Valuable::Node::eventRemoveListener ( long  listenerId)

Removes event listener with given id.

Returns
true if listener was found and removed
template<typename P1 >
void Valuable::Node::eventSend ( const QByteArray &  eventId,
const P1 &  p1 
)
inline

Sends an event to all listeners on this eventId.

Builds Radiant::BinaryData automatically based on the function parameters

Parameters
eventIdevent id
p1event parameter
template<typename P1 , typename P2 >
void Valuable::Node::eventSend ( const QByteArray &  eventId,
const P1 &  p1,
const P2 &  p2 
)
inline

Sends an event to all listeners on this eventId.

Builds Radiant::BinaryData automatically based on the function parameters

Parameters
eventIdevent id
p1,p2event parameters
template<typename P1 , typename P2 , typename P3 >
void Valuable::Node::eventSend ( const QByteArray &  eventId,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inline

Sends an event to all listeners on this eventId.

Builds Radiant::BinaryData automatically based on the function parameters

Parameters
eventIdevent id
p1,p2,p3event parameters
template<typename P1 , typename P2 , typename P3 , typename P4 >
void Valuable::Node::eventSend ( const QByteArray &  eventId,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inline

Sends an event to all listeners on this eventId.

Builds Radiant::BinaryData automatically based on the function parameters

Parameters
eventIdevent id
p1,p2,p3,p4event parameters
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void Valuable::Node::eventSend ( const QByteArray &  eventId,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
)
inline

Sends an event to all listeners on this eventId.

Builds Radiant::BinaryData automatically based on the function parameters

Parameters
eventIdevent id
p1,p2,p3,p4,p5event parameters
static Uuid Valuable::Node::generateId ( )
static

Generates a unique identifier.

Returns
New unique id
static void Valuable::Node::invokeAfterUpdate ( ListenerFuncVoid  function)
static

Queue function to be called in the main thread after the next update()

Parameters
functionfunction to be called
bool Valuable::Node::isBeingDestroyed ( ) const
inline

Returns true if we are about to delete this object.

This flag needs to be set manually using setBeginDestroyed, not all classes inheriting from this might set it. If Node is being destroyed, it won't receive any events. You also can't set any new event listeners to it.

Node& Valuable::Node::operator= ( Node &&  node)

Moves a node, replacing this.

Parameters
nodenode to move
Returns
reference to this
static int Valuable::Node::processQueue ( )
static

Triggers any pending AFTER_UPDATE-events.

This is called automatically from MultiWidgets::Application every frame. If you don't have running application instance, or if you want to block main thread for a longer period of time, this should be called periodically manually to make sure all events are dispatched.

Returns
number of processes items
virtual bool Valuable::Node::readElement ( const ArchiveElement element)
virtual

Handles a serialization element that lacks automatic handlers.

Parameters
elementThe element to be deserialized
Returns
true on success

Reimplemented in Luminous::MultiHead::Area.

static void Valuable::Node::reEnableQueue ( )
static

Enables queue after calling disableQueue.

Does nothing if the queue is already enabled.

Node* Valuable::Node::sender ( )
inlineprotected

Get the sender of the event, only valid in DIRECT events.

Returns
the sender of the event, can be read in eventProcess()
virtual void Valuable::Node::setAsDefaults ( )
virtual

Sets the current USER attribute value as the default value and clears the USER value.

Reimplemented from Valuable::Attribute.

void Valuable::Node::setBeingDestroyed ( )
protected

Sets 'isBeginDestroyed' flag to true and removes all event listeners to this object.

This is set at least in Widget::preDestroy and Operator::~Operator.

static void Valuable::Node::setFatalOnEventMismatch ( bool  haltApplication)
static

Controls what to do when an event mismatch is detected The default behavior is to output a warning to the terminal (haltApplication = false).

The application can also be stopped by calling Radiant::fatal (haltApplication = true).

void Node::setId ( Uuid  newId)

Sets the unique id.

Setter for attribute id.

Parameters
newIdnew attribute value
template<class T >
bool Valuable::Node::setValue ( const QByteArray &  name,
const T &  v 
)
inline

Uses a query string to find a Attribute, and sets a new value to that if found.

Parameters
nameThe path to the Attribute. This is a '/'-separated list of Attribute names, forming a path inside a Attribute tree. ".." can be used to refer to host element. For example setValue("../foo/bar", 4.0f) sets 4.0f to Attribute named "bar" under Attribute "foo" that is sibling of this object.
vThe new value
Returns
True if object was found and the value was set successfully.
bool Valuable::Node::setValue ( const QByteArray &  name,
v8::Handle< v8::Value >  v 
)

Set attribute value from JavaScript.

Parameters
nameattribute name
vattribute value. Supported types: boolean, number, string, list of two, three or four numbers
Returns
true if conversion from JavaScript was successful, and attribute value was set