Main Page Modules Alphabetical List Data Structures Data Fields
|
Data Structures |
| struct | RtDict |
| struct | RtDictSchema |
Typedefs |
| typedef RtDictSchema | RtDictSchema |
| typedef RtDict | RtDict |
| typedef void * | RtDictEntryType |
| typedef const void * | RtDictEntryConstType |
| typedef void *( | RtDictEntryAddRefCallBack )(RtDictEntryType entry) |
| typedef RwBool( | RtDictEntryDestroyCallBack )(RtDictEntryType entry) |
| typedef const RwChar *( | RtDictEntryGetNameCallBack )(RtDictEntryConstType entry) |
| typedef RwUInt32( | RtDictEntryStreamGetSizeCallBack )(RtDictEntryConstType entry) |
| typedef RtDictEntryType( | RtDictEntryStreamReadCallBack )(RwStream *stream) |
| typedef RtDict *( | RtDictStreamReadCompatibilityCallBack )(RwStream *stream) |
| typedef const RtDictEntryType( | RtDictEntryStreamWriteCallBack )(RtDictEntryConstType entry, RwStream *stream) |
| typedef RtDict *( | RtDictCallBack )(RtDict *dictionary, void *data) |
| typedef RtDictEntryType( | RtDictEntryCallBack )(RtDictEntryType entry, void *data) |
Functions |
| RtDictSchema * | RtDictSchemaInit (RtDictSchema *schema) |
| RwBool | RtDictSchemaDestruct (RtDictSchema *schema) |
| RtDict * | RtDictSchemaCreateDict (RtDictSchema *schema) |
| RtDictSchema * | RtDictSchemaAddDict (RtDictSchema *schema, RtDict *dict) |
| RtDictSchema * | RtDictSchemaRemoveDict (RtDictSchema *schema, RtDict *dict) |
| RtDict * | RtDictSchemaGetCurrentDict (RtDictSchema *schema) |
| RtDictSchema * | RtDictSchemaSetCurrentDict (RtDictSchema *schema, RtDict *dict) |
| RtDictEntryType | RtDictAddEntry (RtDict *dictionary, RtDictEntryType entry) |
| RtDictEntryType | RtDictFindNamedEntry (RtDict *dictionary, const RwChar *name) |
| const RtDict * | RtDictForAllEntries (const RtDict *dict, RtDictEntryCallBack *callBack, void *data) |
| RtDict * | RtDictRemoveEntry (RtDict *dictionary, RtDictEntryType entry) |
| RwBool | RtDictDestroy (RtDict *dictionary) |
| RwUInt32 | RtDictStreamGetSize (const RtDict *dictionary) |
| RtDict * | RtDictSchemaStreamReadDict (RtDictSchema *schema, RwStream *stream) |
| const RtDict * | RtDictStreamWrite (const RtDict *dictionary, RwStream *stream) |
| RwBool | RtDictSchemaForAllDictionaries (RtDictSchema *schema, RtDictCallBack *callBack, void *data) |
Detailed Description
Dictionary Toolkit for RenderWare Graphics. - Requirements
-
- Headers: rwcore.h
- Libraries: rwcore
- Plugin attachments: None
RtDict is a generic dictionary toolkit, enabling you to create dictionaries of arbitrary objects that may be located by name.
The layout of a dictionary is specified by a 'layout' object, RtDictSchema. Placed within the RtDictSchema are callbacks that allow the dictionary to manage the lifetime and streaming of the contained objects. RtDictSchema also manages a reference to a 'current' dictionary.
To use dictionaries, get access to or create a schema that defines the particular kind of dictionary you require. Then, call RtDictSchema functions to perform specific operations on dictionaries of that kind. RtDictSchemaCreateDict may be used to create new dictionaries; RtDictSchemaStreamReadDict can read in a dictionary; RtDictSchemaGetCurrentDict obtains the current dictionary and \RtDictschemaSetCurrentDict sets it.
Once you have a pointer to an RtDict object, you may place entries within the dictionary (RtDictAddEntry), remove entries (RtDictRemoveEntry) or stream the dictionary (RtDictStreamWrite, RtDictStreamGetSize).
Typedef Documentation
| typedef struct RtDict RtDict
|
|
| typedef RtDict*( RtDictCallBack)(RtDict *dictionary, void *data)
|
|
|
|
The following callbacks are needed for each dictionary schema. See RtDictSchema.
RtDictEntryAddRefCallBack defines a callback function for registering that the caller has a reference to a particular entry. - Parameters:
-
| Entry |
the entry of which to increment the reference count |
- Returns:
-
The entry
|
|
|
RtDictEntryCallBack is to be applied to each entry in a dictionary. - Parameters:
-
| entry |
The entry to apply the callback to |
| data |
User supplied data |
- Returns:
-
The entry the callback was applied to.
- See also:
-
RtDictForAllEntries
|
| typedef const void* RtDictEntryConstType
|
|
|
|
Typedef for dictionary entries |
|
|
RtDictEntryDestroyCallBack defines a callback function for destroying an entry in the dictionary. - Parameters:
-
| entry |
The entry to be destroyed |
- Returns:
-
Unused, RwBool to match most RenderWare object destruction functions
|
|
|
RtDictEntryGetNameCallBack defines a callback function to get the name of an entry in the dictionary. - Parameters:
-
- Returns:
-
A pointer to the name
|
|
|
RtDictEntryStreamReadCallBack reads a new entry from a stream. This function should return a pointer to a freshly allocated and initialized entry, with a nominal reference count of 1 (which will be assigned to the dictionary). - Parameters:
-
| stream |
The stream to read from |
- Returns:
-
A pointer to the new entry on success; NULL on failure.
|
|
|
RtDictEntryStreamWriteCallBack writes an entry of the dictionary to a stream. - Parameters:
-
| entry |
The entry to write |
| stream |
The stream to write to |
- Returns:
-
The entry on success; NULL on failure.
|
| typedef void* RtDictEntryType
|
|
|
|
Typedef for dictionary entries |
| typedef struct RtDictSchema RtDictSchema
|
|
| typedef RtDict*( RtDictStreamReadCompatibilityCallBack)(RwStream *stream)
|
|
|
|
RtDictStreamReadCompatibilityCallBack enables older dictionaries to be retrofitted to use the new generic dictionary code. This callback is for internal use. - Parameters:
-
| stream |
The stream to read from |
- Returns:
-
A pointer to the new dictionary on success; NULL on failure.
|
Function Documentation
|
|
RtDictAddEntry adds an entry to the dictionary, incrementing the reference count of that entry. - Parameters:
-
| dict |
The dictionary the entry will to be added to |
| entry |
The entry to be added to the dictionary |
- Returns:
-
A valid pointer to the RtDict
- See also:
-
RtDictForAllEntries , RtDictCreate
|
|
|
RtDictDestroy destroys a dictionary. The reference counts of all the entries contained in the dictionary are decreased via their destroy functions and the memory, associated with the dictionary, freed. If this dictionary is the current dictionary in its schema, the current dictionary is set to NULL. - Parameters:
-
| dict |
The dictionary to be destroyed |
- Returns:
-
TRUE if successful, FALSE otherwise
- See also:
-
RtDictCreate , RtDictSchemaSetCurrentDict
|
|
|
RtDictFindNamedEntry finds an entry in a dictionary using the entry's name. - Parameters:
-
| dict |
The dictionary to be looked into. |
| name |
The name of the entry to look for. |
- Returns:
-
A valid pointer to an entry if the entry is found, NULL otherwise
|
|
|
RtDictForAllEntries executes a callback for every entry in the dictionary. - Parameters:
-
| dict |
A pointer to the RtDict. |
| callBack |
The callback function to be executed for every entry |
| data |
The user specified data passed on to the callback function for each entry. |
- Returns:
-
A valid pointer to an RtDict.
- See also:
-
RtDictSchemaForAllDictionaries
|
|
|
RtDictRemoveEntry removes an entry from the current dictionary. The entry's destroy function is called. Consequently, if you wish to retain the entry you should AddRef it prior to calling this function. - Parameters:
-
| dict |
The dictionary to remove the entry from |
| entry |
The entry to be removed |
- Returns:
-
On success, the dictionary. NULL if the entry wasn't found in the dictionary.
- See also:
-
RtDictAddEntry
|
|
|
RtDictSchemaForAllDictionaries executes a callback function for all active dictionaries. The callback function can have specified user datas. - Parameters:
-
| schema |
The schema for the set of dictionaries to be iterated over |
| callBack |
The callback function to be executed for all dictionaries. |
| data |
The user specified data passed on to the callback function for each dictionary. |
- Returns:
-
A RwBool (always TRUE at the moment)
- See also:
-
RtDictForAllEntries
|
|
|
RtDictSchemaGetCurrentDict gets the current dictionary. - Parameters:
-
| schema |
The schema for which to obtain the current dictionary of |
- Returns:
-
A pointer to the current RtDict. This is NULL if there is no current dictionary.
- See also:
-
RtDictSetCurrent
|
|
|
RtDictSchemaSetCurrentDict sets the current dictionary. - Parameters:
-
| schema |
The schema for which to set the current dictionary. |
| dict |
The dictionary to be set as current. NULL is valid, and indicates there is no current dictionary. |
- Returns:
-
A valid pointer to the schema.
- See also:
-
RtDictGetCurrent
|
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:47:09 2004.
Send Feedback