Subversion Repositories Kolibri OS

Rev

Rev 8425 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8016 leency 1
enum {
2
	PAGE=1, IMG
3
};
7764 leency 4
 
8016 leency 5
struct _cache
7764 leency 6
{
8016 leency 7
	dword current_buf;
8
	dword current_size;
8336 leency 9
	dword current_type;
8492 leency 10
	dword current_charset;
7764 leency 11
	collection url;
7972 leency 12
	collection_int data;
13
	collection_int size;
8016 leency 14
	collection_int type;
8492 leency 15
	collection_int charset;
7764 leency 16
	void add();
17
	bool has();
7770 leency 18
	void clear();
8016 leency 19
} cache=0;
7764 leency 20
 
8492 leency 21
void _cache::add(dword _url, _data, _size, _type, _charset)
7764 leency 22
{
23
	dword data_pointer;
24
	data_pointer = malloc(_size);
25
	memmov(data_pointer, _data, _size);
7972 leency 26
	data.add(data_pointer);
7764 leency 27
 
28
	url.add(_url);
7972 leency 29
	size.add(_size);
8016 leency 30
	type.add(_type);
8492 leency 31
	charset.add(_charset);
8425 leency 32
 
33
	current_buf = data_pointer;
34
	current_size = _size;
7764 leency 35
}
36
 
8016 leency 37
bool _cache::has(dword _link)
7764 leency 38
{
39
	int pos;
40
	pos = url.get_pos_by_name(_link);
41
	if (pos != -1) {
8016 leency 42
		current_buf = data.get(pos);
43
		current_size = size.get(pos);
8336 leency 44
		current_type = type.get(pos);
8492 leency 45
		current_charset = charset.get(pos);
7764 leency 46
		return true;
47
	}
48
	return false;
7770 leency 49
}
50
 
8016 leency 51
void _cache::clear()
7770 leency 52
{
8339 leency 53
	int i;
54
	for (i=0; i
7770 leency 55
	url.drop();
56
	data.drop();
57
	size.drop();
8355 leency 58
	type.drop();
8016 leency 59
	current_buf = NULL;
60
	current_size = NULL;
7764 leency 61
}