root/trunk/orca/gl/res.h

Revision 1, 2.0 kB (checked in by krobillard, 3 years ago)

Import orca & thune.

Line 
1#ifndef RES_H
2#define RES_H
3/*============================================================================
4    Resource Dictionary
5    Copyright (C) 2005  Karl Robillard
6
7    This library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License as published by the Free Software Foundation; either
10    version 2.1 of the License, or (at your option) any later version.
11
12    This library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with this library; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20===========================================================================*/
21
22
23#include <stdint.h>
24
25
26#define MAX_RES_TYPES   16
27
28
29typedef struct
30{
31    uint16_t    resType;
32    uint16_t    resGroup;
33    uint32_t    resKey;
34    void*       resLink;
35}
36Resource;
37
38
39typedef struct
40{
41    int32_t     tableLen;
42    Resource**  table;
43}
44ResourceDict;
45
46
47typedef struct
48{
49    uint16_t    type;
50    void (*destroy)( Resource* );
51}
52ResourceClass;
53
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59void      resd_register( ResourceClass* );
60void      resd_destroy( Resource* );
61uint16_t  resd_currentGroup();
62void      resd_setCurrentGroup( uint16_t group );
63
64void      resd_init( ResourceDict*, int tableLen );
65void      resd_free( ResourceDict* );
66void      resd_freeGroup( ResourceDict*, uint16_t group );
67uint32_t  resd_hash( const char* buf, int len );
68Resource* resd_lookup( const ResourceDict*, uint32_t key );
69void      resd_add( ResourceDict* dict, Resource* res, uint32_t key );
70Resource* resd_remove( ResourceDict*, uint32_t key );
71void      resd_statistics( ResourceDict* dict, const char* msg );
72
73#ifdef __cplusplus
74}
75#endif
76
77
78#endif  /* RES_H */
Note: See TracBrowser for help on using the browser.