Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Abstract class providing queryValue
, changeValue
, conversion, and introspection methods.
More...
#include <ilviews/protos/value.h>
Public Member Functions | |
virtual IlBoolean | changeValue (const IlvValue &v) |
Changes the object's value. Both the name and the new value are contained in val. | |
virtual IlBoolean | changeValues (const IlvValue *v, IlUShort c) |
Changes several values of an object in a single call. The default implementation calls changeValue for all values. | |
virtual IlUInt | compareAllValues (const IlvAccessible *ref, IlvValueArray &diffs, IlBoolean any=IlFalse) const |
Compares two objects and returns the differing attributes. | |
virtual IlUInt | compareValues (const IlvAccessible *ref, IlvValue *values, IlUShort count, IlvValueArray &diffs) const |
Compares two objects and returns the differing attributes. | |
virtual IlBoolean | convertValues (IlvValue *v, IlUShort c, IlvDisplay *d) const |
Convert values to match the types defined by the object accessors. | |
virtual void | getAccessors (const IlSymbol *const **a, const IlvValueTypeClass *const **t, IlUInt &c) const =0 |
Returns the names of all the accessors known by this object. | |
virtual const char * | getName () const =0 |
Returns the object name. | |
IlUInt | getSubscriptions (IlvAccessible *subscriber, IlSymbol **&sourceValue, IlSymbol **&subscriberValue, IlvValueTypeClass **&type, IlvValueSubscriptionMode *&mode, IlvAccessible ***subscribers=0) const |
Returns alls subscriptions made by subscriber. | |
virtual const IlvValueTypeClass * | getValueType (const IlSymbol *s) const |
Returns the type of a given attribute. | |
virtual IlBoolean | isOutputValue (const IlSymbol *value) const |
Indicates whether value designates an accessor that can generate notifying values. | |
virtual IlvValue & | pullValue (IlvValue &v) const |
See below. | |
virtual void | pullValues (IlvValue *vals, IlUShort c) const |
Propagates value queries to the subscribers to this object. | |
virtual IlBoolean | pushValue (const IlvValue &v) const |
See below. | |
virtual IlBoolean | pushValues (const IlvValue *vals, IlUShort c) const |
Propagates value changes to the subscribers to this object. | |
virtual IlvValue & | queryValue (IlvValue &value) const |
Queries the value designated by value from the object. Both the value and the value type are stored in value. | |
virtual void | queryValues (IlvValue *v, IlUShort c) const |
Queries several values in a single call. The default implementation calls queryValue for each value. | |
virtual void | subscribe (IlvAccessible *subscriber, IlSymbol *sourceValue, IlSymbol *subscriberValue, IlvValueTypeClass *type, IlvValueSubscriptionMode mode=IlvValueSubscriptionChange) |
Subscribes the subscriber object to the value sourceValue of this object. | |
virtual void | unSubscribe (IlvAccessible *subscriber, IlSymbol *sourceValue=0, IlSymbol *subscriberValue=0) |
Cancels subscriptions previously made. | |
Static Public Member Functions | |
static void | DeclareAccessor (const IlSymbol *attr, IlvValueTypeClass *type, const IlSymbol *const **accessors, const IlvValueTypeClass *const **types, IlUInt &count, IlBoolean checkDuplicates=IlFalse, IlAny accessorList=0) |
static const IlvValueTypeClass * | GetType (IlSymbol *name) |
Returns the type instance from a name. | |
static IlBoolean | StringToValue (const char *s, const IlvValueTypeClass *typeClass, IlvValue &v, IlvDisplay *d) |
Converts the character string s to an IlvValue with the type type. | |
static IlBoolean | StringToValue (const char *s, IlSymbol *type, IlvValue &v, IlvDisplay *display) |
Converts the character string s to an IlvValue with the type type. | |
static IlBoolean | ValuesAreEqual (IlvValue &v1, IlvValue &v2, IlBoolean compareNames=IlTrue) |
Compares two values. |
Abstract class providing queryValue
, changeValue
, conversion, and introspection methods.
Library: ilvproto
IlvAccessible
is an abstract base class used as a superclass for all objects in the prototype library that provide an interface based on the queryValue
/changeValue
methods. IlvAccessible
also provides methods for converting and comparing values, and implements the value subscription interface.
Changes the object's value. Both the name and the new value are contained in val.
v | The value to be set (both name and value). |
Reimplemented in IlvAccessorHolder, IlvGroup, IlvSubGroupNode, IlvGroupMediator, and IlvGraphicNode.
Changes several values of an object in a single call. The default implementation calls changeValue
for all values.
v | The changed values (both name and values). | |
c | The number of values. |
Reimplemented in IlvAccessorHolder, IlvGroup, IlvSubGroupNode, IlvGroupMediator, and IlvGraphicNode.
virtual IlUInt IlvAccessible::compareAllValues | ( | const IlvAccessible * | ref, | |
IlvValueArray & | diffs, | |||
IlBoolean | any = IlFalse | |||
) | const [virtual] |
Compares two objects and returns the differing attributes.
See below.
virtual IlUInt IlvAccessible::compareValues | ( | const IlvAccessible * | ref, | |
IlvValue * | values, | |||
IlUShort | count, | |||
IlvValueArray & | diffs | |||
) | const [virtual] |
Compares two objects and returns the differing attributes.
Compares the values of accessors known by this object with the corresponding values in the object ref. The values that differ are stored in diffs. The values stored are taken from the calling object (this), not from ref. The first method calls the getAccessors
method to get the list of all known accessors, while the second only compares the provided values. Then, both methods call compareValues
to actually compare the values.
ref | The object to compare to. | |
any | Specifies whether to compare values of unknown types and pointer types. | |
diffs | The differing attributes. | |
values | The attributes to compare in both objects. | |
count | The number of attributes to compare. |
Reimplemented in IlvAccessorHolder, and IlvSubGroupNode.
virtual IlBoolean IlvAccessible::convertValues | ( | IlvValue * | v, | |
IlUShort | c, | |||
IlvDisplay * | d | |||
) | const [virtual] |
Convert values to match the types defined by the object accessors.
Converts a set of values so their type match the type of accessors corresponding to the object. The values are normally stored in values as strings. They will be converted to the appropriate types. The result is returned in values.
v | The values to convert. | |
c | The number of values to convert. | |
d | A display, needed to allow font, color, and other resource conversions. |
static void IlvAccessible::DeclareAccessor | ( | const IlSymbol * | attr, | |
IlvValueTypeClass * | type, | |||
const IlSymbol *const ** | accessors, | |||
const IlvValueTypeClass *const ** | types, | |||
IlUInt & | count, | |||
IlBoolean | checkDuplicates = IlFalse , |
|||
IlAny | accessorList = 0 | |||
) | [static] |
Adds the accessor name attr and its type type to the accessors and types lists, and increments the count parameter. To add an accessor to the list, this method must be called from getAccessors
.
virtual void IlvAccessible::getAccessors | ( | const IlSymbol *const ** | a, | |
const IlvValueTypeClass *const ** | t, | |||
IlUInt & | c | |||
) | const [pure virtual] |
Returns the names of all the accessors known by this object.
Subclasses of IlvAccessible
must override this method by calling the static method DeclareAccessor
for each accessor handled by the subclass. The returned arrays are filled by the method and must not be freed.
a | Pointer to an array filled on return with the names of the accessors defined for the object. | |
t | Pointer to an array filled on return with the type of each accessor. | |
c | Number of accessors, set by the method. |
Implemented in IlvAccessorHolder, IlvGroup, IlvSubGroupNode, IlvGroupMediator, and IlvGraphicNode.
virtual const char* IlvAccessible::getName | ( | ) | const [pure virtual] |
Returns the object name.
Implemented in IlvGroup, IlvGroupNode, IlvSubGroupNode, IlvGroupMediator, and IlvGraphicNode.
IlUInt IlvAccessible::getSubscriptions | ( | IlvAccessible * | subscriber, | |
IlSymbol **& | sourceValue, | |||
IlSymbol **& | subscriberValue, | |||
IlvValueTypeClass **& | type, | |||
IlvValueSubscriptionMode *& | mode, | |||
IlvAccessible *** | subscribers = 0 | |||
) | const |
Returns alls subscriptions made by subscriber.
The sourceValue, subscriberValues, types, and modes arguments are modified to contain the parameters of all the subscriptions for the specified subscriber. These parameters must be released using the delete[]
operator when they are no longer needed. The method returns the number of elements returned in each array.
sourceValue | The names of the attributes observed by the subscription. | |
subscriberValue | The names of the attributes to be notified in the subscriber. | |
type | The types of the expected values pushed in subscriber. | |
mode | The modes of the subscriptions. | |
subscribers | The subscribers also observing the object. |
static const IlvValueTypeClass* IlvAccessible::GetType | ( | IlSymbol * | name | ) | [static] |
Returns the type instance from a name.
name | The name of the type that is requested. | |
return | A pointer to the type instance that corresponds to the name name. |
virtual const IlvValueTypeClass* IlvAccessible::getValueType | ( | const IlSymbol * | s | ) | const [virtual] |
Returns the type of a given attribute.
IlvValueNoType
if the accessor does not exist. The | name of the accessor. |
Reimplemented in IlvGroup.
Indicates whether value designates an accessor that can generate notifying values.
IlTrue
if value designates an accessor that can generate notifying values, that is, a value for which pushValue
calls may be issued. The default implementation returns IlFalse
. Subclasses such as IlvAccessorHolder
redefine this method. value | Name of the accessor. |
Reimplemented in IlvAccessorHolder, IlvGroup, and IlvSubGroupNode.
Propagates value queries to the subscribers to this object.
Must be called to propagate value queries to the subscribers to this object. When pullValue
or pullValues
is called, every IlvAccessible
object subscribed to the value identified by val with a mode of IlvValueSubscriptionQuery
is notified through a call to the subscriber queryValue
or queryValues
methods. The value name is equal to the subscriberValue passed to the subscribe method when the subscription was made. The first method returns the last value returned by the queryValue
methods of the subscribers. The second method returns whether the object considered the call successful.
vals | The pulled values. | |
c | The number of values. |
queryValue
methods of the subscribers. Propagates value changes to the subscribers to this object.
Must be called to propagate value changes to the subscribers to this object. When pushValue
or pushValues
is called, every IlvAccessible
object subscribed to the value identified by v with a mode of IlvValueSubscriptionChange
is notified through a call to the subscriber changeValue
or changeValues
methods. The value name is equal to the subscriberValue passed to the subscribe method when the subscription was made, with a data value equal to the data contained in val. The method returns IlTrue
if at least one of the changeValue
methods of the subscribers returns IlTrue
, and IlFalse
otherwise.
vals | The pushed values. | |
c | The number of values. |
Queries the value designated by value from the object. Both the value and the value type are stored in value.
value | The queried value name. |
Reimplemented in IlvAccessorHolder, IlvGroup, IlvSubGroupNode, IlvGroupMediator, and IlvGraphicNode.
Queries several values in a single call. The default implementation calls queryValue
for each value.
v | The array of value names to be queried | |
c | The number of values to be queried. |
Reimplemented in IlvAccessorHolder, IlvGroup, IlvSubGroupNode, and IlvGroupMediator.
static IlBoolean IlvAccessible::StringToValue | ( | const char * | s, | |
const IlvValueTypeClass * | typeClass, | |||
IlvValue & | v, | |||
IlvDisplay * | d | |||
) | [static] |
Converts the character string s to an IlvValue
with the type type.
IlTrue
if the conversion was successful, and IlFalse
otherwise. s | Input string. | |
type | Name of the IlvValueTypeClass to be used to do the conversion. | |
typeClass | Type of the value to convert the string into. | |
v | Resulting value. | |
d | Display used to convert resources such as colors, fonts, and so on. |
static IlBoolean IlvAccessible::StringToValue | ( | const char * | s, | |
IlSymbol * | type, | |||
IlvValue & | v, | |||
IlvDisplay * | display | |||
) | [static] |
Converts the character string s to an IlvValue
with the type type.
See below.
virtual void IlvAccessible::subscribe | ( | IlvAccessible * | subscriber, | |
IlSymbol * | sourceValue, | |||
IlSymbol * | subscriberValue, | |||
IlvValueTypeClass * | type, | |||
IlvValueSubscriptionMode | mode = IlvValueSubscriptionChange | |||
) | [virtual] |
Subscribes the subscriber object to the value sourceValue of this object.
After this subscription, every call to this object pushValue
method with a value name of sourceValue will cause the subscriber changeValue
method to be called with the value name subscriberValue, and with the value data passed to the initial pushValue
call of the value source. The type parameter specifies the type of the sourceValue and subscriberValue values. An IlvAccessible
object can subscribe several times to another IlvAccessible
object for different source values and/or subscriber values, but it may not subscribe several times to the same object and subscriber values. The mode argument specifies whether the subscriber wants to be notified of value changes (this is the default mode IlvValueSubscriptionChange
), or if it wants to be notified of value queries (mode IlvValueSubscriptionQuery
). In this last case, the source object notifies its subscribers of calls to pullValue
instead of pushValue
by calling queryValue
instead of changeValue
.
subscriber | The object to be notified of accesses to sourceValue. | |
sourceValue | The name of the attribute to be observed by the subscription. | |
subscriberValue | The name of the attribute to be notified in the subscriber. | |
type | The expected value type to be pushed to the subscriber. | |
mode | The type of access to sourceValue to be reported to subscriber. |
Reimplemented in IlvGroup, and IlvSubGroupNode.
virtual void IlvAccessible::unSubscribe | ( | IlvAccessible * | subscriber, | |
IlSymbol * | sourceValue = 0 , |
|||
IlSymbol * | subscriberValue = 0 | |||
) | [virtual] |
Cancels subscriptions previously made.
Cancels the subscription of the subscriber object to the specified sourceValue and subscriberValue. If sourceValue is 0
, the subscriptions of subscriber to all source values are cancelled. If subscriberValue is 0
, the subscriptions of subscriber for all subscriber values are removed. If both are 0
, all subscriptions of subscriber to this source object are cancelled.
subscriber | The object that is to be notified of accesses to sourceValue. | |
sourceValue | The name of the attribute to be observed by the subscription. | |
subscriberValue | The name of the attribute to be notified in the subscriber. |
Reimplemented in IlvGroup, and IlvSubGroupNode.
static IlBoolean IlvAccessible::ValuesAreEqual | ( | IlvValue & | v1, | |
IlvValue & | v2, | |||
IlBoolean | compareNames = IlTrue | |||
) | [static] |
Compares two values.
The actual comparison depends on the type of the values: scalar types are compared using their ==
operators, strings are compared using the strcmp
function, and resource values (such as IlvColors
) are compared using their pointers (that is, two distinct instances of IlvColor
representing the same RGB values will still be considered as different).
IlTrue
if the values are equal, and IlFalse
if they differ. v1 | First value. | |
v2 | Second value. | |
compareNames | Specifies whether names should also be identical. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.