Public Member Functions | |
| AttributeParse () | |
| virtual | ~AttributeParse () |
| void | assignValues (const std::string &values) const throw (YGP::ParseError) |
| void | addAttribute (IAttribute &attr) |
| const IAttribute * | findAttribute (const std::string &name) const |
| const IAttribute * | findAttribute (const char *name) const |
Use this class like the following:
std::string file;
ANumeric size;
ATimestamp time;
AttributeParse attrs;
ATTRIBUTE (attrs, std::string, file, "File");
ATTRIBUTE (attrs, ANumeric, size, "Size");
ATTRIBUTE (attrs, ATimestamp, time, "Time");
try {
attrs.assignValues ("File=\"ADate.cpp\";Time=01012000 121005;Size=18180");
}
catch (YGP::ParseError& e) {
// Errorhandling
}
This example would assign the values ADate.cpp to file, 18180 to size and the 1st of January 2000, 12:10:05 to time.
MEATTRIBUTE defines an attribute whose values are restricted to the values in the respective YGP::MetaEnum.
| YGP::AttributeParse::AttributeParse | ( | ) | [inline] |
Default constructor; creates an empty object.
| YGP::AttributeParse::~AttributeParse | ( | ) | [virtual] |
Destructor.
| void YGP::AttributeParse::addAttribute | ( | IAttribute & | attribute | ) |
Adds an attribute to the request.
| attribute | Attribute to add |
| void YGP::AttributeParse::assignValues | ( | const std::string & | values | ) | const throw (YGP::ParseError) |
Assigns the values from the passed string to the attribute-values stored inside the object.
If the name does not match any of the attributes or the value does not fit to the type, an exception is thrown.
| values | Name of attribute to find |
| YGP::ParseError_argument | in case of an unknown name or an invalid value |
| const IAttribute * YGP::AttributeParse::findAttribute | ( | const char * | name | ) | const |
Searches for an attribute with the passed name.
| name | Name of attribute to find |
| const IAttribute * YGP::AttributeParse::findAttribute | ( | const std::string & | name | ) | const |
Searches for an attribute with the passed name.
| name | Name of attribute to find |