ufobject.h File Reference

#include <string>
#include <list>
#include <stdexcept>
Include dependency graph for ufobject.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UFObject
 UFObjects are smart data containers, which are suppose to know everything that is needed to handle and manipulated their content. More...
class  UFNumber
 UFNumber is a UFObject that holds a number which has an allowed range of values, a specified accuracy and default value. More...
class  UFNumberArray
 UFNumberArray is a UFObject that holds an fixed sized array of numbers. More...
class  UFString
 UFString is a UFObject that holds a character string. More...
class  UFGroup
 UFGroup is a UFObject that contain a group of UFObject elements. More...
class  UFArray
 UFArray is a UFObject that contain an indexed group of UFObject elements. More...
class  UFException
 This is the common exception thrown by the UFObject implementation. More...

Defines

#define UF_FALSE   (0)
#define UF_TRUE   (!UF_FALSE)

Typedefs

typedef const char * UFName
 Type definition for the name of a UFObject.
typedef struct UFObject UFObject
 UFObject is base class for both the C and C++ interfaces.
typedef void( UFEventHandle )(UFObject *, UFEventType)
 Function prototype for handling events.
typedef int UFBoolean

Enumerations

enum  UFEventType {
  uf_value_changed, uf_default_changed, uf_element_added, uf_user_data_set,
  uf_destroyed
}
 

Events that can be triggered and should be handled by the event handler.

More...

Functions

UFObjectufobject_delete (UFObject *object)
 Delete a UFObject and free its resources. Never use free() on UFObject s.
UFName ufobject_name (UFObject *object)
 Retrieve the name of the UFObject.
UFObjectufobject_parent (UFObject *object)
const char * ufobject_string_value (UFObject *object)
 Translate object to a string. See UFObject::StringValue() for details.
UFBoolean ufobject_set_string (UFObject *object, const char *string)
 Set the value of the object from the string value.
UFBoolean ufobject_copy (UFObject *destination, UFObject *source)
 Copy the value of the source object to the destination object.
char * ufobject_xml (UFObject *object, const char *indent)
 Create an XML block for the object.
void * ufobject_user_data (UFObject *object)
void ufobject_set_user_data (UFObject *object, void *user_data)
void ufobject_set_changed_event_handle (UFObject *object, UFEventHandle *handle)
void ufobject_set_default (UFObject *object)
 Set the current object value to its default value.
double ufnumber_value (UFObject *object)
 Return the numerical value of the object.
UFBoolean ufnumber_set (UFObject *object, double number)
 Set the value of the object to the given number.
double ufnumber_array_value (UFObject *object, int index)
 Return the numerical value of the index element of the object.
UFBoolean ufnumber_array_set (UFObject *object, const double array[])
 Set the value of all the array elements at once.
UFBoolean ufstring_is_equal (UFObject *object, const char *string)
 Return true if string value is equal to string.
UFBoolean ufgroup_has (UFObject *object, UFName name)
 Return true if the UFGroup object contains an object called name.
UFObjectufgroup_element (UFObject *object, UFName name)
 Return a UFObject element in a UFGroup.
UFBoolean ufgroup_add (UFObject *group, UFObject *object)
 Add a UFObject to a UFGroup.
UFObjectufgroup_drop (UFObject *group, UFName name)
 Drop an object from the group.
UFBoolean ufarray_set_index (UFObject *object, int index)
 Set the current index position in the array.
int ufarray_index (UFObject *object)
 Retriew the current index location in the array.
UFBoolean ufarray_is_equal (UFObject *object, const char *string)
 Return true if array's string value is equal to string.

Define Documentation

#define UF_FALSE   (0)
#define UF_TRUE   (!UF_FALSE)

Typedef Documentation

typedef const char* UFName

Type definition for the name of a UFObject.

typedef struct UFObject UFObject

UFObject is base class for both the C and C++ interfaces.

typedef void( UFEventHandle)(UFObject *, UFEventType)

Function prototype for handling events.

typedef int UFBoolean

Enumeration Type Documentation

Events that can be triggered and should be handled by the event handler.

Enumerator:
uf_value_changed 

Value changed.

uf_default_changed 

Default value changed.

uf_element_added 

An UFObject was added to a UFGroup or a UFArray.

uf_user_data_set 

User data was set.

uf_destroyed 

UFObject is being destroyed.


Function Documentation

UFObject* ufobject_delete ( UFObject object  ) 

Delete a UFObject and free its resources. Never use free() on UFObject s.

UFName ufobject_name ( UFObject object  ) 

Retrieve the name of the UFObject.

UFObject* ufobject_parent ( UFObject object  ) 
const char* ufobject_string_value ( UFObject object  ) 

Translate object to a string. See UFObject::StringValue() for details.

UFBoolean ufobject_set_string ( UFObject object,
const char *  string 
)

Set the value of the object from the string value.

Returns false on failure. See C-interface and UFObject::Set(const char *string) for details.

UFBoolean ufobject_copy ( UFObject destination,
UFObject source 
)

Copy the value of the source object to the destination object.

Returns false on failure. See C-interface and UFObject::Set(const UFObject &object) for details.

char* ufobject_xml ( UFObject object,
const char *  indent 
)

Create an XML block for the object.

The returned buffer should be free()'d by the caller. See UFObject::XML() for details.

void* ufobject_user_data ( UFObject object  ) 
void ufobject_set_user_data ( UFObject object,
void *  user_data 
)
void ufobject_set_changed_event_handle ( UFObject object,
UFEventHandle handle 
)
void ufobject_set_default ( UFObject object  ) 

Set the current object value to its default value.

double ufnumber_value ( UFObject object  ) 

Return the numerical value of the object.

Returns NaN if object is not a UFNumber. See C-interface and UFNumber::DoubleValue() for more details.

UFBoolean ufnumber_set ( UFObject object,
double  number 
)

Set the value of the object to the given number.

Returns false if object is not a UFNumber. See C-interface and UFNumber::Set(double number) for more details.

double ufnumber_array_value ( UFObject object,
int  index 
)

Return the numerical value of the index element of the object.

Returns NaN if object is not a UFNumberArray or index is out of range. See C-interface and UFNumberArray::DoubleValue() for more details.

UFBoolean ufnumber_array_set ( UFObject object,
const double  array[] 
)

Set the value of all the array elements at once.

Returns false if object is not a UFNumberArray. See C-interface and UFNumberArray::Set(const double array[]) for more details.

UFBoolean ufstring_is_equal ( UFObject object,
const char *  string 
)

Return true if string value is equal to string.

Return false if it is not equal or if object is not a UFString. See C-interface for more details.

UFBoolean ufgroup_has ( UFObject object,
UFName  name 
)

Return true if the UFGroup object contains an object called name.

Return false if it does not, or if object is not a UFGroup. See C-interface for more details.

UFObject* ufgroup_element ( UFObject object,
UFName  name 
)

Return a UFObject element in a UFGroup.

Return NULL if element is not found or if object is not a UFGroup. See C-interface for more details.

UFBoolean ufgroup_add ( UFObject group,
UFObject object 
)

Add a UFObject to a UFGroup.

Return false if UFGroup already contains an object with the same name. See C-interface for more details.

UFObject* ufgroup_drop ( UFObject group,
UFName  name 
)

Drop an object from the group.

The dropped object is returned. If it is not needed any more it should be deleted to free its memory.

UFBoolean ufarray_set_index ( UFObject object,
int  index 
)

Set the current index position in the array.

int ufarray_index ( UFObject object  ) 

Retriew the current index location in the array.

-1 is returned if the string index value corresponds to no element's label.

UFBoolean ufarray_is_equal ( UFObject object,
const char *  string 
)

Return true if array's string value is equal to string.

Return false if it is not equal or if object is not a UFArray. See C-interface for more details.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Wed Mar 17 21:05:31 2010 for UFRaw by  doxygen 1.6.1