blob: ea2df961de2a4fd3f719df3d3ec2e08d32db187e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#ifndef __REGIONCACHE_H
#define __REGIONCACHE_H
#include <bfc/string/StringW.h>
#include <tataki/region/region.h>
#include <bfc/ptrlist.h>
class CacheRegionServer : public RegionServerI {
public:
CacheRegionServer(api_region *r) {
reg = new RegionI(r->getOSHandle());
}
~CacheRegionServer() {
delete reg;
}
virtual api_region *getRegion() {
return reg;
}
private:
RegionI *reg;
};
struct RegionCacheItem {
RegionCacheItem(const wchar_t *filename) : region(NULL) { }
virtual ~RegionCacheItem() { }
StringW filename;
CacheRegionServer *region;
};
class SortRegionCacheItem {
public:
static int compareItem(RegionCacheItem *p1, RegionCacheItem *p2) {
return WCSICMP(p1->filename, p2->filename);
}
static int compareAttrib(const wchar_t *attrib, RegionCacheItem *item) {
return WCSICMP(attrib, item->filename);
}
};
class RegionCache {
public:
static RegionServer *requestSkinRegion(const wchar_t *id);
static void cacheSkinRegion(const wchar_t *id, api_region *r);
static PtrListQuickSorted<RegionCacheItem, SortRegionCacheItem> cache;
static int getNumCaches() { return cache.getNumItems(); }
};
#endif
|