d_value.h File Reference


Defines

#define D_VALUE(v)   d_value_copy_oneshot(v)
#define D_STRING(s)   d_value_from_string_oneshot(s)
#define D_INT(i)   d_value_from_int_oneshot(i)
#define D_UINT(i)   d_value_from_uint_oneshot(i)
#define D_DOUBLE(i)   d_value_from_double_oneshot(i)
#define D_POINTER(i)   d_value_from_pointer_oneshot(i)
#define D_DATA(d, t)   d_value_from_data_oneshot(d, sizeof(t))
#define D_TOSTRING(v)   d_value_get_string(v)
#define D_TOINT(v)   d_value_get_int(v)
#define D_TOUINT(v)   d_value_get_uint(v)
#define D_TODOUBLE(v)   d_value_get_double(v)
#define D_TOPOINTER(v)   d_value_get_pointer(v)
#define D_TODATA(v)   d_value_get_data(v)

Typedefs

typedef d_value d_value

Enumerations

enum  d_value_type {
  D_VALUE_INVALID = 0, D_VALUE_STRING = 1, D_VALUE_DATA, D_VALUE_INT,
  D_VALUE_UINT, D_VALUE_DOUBLE, D_VALUE_POINTER, D_VALUE_FILE,
  D_VALUE_UNKOWN
}

Functions

d_valued_value_create ()
void d_value_free (d_value *value)
d_valued_value_copy (const d_value *value)
d_valued_value_copy_oneshot (const d_value *value)
int d_value_compare (const d_value *left, const d_value *right)
d_value_type d_value_get_type (const d_value *value)
unsigned int d_value_get_length (const d_value *value)
unsigned int d_value_get_id (const d_value *value)
d_valued_value_from_string (const char *s)
d_valued_value_from_string_oneshot (const char *s)
const char * d_value_get_string (const d_value *v)
d_valued_value_from_int (int i)
d_valued_value_from_int_oneshot (int i)
int d_value_get_int (const d_value *v)
d_valued_value_from_uint (unsigned int i)
d_valued_value_from_uint_oneshot (unsigned int i)
unsigned int d_value_get_uint (const d_value *v)
d_valued_value_from_double (double d)
d_valued_value_from_double_oneshot (double d)
double d_value_get_double (const d_value *v)
d_valued_value_from_pointer (void *p)
d_valued_value_from_pointer_oneshot (void *p)
void * d_value_get_pointer (const d_value *v)
d_valued_value_from_data (unsigned int length, const void *d)
d_valued_value_from_data_oneshot (unsigned int length, const void *d)
const void * d_value_get_data (const d_value *v)

Detailed Description


Define Documentation

#define D_VALUE (  )     d_value_copy_oneshot(v)

copy a oneshot copy of a d_value

#define D_STRING (  )     d_value_from_string_oneshot(s)

create a oneshot string d_value

#define D_INT (  )     d_value_from_int_oneshot(i)

create a oneshot int d_value

Examples:
/local/src/d_store/d_store/d_store.h.

#define D_UINT (  )     d_value_from_uint_oneshot(i)

create a oneshot uint d_value

#define D_DOUBLE (  )     d_value_from_double_oneshot(i)

create a oneshot double d_value

#define D_POINTER (  )     d_value_from_pointer_oneshot(i)

create a oneshot pointer d_value

#define D_DATA ( d,
 )     d_value_from_data_oneshot(d, sizeof(t))

create a oneshot data d_value

#define D_TOSTRING (  )     d_value_get_string(v)

get the string part of the d_value, same as d_value_get_string

#define D_TOINT (  )     d_value_get_int(v)

get the int part of the d_value, same as d_value_get_int()

#define D_TOUINT (  )     d_value_get_uint(v)

get the uint part of the d_value, same as d_value_get_uint()

#define D_TODOUBLE (  )     d_value_get_double(v)

get the double part of the d_value, same as d_value_get_double()

#define D_TOPOINTER (  )     d_value_get_pointer(v)

get the pointer part of the d_value, same as d_value_get_pointer()

#define D_TODATA (  )     d_value_get_data(v)

get the data part of the d_value, same as d_value_get_data()


Typedef Documentation

typedef struct d_value d_value

A value, it has a type d_value_type and you can get its data using d_value_get_string() and others.


Enumeration Type Documentation

enum d_value_type

The type a value can have


Function Documentation

d_value* d_value_create (  ) 

Create a new empty (D_VALUE_INVALID) value.

Returns:
the new value

void d_value_free ( d_value value  ) 

Free a value. Notice only to free values you have yourself created using d_value_create() or d_value_from_string() or d_value_copy(). Never when you used the D_STRING or other macros (unless you never actually used the value).

Parameters:
value the value to free

d_value* d_value_copy ( const d_value value  ) 

Copy a existing value. Free this value when you are done with it.

Parameters:
value to copy
Returns:
a copy of the value

d_value* d_value_copy_oneshot ( const d_value value  ) 

Copy an existing value and mark it as oneshot.

Parameters:
value to copy
Returns:
a oneshot copy of the value

int d_value_compare ( const d_value left,
const d_value right 
)

Compare two values, returns 0 if equal 1 or -1 if unequal

Parameters:
left the left value
right the right value
Returns:
0 if equal 1 or -1 otherwise

d_value_type d_value_get_type ( const d_value value  ) 

Get the type of a value.

Parameters:
value the value from which to get the type
Returns:
the type of the value

unsigned int d_value_get_length ( const d_value value  ) 

Get the length of a value. If length is not relevant, it will be 0, if length of a string it will be strlen, otherwise it will be the length of bytes allocated for the data the value represents.

Parameters:
value the value from which to get the length
Returns:
the length of the value


Generated on Fri Jan 19 13:06:23 2007 for d_store by  doxygen 1.5.1