Subversion Repositories Kolibri OS

Rev

Rev 7935 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7752 leency 1
 
2
{
4411 leency 3
	char name[32];
7752 leency 4
	char prior[32];
7756 leency 5
	char params[5000];
7752 leency 6
	bool opened;
7
	collection attributes;
8
	collection values;
9
	bool is();
10
	bool reset();
11
	bool parse_params();
12
	bool get_next_param();
13
	dword get_value_of();
14
} tag;
15
7282 leency 16
 
7752 leency 17
{
18
	if ( !strcmp(#tag.name, _text) ) {
19
		return true;
20
	} else {
21
		return false;
22
	}
23
}
24
25
 
26
{
27
	if (!name) return false;
28
	strcpy(#prior, #name);
7756 leency 29
	name = NULL;
7752 leency 30
	opened = true;
31
	attributes.drop();
32
	values.drop();
33
	return true;
34
}
35
36
 
37
{
38
	bool result = false;
39
	if (!name) return false;
40
	if (debug_mode) {
7282 leency 41
		debug("\n\ntag: "); debugln(#name);
7853 leency 42
		debug("params: "); debugln(#params);
7752 leency 43
		debugln(" ");
44
	}
7282 leency 45
	while (get_next_param()) {
7752 leency 46
		result = true;
47
		if (debug_mode) {
48
			debug("attribute: "); debugln(attributes.get(attributes.count-1));
49
			debug("value: "); debugln(values.get(values.count-1));
50
			debugln(" ");
51
		}
52
	};
53
	return result;
54
}
55
7282 leency 56
 
7752 leency 57
{
58
	byte  quotes = NULL;
59
	int   i;
60
	unsigned char  val[4000];
61
	unsigned char attr[4000];
62
7282 leency 63
 
7752 leency 64
65
 
66
	if (params[i] == '/') i--;
67
	while (i>0) && (__isWhite(params[i])) i--;
68
7282 leency 69
 
7752 leency 70
	{
7282 leency 71
		//remove quotes
7752 leency 72
		quotes = params[i];
73
		params[i] = '\0';
7970 leency 74
		i--;
7752 leency 75
7282 leency 76
 
77
		i = strrchr(#params, quotes);
7752 leency 78
		strlcpy(#val, #params + i, sizeof(val)-1);
79
		params[i] = '\0';
7970 leency 80
		i--;
7752 leency 81
7282 leency 82
 
83
		while (i > 0) && (params[i] != '=') i--;
7752 leency 84
		params[i+1] = '\0';
7970 leency 85
	}
7282 leency 86
	else
87
	{
88
		//find VAL start and copy
89
		while (i > 0) && (params[i] != '=') i--;
7752 leency 90
		i++;
7282 leency 91
		strlcpy(#val, #params + i, sizeof(val)-1);
7752 leency 92
7282 leency 93
 
7752 leency 94
	}
7282 leency 95
96
 
97
	while (i>0) && (!__isWhite(params[i])) i--;
7752 leency 98
	strlcpy(#attr, #params + i + 1, sizeof(attr)-1);
99
	params[i] = '\0';
100
7750 leency 101
 
102
	i = strchr(#attr,'=');
103
	if (!quotes) && (i) {
104
		strlcpy(#val, i+1, sizeof(val)-1);
105
		ESBYTE[i+1] = '\0';
106
	}
107
	strlwr(#attr);
7935 leency 108
7282 leency 109
 
7752 leency 110
	values.add(#val);
111
7282 leency 112
 
113
}
114
115
 
7752 leency 116
{
117
	int pos = attributes.get_pos_by_name(_attr_name);
118
	if (pos == -1) {
119
		return 0;
120
	} else {
121
		return values.get(pos);
122
	}
123
}
124