FYP  1.0.0
Final Year Project -- Alexander Meuer
UnitFactory Class Reference

Factory for production of Hero and Minions from xml definition files. More...

#include <UnitFactory.hpp>

Collaboration diagram for UnitFactory:
Collaboration graph

Public Member Functions

 UnitFactory (std::string const &definitionFolderPath="./res/xml/", std::string const &defFileExtension=".def")
 
std::shared_ptr< Pawnproduce (std::string const &name)
 Creates a new Pawn derivative from the definition at path. More...
 

Private Member Functions

void loadDefinition (std::string const &name)
 Opens an xml file and holds it in mDefinitionMap, with its path as the key.
 

Private Attributes

std::map< std::string, XMLDocument * > mDefinitionMap
 Map of file paths to currently open xml documents.
 
std::string mDefinitionFolderPath
 Path to folder containing xml unit definitions.
 
std::string mFileExt
 File extension of xml unit definitions.
 

Detailed Description

Factory for production of Hero and Minions from xml definition files.

Constructor & Destructor Documentation

UnitFactory::UnitFactory ( std::string const &  definitionFolderPath = "./res/xml/",
std::string const &  defFileExtension = ".def" 
)
Parameters
definitionFolderPathPath to a folder containing unit definition files
defFileExtensionFile extension of unit definition files

Member Function Documentation

std::shared_ptr<Pawn> UnitFactory::produce ( std::string const &  name)

Creates a new Pawn derivative from the definition at path.

Parameters
nameName of file containing definition, without the file extension.
Remarks
Valid units are Hero and Minion; The root node of the file needs to match one of these.

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