Module System. More...
#include <deModuleSystem.h>
Public Types | |
| enum | eModuleTypes { emtUnknown, emtGraphic, emtAudio, emtInput, emtNetwork, emtPhysics, emtImage, emtVideo, emtScript, emtModel, emtRig, emtSkin, emtAnimation, emtFont, emtCrashRecovery, emtLanguagePack, emtAnimator, emtSound, emtAI, EMT_COUNT } |
Module Types. More... | |
Public Member Functions | |
Constructors and Destructors | |
| deModuleSystem (deEngine *engine) | |
| Creates a new module system linked to the given engine. | |
| ~deModuleSystem () | |
| Cleans up the module system. | |
Management | |
| deEngine * | GetEngine () const |
| Retrieves the linked game engine. | |
| void | DetectModules () |
| Scans the module directory for modules and loads them if possible. | |
Module Management | |
| int | GetModuleCount () const |
| Retrieves the count of modules. | |
| int | GetModuleCountFor (int type) const |
| Retrieves the count of modules of a given type. | |
| int | GetLoadedModuleCountFor (int type) const |
| Retrieves the count of loaded modules of a given type. | |
| deLoadableModule * | GetModuleAt (int index) const |
| Retrieves the module at the given index. | |
| deLoadableModule * | GetModuleNamed (const char *name) const |
| Retrieves the module with the given name or NULL if not found. | |
| deLoadableModule * | GetFirstLoadedModuleFor (int type) const |
| Retrieves the first loaded module for the given type or NULL if not found. | |
| deLoadableModule * | FindMatching (int type, const char *filename) const |
| Retrieves the first modules of the given type able to handle the given file. | |
| deBaseModule * | GetModuleAbleToLoad (int type, const char *filename) const |
| Retrieves the first modules of the given type able to handle the given file. | |
| void | AddModule (deLoadableModule *module) |
| Adds a module to the system. | |
Helper Functions | |
| bool | MatchesPattern (const char *filename, const char *pattern) const |
| Determines if the filename matches the given pattern. | |
| bool | StrEqual (const char *str1, const char *str2, int length) const |
| Determines if two strings are equal in a non-case sensitive comparisson. | |
| const char * | GetTypeDirectory (int type) |
| Retrieves directory name for a given type. | |
| static int | GetTypeFromString (const char *typeString) |
| Retrieves the type from eModuleTypes matching the given type string. | |
| static bool | IsSingleType (int type) |
| Retrieves if the given type is a single type. | |
Module System.
This is a special system and not to be confused with single type or multiple type engine systems. The module system keeps track of all modules existing in the engine no matter if loaded or not. All modules that can be parsed are stored in the module system. If a module can not be loaded it still stays here but is marked as not loaded. This is to allow the engine and frontends to provide a nice view to the user showing what is working and what not. Only loaded modules are used by the engine.
Module Types.
| deModuleSystem::deModuleSystem | ( | deEngine * | engine ) |
Creates a new module system linked to the given engine.
| deModuleSystem::~deModuleSystem | ( | ) |
Cleans up the module system.
| void deModuleSystem::AddModule | ( | deLoadableModule * | module ) |
Adds a module to the system.
The module has not to exist already and has to be properly initialized to be accepted.
| void deModuleSystem::DetectModules | ( | ) |
Scans the module directory for modules and loads them if possible.
| deLoadableModule* deModuleSystem::FindMatching | ( | int | type, |
| const char * | filename | ||
| ) | const |
Retrieves the first modules of the given type able to handle the given file.
Multiple type modules provide a list of file extensions they can handle. If the extension of the given filename matches one of the entris of a module it is considered able to handle the file.
| deEngine* deModuleSystem::GetEngine | ( | ) | const [inline] |
Retrieves the linked game engine.
| deLoadableModule* deModuleSystem::GetFirstLoadedModuleFor | ( | int | type ) | const |
Retrieves the first loaded module for the given type or NULL if not found.
| int deModuleSystem::GetLoadedModuleCountFor | ( | int | type ) | const |
Retrieves the count of loaded modules of a given type.
| deBaseModule* deModuleSystem::GetModuleAbleToLoad | ( | int | type, |
| const char * | filename | ||
| ) | const |
Retrieves the first modules of the given type able to handle the given file.
This is the same as the FindMatching function but with the difference that the returned object is the module itself and not the wrapper around the module. This also requires that the module is loaded. In the other function Not loaded modules are matching too whereas here this is not the case.
| deLoadableModule* deModuleSystem::GetModuleAt | ( | int | index ) | const |
Retrieves the module at the given index.
| int deModuleSystem::GetModuleCount | ( | ) | const [inline] |
Retrieves the count of modules.
| int deModuleSystem::GetModuleCountFor | ( | int | type ) | const |
Retrieves the count of modules of a given type.
| deLoadableModule* deModuleSystem::GetModuleNamed | ( | const char * | name ) | const |
Retrieves the module with the given name or NULL if not found.
| const char* deModuleSystem::GetTypeDirectory | ( | int | type ) |
Retrieves directory name for a given type.
| static int deModuleSystem::GetTypeFromString | ( | const char * | typeString ) | [static] |
Retrieves the type from eModuleTypes matching the given type string.
This is used to translate type strings from the XML module definitions into an engine usable type. The following table shows the matchings.
In all other cases emtUnknown is returned. Case does not matter.
| static bool deModuleSystem::IsSingleType | ( | int | type ) | [static] |
Retrieves if the given type is a single type.
The following are single types:
All others are multiple type.
| bool deModuleSystem::MatchesPattern | ( | const char * | filename, |
| const char * | pattern | ||
| ) | const |
Determines if the filename matches the given pattern.
| bool deModuleSystem::StrEqual | ( | const char * | str1, |
| const char * | str2, | ||
| int | length | ||
| ) | const |
Determines if two strings are equal in a non-case sensitive comparisson.
1.7.2