AtxProperties.h File Reference

Header file for the ATX_Properties interface. More...

#include "AtxInterfaces.h"
#include "AtxTypes.h"
#include "AtxIterator.h"

Go to the source code of this file.

Data Structures

struct  ATX_PropertyRawData
union  ATX_PropertyValueData
 Union of the different possible data types for the 'data' field of an ATX_PropertyValue struct. More...
struct  ATX_PropertyValue
 Value of a property. More...
struct  ATX_Property
 A property that has a name and a value (the value can be of one of several types). More...

Defines

#define ATX_ERROR_NO_SUCH_PROPERTY   (ATX_ERROR_BASE_PROPERTIES - 0)
#define ATX_ERROR_NO_SUCH_LISTENER   (ATX_ERROR_BASE_PROPERTIES - 1)
#define ATX_ERROR_PROPERTY_TYPE_MISMATCH   (ATX_ERROR_BASE_PROPERTIES - 2)
#define ATX_Properties_GetProperty(object, name, value)
 Convenience macro used to call the GetProperty() method on objects that implement the ATX_Properties interface.
#define ATX_Properties_SetProperty(object, name, value)
 Convenience macro used to call the SetProperty() method on objects that implement the ATX_Properties interface.
#define ATX_Properties_Clear(object)   ATX_INTERFACE(object)->Clear(object)
 Convenience macro used to call the Clear() method on objects that implement the ATX_Properties interface.
#define ATX_Properties_GetIterator(object, iterator)   ATX_INTERFACE(object)->GetIterator(object, iterator)
 Convenience macro used to call the GetIterator() method on objects that implement the ATX_Properties interface.
#define ATX_Properties_AddListener(object, name, listener, handle)
 Convenience macro used to call the AddListener() method on objects that implement the ATX_Properties interface.
#define ATX_Properties_RemoveListener(object, handle)   ATX_INTERFACE(object)->RemoveListener(object, handle)
 Convenience macro used to call the RemoveListener() method on objects that implement the ATX_Properties interface.
#define ATX_PropertyListener_OnPropertyChanged(object, name, value)
 Convenience macro used to call the OnPropertyChanged() method on objects that implement the ATX_PropertyListener interface.
#define ATX_IMPLEMENT_STATIC_PROPERTIES_INTERFACE(_class)

Typedefs

typedef const void * ATX_PropertyListenerHandle

Enumerations

enum  ATX_PropertyValueType {
  ATX_PROPERTY_VALUE_TYPE_INTEGER,
  ATX_PROPERTY_VALUE_TYPE_FLOAT,
  ATX_PROPERTY_VALUE_TYPE_STRING,
  ATX_PROPERTY_VALUE_TYPE_BOOLEAN,
  ATX_PROPERTY_VALUE_TYPE_RAW_DATA
}
 Type of data represented by the 'value' field of an ATX_Property structure. More...

Functions

ATX_Result ATX_BaseProperties_SetProperty (ATX_Properties *self, ATX_CString name, const ATX_PropertyValue *value)
ATX_Result ATX_BaseProperties_Clear (ATX_Properties *self)
ATX_Result ATX_BaseProperties_GetIterator (ATX_Properties *self, ATX_Iterator **iterator)
ATX_Result ATX_BaseProperties_AddListener (ATX_Properties *self, ATX_CString name, ATX_PropertyListener *listener, ATX_PropertyListenerHandle *handle)
ATX_Result ATX_BaseProperties_RemoveListener (ATX_Properties *self, ATX_PropertyListenerHandle handle)
ATX_Result ATX_Properties_Create (ATX_Properties **properties)

Variables

void(* OnPropertyChanged )(ATX_PropertyListener *self, ATX_CString name, const ATX_PropertyValue *value)
 Notify that a property has changed or deleted.
ATX_END_INTERFACE_DEFINITION
ATX_Result(* 
GetProperty )(ATX_Properties *self, ATX_CString name, ATX_PropertyValue *value)
 Interface implemented by objects that want to expose a list of properties to their clients.
ATX_Result(* SetProperty )(ATX_Properties *self, ATX_CString name, const ATX_PropertyValue *value)
 Set the value of a property in a property list.
ATX_Result(* Clear )(ATX_Properties *self)
 Delete all properties.
ATX_Result(* GetIterator )(ATX_Properties *self, ATX_Iterator **iterator)
 Get an iterator for the properties in the list.
ATX_Result(* AddListener )(ATX_Properties *self, ATX_CString name, ATX_PropertyListener *listener, ATX_PropertyListenerHandle *handle)
 Add a listener.
ATX_Result(* RemoveListener )(ATX_Properties *self, ATX_PropertyListenerHandle handle)


Detailed Description

Header file for the ATX_Properties interface.


Define Documentation

#define ATX_IMPLEMENT_STATIC_PROPERTIES_INTERFACE ( _class   ) 

Value:

ATX_BEGIN_INTERFACE_MAP(_class, ATX_Properties)           \
    _class##_GetProperty,                                 \
    ATX_BaseProperties_SetProperty,                       \
    ATX_BaseProperties_Clear,                             \
    ATX_BaseProperties_GetIterator,                       \
    ATX_BaseProperties_AddListener,                       \
    ATX_BaseProperties_RemoveListener                     \
ATX_END_INTERFACE_MAP

#define ATX_Properties_AddListener ( object,
name,
listener,
handle   ) 

Value:

ATX_INTERFACE(object)->AddListener(object,                         \
                                   name,                           \
                                   listener,                       \
                                   handle)
Convenience macro used to call the AddListener() method on objects that implement the ATX_Properties interface.

#define ATX_Properties_GetProperty ( object,
name,
value   ) 

Value:

ATX_INTERFACE(object)->GetProperty(object,               \
                                   name,                 \
                                   value)
Convenience macro used to call the GetProperty() method on objects that implement the ATX_Properties interface.

#define ATX_Properties_SetProperty ( object,
name,
value   ) 

Value:

ATX_INTERFACE(object)->SetProperty(object,                 \
                                   name,                   \
                                   value)
Convenience macro used to call the SetProperty() method on objects that implement the ATX_Properties interface.

#define ATX_PropertyListener_OnPropertyChanged ( object,
name,
value   ) 

Value:

ATX_INTERFACE(object)->OnPropertyChanged(object,                    \
                                         name,                      \
                                         value)
Convenience macro used to call the OnPropertyChanged() method on objects that implement the ATX_PropertyListener interface.


Enumeration Type Documentation

enum ATX_PropertyValueType

Type of data represented by the 'value' field of an ATX_Property structure.

Enumerator:
ATX_PROPERTY_VALUE_TYPE_INTEGER  The value is an integer.
ATX_PROPERTY_VALUE_TYPE_FLOAT  The value is a floating point number.
ATX_PROPERTY_VALUE_TYPE_STRING  The value is a string.
ATX_PROPERTY_VALUE_TYPE_BOOLEAN  The value is a boolean.
ATX_PROPERTY_VALUE_TYPE_RAW_DATA  The value is a raw data block.


Variable Documentation

ATX_Result(* AddListener)(ATX_Properties *self, ATX_CString name, ATX_PropertyListener *listener, ATX_PropertyListenerHandle *handle)

Add a listener.

The listener will notified of changes to one or all properties.

Parameters:
name Name of the property of whose changes the listener wants to be notified. If this parameter is NULL, the listener will be notified of changes to any of the properties in the list.
listener Pointer to a listener object that will receive notifications.
handle Pointer to a handle where the listener handle will be returned.

ATX_Result(* Clear)(ATX_Properties *self)

Delete all properties.

Parameters:
self Pointer to the object on which this method is called

ATX_Result(* GetIterator)(ATX_Properties *self, ATX_Iterator **iterator)

Get an iterator for the properties in the list.

If this list cannot be iterated, this method returns ATX_ERROR_NOT_SUPPORTED.

ATX_END_INTERFACE_DEFINITION ATX_Result(* GetProperty)(ATX_Properties *self, ATX_CString name, ATX_PropertyValue *value)

Interface implemented by objects that want to expose a list of properties to their clients.

Properties are name/value pairs (ATX_Property type), where the name is a string, and the value can be of one of several possible types (string, integer, etc...) Get the value of a property by name.

Parameters:
self Pointer to the object on which this method is called
name Name of the property of which the value is requested.
value Pointer to where the value of the property should be written.
Returns:
ATX_SUCCESS if the property with the specified name is found and its value returned, ATX_ERROR_NO_SUCH_PROPERY if there is no property with that name in the list, or a negative ATX_Result error code if the call fails for another reason.

void(* OnPropertyChanged)(ATX_PropertyListener *self, ATX_CString name, const ATX_PropertyValue *value)

Notify that a property has changed or deleted.

Parameters:
name Name of the property that has changed. This parameter may be NULL or an empty string when the notification is for the deletion of all the properties in a list and that the listener is listening for changes to all the properties (this way the listener is not called once for each property deletion).
value Pointer to the value of the property. If the notification is for the deletion of a property, this parameter is NULL. If the notification is for the change of a property's value, this parameter points to the new value of the property.

ATX_Result(* SetProperty)(ATX_Properties *self, ATX_CString name, const ATX_PropertyValue *value)

Set the value of a property in a property list.

Parameters:
self Pointer to the object on which this method is called.
name Name of the property to set.
value Pointer to the value of the property to set, or NULL to delete the property (remove the property from the list).