class attribute {
char _key[128];
char _value[128];
char _buf[256];
public:
attribute(char* x) {
//cerr << "ATTR: " << x << endl;
_key[0]='\0';
_value[0]='\0';
strcpy(_buf,x);
//while( *_buf == ' ') _buf++;
char* p = _buf;
while ( *p != '=' ) p++;
*p = '\0';
if ( *(p+1) == '"' ) p++;
strcpy(_key,_buf);
strcpy(_value,p+1);
int n = strlen( _value ) - 1;
if (_value[n]=='"') _value[n]='\0';
//cerr << "KEY: " << _key << " VALUE: " << _value << endl;;
}
char* key() { return _key; }
char* value() { return _value; }
int matches(char* s) {
return !strcmp(key(),s);
}
};
slide: attribute