QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Property lists

Typedefs

typedef struct plitem_s plitem_t
 Generic property list item. More...
 

Enumerations

enum  pltype_t { QFDictionary, QFArray, QFBinary, QFString }
 The type of the property list item. More...
 

Functions

qboolean PL_A_AddObject (plitem_t *array, plitem_t *item)
 Add an item to an array. More...
 
qboolean PL_A_InsertObjectAtIndex (plitem_t *array, plitem_t *item, int index)
 Insert an item into an array before the specified location. More...
 
int PL_A_NumObjects (plitem_t *array)
 Retrieve the number of items in an array. More...
 
qboolean PL_D_AddObject (plitem_t *dict, const char *key, plitem_t *value)
 Add a key/value pair to a dictionary. More...
 
plitem_tPL_D_AllKeys (plitem_t *dict)
 Retrieve a list of all keys in a dictionary. More...
 
int PL_D_NumKeys (plitem_t *dict)
 Retrieve the number of keys in a dictionary. More...
 
void PL_Free (plitem_t *item)
 Free a property list object. More...
 
plitem_tPL_GetPropertyList (const char *string)
 Create an in-memory representation of the contents of a property list. More...
 
plitem_tPL_NewArray (void)
 Create a new array object. More...
 
plitem_tPL_NewData (void *data, size_t size)
 Create a new data object from the given data. More...
 
plitem_tPL_NewDictionary (void)
 Create a new dictionary object. More...
 
plitem_tPL_NewString (const char *str)
 Create a new string object. More...
 
plitem_tPL_ObjectAtIndex (plitem_t *array, int index)
 Retrieve a value from an array object. More...
 
plitem_tPL_ObjectForKey (plitem_t *dict, const char *key)
 Retrieve a value from a dictionary object. More...
 
plitem_tPL_RemoveObjectAtIndex (plitem_t *array, int index)
 Remove a value from an array object. More...
 
plitem_tPL_RemoveObjectForKey (plitem_t *dict, const char *key)
 Remove a value from a dictionary object. More...
 
const char * PL_String (plitem_t *string)
 Retrieve a string from a string object. More...
 
pltype_t PL_Type (plitem_t *item)
 Retrieve the type of an object. More...
 
char * PL_WritePropertyList (plitem_t *pl)
 Create a property list string from the in-memory representation. More...
 

Detailed Description

Typedef Documentation

typedef struct plitem_s plitem_t

Generic property list item.

All inspection and manipulation is to be done via the accessor functions.

Enumeration Type Documentation

enum pltype_t

The type of the property list item.

For further details, see Property List.

Enumerator
QFDictionary 

The property list item represents a dictionary.

QFArray 

The property list item represents an array.

QFBinary 

The property list item represents arbitrary binary data.

QFString 

The property list item represents a C string.

Function Documentation

qboolean PL_A_AddObject ( plitem_t array,
plitem_t item 
)

Add an item to an array.

Parameters
arrayThe array to which the item will be added
itemThe item to be added to the array
Returns
true on success, false on failure
Note
the array becomes the owner of the added item.
qboolean PL_A_InsertObjectAtIndex ( plitem_t array,
plitem_t item,
int  index 
)

Insert an item into an array before the specified location.

Parameters
arrayThe array to which the item will be added
itemThe item to be added to the array
indexThe location at which to insert the item into the array
Returns
true on success, false on failure
Note
the array becomes the owner of the added item.
int PL_A_NumObjects ( plitem_t array)

Retrieve the number of items in an array.

Parameters
arrayThe array from which to get the number of objects
Returns
number of objects in the array
qboolean PL_D_AddObject ( plitem_t dict,
const char *  key,
plitem_t value 
)

Add a key/value pair to a dictionary.

Parameters
dictThe dictionary to which the key/value pair will be added
keyThe key of the key/value pair to be added to the dictionary
valueThe value of the key/value pair to be added to the dictionary
Returns
true on success, false on failure
Note
the dictionary becomes the owner of the value.
plitem_t* PL_D_AllKeys ( plitem_t dict)

Retrieve a list of all keys in a dictionary.

Parameters
dictThe dictionary to list
Returns
an Array containing Strings or NULL if dict isn't a dictionary
Note
You are responsible for freeing this array.
int PL_D_NumKeys ( plitem_t dict)

Retrieve the number of keys in a dictionary.

Parameters
dictThe dictionary to get the number of keys of.
Returns
Returns the number of keys in the dictionary.
void PL_Free ( plitem_t item)

Free a property list object.

This function takes care of freeing any referenced property list data, so call it only on top-level objects.

Parameters
itemthe property list object to be freed
plitem_t* PL_GetPropertyList ( const char *  string)

Create an in-memory representation of the contents of a property list.

Parameters
stringthe saved plist, as read from a file.
Returns
Returns an object equivalent to the passed-in string.
Note
You are responsible for freeing the returned object.
plitem_t* PL_NewArray ( void  )

Create a new array object.

The array will be empty.

Returns
the new array object
plitem_t* PL_NewData ( void *  data,
size_t  size 
)

Create a new data object from the given data.

Takes ownership of the given data.

Parameters
datapointer to data buffer
sizenumber of bytes in the buffer
Returns
the new dictionary object
Note
The data will be freed via free() when the item is freed.
plitem_t* PL_NewDictionary ( void  )

Create a new dictionary object.

The dictionary will be empty.

Returns
the new dictionary object
plitem_t* PL_NewString ( const char *  str)

Create a new string object.

Makes a copy of the given string.

Parameters
strC string to copy
Returns
the new dictionary object
plitem_t* PL_ObjectAtIndex ( plitem_t array,
int  index 
)

Retrieve a value from an array object.

Parameters
arrayThe array to get the value from
indexThe index within the array to retrieve
Returns
the value associated with the key, or NULL if not found or array isn't an array.
Note
You are NOT responsible for freeing the returned object. It will be destroyed when its container is.
plitem_t* PL_ObjectForKey ( plitem_t dict,
const char *  key 
)

Retrieve a value from a dictionary object.

Parameters
dictThe dictionary to retrieve a value from
keyThe unique key associated with the value
Returns
the value associated with the key, or NULL if not found or dict isn't a dictionary.
Note
You are NOT responsible for freeing the returned object. It will be destroyed when its container is.
plitem_t* PL_RemoveObjectAtIndex ( plitem_t array,
int  index 
)

Remove a value from an array object.

The array items will be shuffled to fill the resulting hole.

Parameters
arrayThe array from which to remove the value
indexThe index within the array to remove
Returns
the value associated with the index, or NULL if not found or array isn't an array.
Note
You are responsible for freeing the returned object.
plitem_t* PL_RemoveObjectForKey ( plitem_t dict,
const char *  key 
)

Remove a value from a dictionary object.

Parameters
dictThe Dictionary to remove the value from
keyThe unique key associated with the value to be removed
Returns
the value associated with the key, or NULL if not found or dict isn't a dictionary.
Note
You are responsible for freeing the returned object.
const char* PL_String ( plitem_t string)

Retrieve a string from a string object.

Parameters
stringThe string object
Returns
pointer to the actual string value or NULL if string isn't a string.
Note
You are NOT responsible for freeing the returned object. It will be destroyed when its container is.
pltype_t PL_Type ( plitem_t item)

Retrieve the type of an object.

Parameters
itemThe object
Returns
the type of the object
char* PL_WritePropertyList ( plitem_t pl)

Create a property list string from the in-memory representation.

Parameters
plthe in-memory representation
Returns
the text representation of the property list
Note
You are responsible for freeing the returned string.