YGP::AttributeParse Class Reference

Class to parse attribute-assignments from a string and sets its values into attribute-values. More...

List of all members.

Public Member Functions

 AttributeParse ()
virtual ~AttributeParse ()
void assignValues (const std::string &values) const throw (YGP::ParseError)
void addAttribute (IAttribute &attr)
const IAttributefindAttribute (const std::string &name) const
const IAttributefindAttribute (const char *name) const


Detailed Description

Class to parse attribute-assignments from a string and sets its values into attribute-values.

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.

Note:
Tthe order of the attributes while declaration and during parsing does not need to be the same!

Constructor & Destructor Documentation

YGP::AttributeParse::AttributeParse (  )  [inline]

Default constructor; creates an empty object.

YGP::AttributeParse::~AttributeParse (  )  [virtual]

Destructor.


Member Function Documentation

void YGP::AttributeParse::addAttribute ( IAttribute attribute  ) 

Adds an attribute to the request.

Parameters:
attribute Attribute to add
Remarks:
In the debug version a message is shown, if the attribute already exists

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.

Parameters:
values Name of attribute to find
Exceptions:
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.

Parameters:
name Name of attribute to find
Returns:
IAttribute* Pointer to attribute or NULL (if not found)

const IAttribute * YGP::AttributeParse::findAttribute ( const std::string &  name  )  const

Searches for an attribute with the passed name.

Parameters:
name Name of attribute to find
Returns:
IAttribute* Pointer to attribute or NULL (if not found)


The documentation for this class was generated from the following files:

YGP Version 0.9.31 - Generated on Wed Nov 18 11:25:27 2009 by doxygen 1.5.8