Subversion Repositories Kolibri OS

Rev

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