Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
ICmpTemplateManager Class Referenceabstract

Template manager: Handles the loading of entity template files for the initialisation and deserialization of entity components. More...

#include <ICmpTemplateManager.h>

Inheritance diagram for ICmpTemplateManager:
IComponent CCmpTemplateManager

Public Member Functions

virtual const CParamNodeLoadTemplate (entity_id_t ent, const std::string &templateName, int playerID)=0
 Loads the template XML file identified by 'templateName' (including inheritance from parent XML files), and applies the techs that are currently active for player 'playerID', for use with a new entity 'ent'. More...
 
virtual const CParamNodeGetTemplate (std::string templateName)=0
 Loads the template XML file identified by 'templateName' (including inheritance from parent XML files). More...
 
virtual const CParamNodeGetTemplateWithoutValidation (std::string templateName)=0
 Like GetTemplate, except without doing the XML validation (so it's faster but may return invalid templates). More...
 
virtual const CParamNodeLoadLatestTemplate (entity_id_t ent)=0
 Returns the template most recently specified for the entity 'ent'. More...
 
virtual std::string GetCurrentTemplateName (entity_id_t ent)=0
 Returns the name of the template most recently specified for the entity 'ent'. More...
 
virtual std::vector< entity_id_tGetEntitiesUsingTemplate (std::string templateName)=0
 Returns the list of entities having the specified template. More...
 
virtual std::vector< std::string > FindAllTemplates (bool includeActors)=0
 Returns a list of strings that could be validly passed as templateName to LoadTemplate. More...
 
virtual void DisableValidation ()=0
 Permanently disable XML validation (intended solely for test cases). More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual JSClass * GetJSClass () const
 
virtual jsval GetJSInstance () const
 

Additional Inherited Members

- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Detailed Description

Template manager: Handles the loading of entity template files for the initialisation and deserialization of entity components.

Template names are intentionally restricted to ASCII strings for storage/serialization efficiency (we have a lot of strings so this is significant); they correspond to filenames so they shouldn't contain non-ASCII anyway.

Definition at line 33 of file ICmpTemplateManager.h.

Member Function Documentation

virtual void ICmpTemplateManager::DisableValidation ( )
pure virtual

Permanently disable XML validation (intended solely for test cases).

Implemented in CCmpTemplateManager.

virtual std::vector<std::string> ICmpTemplateManager::FindAllTemplates ( bool  includeActors)
pure virtual

Returns a list of strings that could be validly passed as templateName to LoadTemplate.

(This includes "actor|foo" etc names). Intended for use by the map editor. This is likely to be quite slow.

Implemented in CCmpTemplateManager.

virtual std::string ICmpTemplateManager::GetCurrentTemplateName ( entity_id_t  ent)
pure virtual

Returns the name of the template most recently specified for the entity 'ent'.

Implemented in CCmpTemplateManager.

virtual std::vector<entity_id_t> ICmpTemplateManager::GetEntitiesUsingTemplate ( std::string  templateName)
pure virtual

Returns the list of entities having the specified template.

Implemented in CCmpTemplateManager.

virtual const CParamNode* ICmpTemplateManager::GetTemplate ( std::string  templateName)
pure virtual

Loads the template XML file identified by 'templateName' (including inheritance from parent XML files).

The templateName syntax is the same as LoadTemplate.

Returns
NULL on error

Implemented in CCmpTemplateManager.

virtual const CParamNode* ICmpTemplateManager::GetTemplateWithoutValidation ( std::string  templateName)
pure virtual

Like GetTemplate, except without doing the XML validation (so it's faster but may return invalid templates).

Returns
NULL on error

Implemented in CCmpTemplateManager.

virtual const CParamNode* ICmpTemplateManager::LoadLatestTemplate ( entity_id_t  ent)
pure virtual

Returns the template most recently specified for the entity 'ent'.

Used during deserialization.

Returns
NULL on error

Implemented in CCmpTemplateManager.

virtual const CParamNode* ICmpTemplateManager::LoadTemplate ( entity_id_t  ent,
const std::string &  templateName,
int  playerID 
)
pure virtual

Loads the template XML file identified by 'templateName' (including inheritance from parent XML files), and applies the techs that are currently active for player 'playerID', for use with a new entity 'ent'.

The returned CParamNode must not be used for any entities other than 'ent'.

If templateName is of the form "actor|foo" then it will load a default stationary entity template that uses actor "foo". (This is a convenience to avoid the need for hundreds of tiny decorative-object entity templates.)

If templateName is of the form "preview|foo" then it will load a template based on entity template "foo" with the non-graphical components removed. (This is for previewing construction/placement of units.)

If templateName is of the form "corpse|foo" then it will load a template like "preview|foo" but with corpse-related components included.

If templateName is of the form "foundation|foo" then it will load a template based on entity template "foo" with various components removed and a few changed and added. (This is for constructing foundations of buildings.)

Returns
NULL on error

Implemented in CCmpTemplateManager.


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