Public Member Functions | Protected Member Functions | Protected Attributes

EntityFactory Class Reference

Base factory object that creates new Entity objects. More...

#include <EntityFactory.h>

Inheritance diagram for EntityFactory:
ActorFactory PropFactory

List of all members.

Public Member Functions

 EntityFactory (const std::string &filePath)
virtual ~EntityFactory ()

Protected Member Functions

void debug ()
virtual bool parseXml (const std::string &filePath)=0

Protected Attributes

TiXmlDocument * mXmlDoc
string mSourceFile
StringList mErrors

Detailed Description

Base factory object that creates new Entity objects.

The EntityFactory is an abstract class used by derived factories to create new Entity objects of the appropriate derived type (e.g., items, monsters, , etc.).

As it is an abstract class, a useable Factory object must be derived from EntityFactory.

Note:
The member attribute 'mEntityDefinition' should not be created ordestroyed by any derived EntityFactory objects as the base constructor/destructor handle it's allocation and management.
Todo:
This class is not fully documented. In particular it does not explain any assumptions that are made nor how to properly implement the createEntity() function.

Constructor & Destructor Documentation

EntityFactory::EntityFactory ( const std::string &  filePath  )  [inline]

EntityFactor constructor.

Parameters:
filePath Path to an XML Definition file.
virtual EntityFactory::~EntityFactory (  )  [inline, virtual]

Ensures that mEntityDefinition is properly destroyed.


Member Function Documentation

void EntityFactory::debug (  )  [inline, protected]

Creates an Entity.

Parameters:
name Name for the new Entity.
definitionId ID value for the Entity Parameters stored within an Entity XML Definition File.

Reimplemented in PropFactory.

virtual bool EntityFactory::parseXml ( const std::string &  filePath  )  [protected, pure virtual]

Parses an Entity XML Definition file.

Parameters:
filePath Path to an Entity XML Definition File.

Implemented in ActorFactory, and PropFactory.


Member Data Documentation

An internal list of error and warning messages.

string EntityFactory::mSourceFile [protected]

The source XML file.

TiXmlDocument* EntityFactory::mXmlDoc [protected]

A TinyXML Document object.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines