YGP::Entity Class Reference

Baseclass for classes holding (a list of) attributes. More...

List of all members.

Public Member Functions

 Entity ()
virtual ~Entity ()
IAttributefindAttribute (const char *name) const
IAttributefindAttribute (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 ()


Detailed Description

Baseclass for classes holding (a list of) attributes.

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).


Constructor & Destructor Documentation

YGP::Entity::Entity (  )  [inline]

Default constructor.

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

Destructor.


Member Function Documentation

template<class AttrType >
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.

Note:
This is not portable!

template<class AttrType >
void YGP::Entity::addAttribute ( const char *  name,
const AttrType &  attr 
) [inline]

Add a copy of an attribute with a specific type to the entity.

Note:
This is not portable!

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.

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

IAttribute * YGP::Entity::findAttribute ( const char *  name  )  const

Tries to find an attribute with the specified name.

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


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Entity obj 
) throw () [friend]

Writes the attributes to a stream.

Parameters:
out Stream to write to
obj Object to write
Returns:
std::ostream& The stream
Exceptions:
Anything that operator<< of the attributes might throw

std::istream& operator>> ( std::istream &  in,
Entity obj 
) throw () [friend]

Reads the attributes from a stream.

Parameters:
in Stream to read from
obj Object to read
Returns:
std::ostream& The stream
Exceptions:
Anything that operator>> of the attributes might throw


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