Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
A GlishEvent object encapsulates a single Glish event: a name and an associated value, represented by a pointer to a Value object. Usually you do not need to create GlishEvent objects yourself, but only deal with those returned by Client's NextEvent member function.
GlishEvent objects have two fields that are directly accessible: name is a const char* pointer to the name of the event, and value is a (not const) Value* pointer to the event's associated value. It is preferred, though, to access these using the member functions const char* Name() and Value* Val() instead.
GlishEvent objects associate a set of flags with each event. At present, the only flag of interest to the class user is whether the event corresponds to a request (§ 7.4, page ). You can determine this by testing whether int IsRequest() const returns true or false.
GlishEvent objects are reference-counted, like Value and Client objects, so you should always use Unref() to dispose of one rather than delete. However, typically you should not need to Unref() GlishEvents because the Client class automatically Unref()s the events returned by NextEvent().
If you want to construct a GlishEvent object, you do so using one of:
GlishEvent( const char* name, const Value* value ) GlishEvent( const char* name, Value* value ) GlishEvent( char* name, Value* value )The GlishEvent object notes which form you use and, when the object is destructed, will delete the corresponding name pointer and/or Unref() the value pointer if and only if they were passed in non-const.