Public Member Functions | |
Entity () | |
virtual | ~Entity () |
IAttribute * | findAttribute (const char *name) const |
IAttribute * | findAttribute (const std::string &name) const |
void | addAttribute (IAttribute &newAttr) |
template<class AttrType > | |
void | addAttribute (const char *name, const AttrType &attr) |
template<class AttrType > | |
void | addAttribute (const std::string &name, const AttrType &attr) |
Friends | |
class | INIFile |
std::ostream & | operator<< (std::ostream &out, const Entity &obj) throw () |
std::istream & | operator>> (std::istream &in, Entity &obj) throw () |
The descrutor frees all managed attributes, so make sure to create them on the heap.
Note that you can automatically manage the handled attributes with the utility mgeni
(in the bin subdirectory).
YGP::Entity::Entity | ( | ) | [inline] |
Default constructor.
YGP::Entity::~Entity | ( | ) | [virtual] |
Destructor.
void YGP::Entity::addAttribute | ( | const std::string & | name, | |
const AttrType & | attr | |||
) | [inline] |
Add a copy of an attribute with a specific type to the entity.
void YGP::Entity::addAttribute | ( | const char * | name, | |
const AttrType & | attr | |||
) | [inline] |
Add a copy of an attribute with a specific type to the entity.
void YGP::Entity::addAttribute | ( | IAttribute & | newAttr | ) | [inline] |
Adds a new attribute to the entity.
IAttribute * YGP::Entity::findAttribute | ( | const std::string & | name | ) | const |
Tries to find an attribute with the specified name.
name | Name of attribute to find |
IAttribute * YGP::Entity::findAttribute | ( | const char * | name | ) | const |
Tries to find an attribute with the specified name.
name | Name of attribute to find |
std::ostream& operator<< | ( | std::ostream & | out, | |
const Entity & | obj | |||
) | throw () [friend] |
Writes the attributes to a stream.
out | Stream to write to | |
obj | Object to write |
Anything | that operator<< of the attributes might throw |
std::istream& operator>> | ( | std::istream & | in, | |
Entity & | obj | |||
) | throw () [friend] |
Reads the attributes from a stream.
in | Stream to read from | |
obj | Object to read |
Anything | that operator>> of the attributes might throw |