Subversion Repositories Kolibri OS

Rev

Rev 7972 | Rev 8336 | Go to most recent revision | 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;
7764 leency 9
	collection url;
7972 leency 10
	collection_int data;
11
	collection_int size;
8016 leency 12
	collection_int type;
7764 leency 13
	void add();
14
	bool has();
7770 leency 15
	void clear();
8016 leency 16
} cache=0;
7764 leency 17
 
8016 leency 18
void _cache::add(dword _url, _data, _size, _type)
7764 leency 19
{
20
	dword data_pointer;
21
	data_pointer = malloc(_size);
22
	memmov(data_pointer, _data, _size);
7972 leency 23
	data.add(data_pointer);
7764 leency 24
 
25
	url.add(_url);
7972 leency 26
	size.add(_size);
8016 leency 27
	type.add(_type);
7764 leency 28
}
29
 
8016 leency 30
bool _cache::has(dword _link)
7764 leency 31
{
32
	int pos;
33
	pos = url.get_pos_by_name(_link);
34
	if (pos != -1) {
8016 leency 35
		current_buf = data.get(pos);
36
		current_size = size.get(pos);
7764 leency 37
		return true;
38
	}
39
	return false;
7770 leency 40
}
41
 
8016 leency 42
void _cache::clear()
7770 leency 43
{
44
	url.drop();
45
	data.drop();
46
	size.drop();
8016 leency 47
	current_buf = NULL;
48
	current_size = NULL;
7764 leency 49
}