Drag[en]gine Game Engine
1.21
|
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 , emtOcclusionMesh , emtSynthesizer , emtArchive , emtVR } |
Module Types. More... | |
Public Member Functions | |
Constructors and Destructors | |
deModuleSystem (deEngine *engine) | |
Create new module system linked to the given engine. More... | |
~deModuleSystem () | |
Clean up module system. More... | |
Management | |
deEngine * | GetEngine () const |
Linked game engine. More... | |
void | DetectModules () |
Scans the module directory for modules and loads them if possible. More... | |
Module Management | |
int | GetModuleCount () const |
Count of modules. More... | |
int | GetModuleCountFor (eModuleTypes type) const |
Count of modules of a given type. More... | |
int | GetLoadedModuleCountFor (eModuleTypes type) const |
Count of loaded modules of a given type. More... | |
deLoadableModule * | GetModuleAt (int index) const |
Module at the given index. More... | |
deLoadableModule * | GetModuleNamed (const char *name) const |
Highest version module with the given name or NULL if not found. More... | |
deLoadableModule * | GetModuleNamed (const char *name, const char *version) const |
Module with the given name and version or NULL if not found. More... | |
deLoadableModule * | GetModuleNamedAtLeast (const char *name, const char *version) const |
Module with the given name and at least version or NULL if not found. More... | |
deLoadableModule * | GetFirstLoadedModuleFor (eModuleTypes type) const |
First loaded module for the given type or NULL if not found. More... | |
deLoadableModule * | FindMatching (eModuleTypes type, const char *filename) const |
First module of the given type able to handle the given file. More... | |
deBaseModule * | GetModuleAbleToLoad (eModuleTypes type, const char *filename) const |
First modules of the given type able to handle the given file. More... | |
void | AddModule (deLoadableModule *module) |
Helper Functions | |
bool | MatchesPattern (const char *filename, const char *pattern) const |
Filename matches the given pattern. More... | |
bool | StrEqual (const char *str1, const char *str2, int length) const |
Determines if two strings are equal in a non-case sensitive comparisson. More... | |
static int | CompareVersion (const char *version1, const char *version2) |
Compare two module versions. More... | |
static eModuleTypes | GetTypeFromString (const char *typeString) |
static const char * | GetTypeDirectory (eModuleTypes type) |
Retrieves directory name for a given type. More... | |
static bool | IsSingleType (eModuleTypes 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 | ) |
Create new module system linked to the given engine.
deModuleSystem::~deModuleSystem | ( | ) |
Clean up 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.
|
static |
Compare two module versions.
The version strings have to consist of dot separated entries. The result is 0 if both strings are the same, -1 if the first differing version string part of the first version is less than the second or 1 otherwise.
void deModuleSystem::DetectModules | ( | ) |
Scans the module directory for modules and loads them if possible.
deLoadableModule* deModuleSystem::FindMatching | ( | eModuleTypes | type, |
const char * | filename | ||
) | const |
First module 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. If multiple versions of the same module exist the module with the highest version is returned.
|
inline |
Linked game engine.
deLoadableModule* deModuleSystem::GetFirstLoadedModuleFor | ( | eModuleTypes | type | ) | const |
First loaded module for the given type or NULL if not found.
int deModuleSystem::GetLoadedModuleCountFor | ( | eModuleTypes | type | ) | const |
Count of loaded modules of a given type.
deBaseModule* deModuleSystem::GetModuleAbleToLoad | ( | eModuleTypes | type, |
const char * | filename | ||
) | const |
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. If multiple versions of the same module exist the module with the highest version is returned.
deLoadableModule* deModuleSystem::GetModuleAt | ( | int | index | ) | const |
Module at the given index.
int deModuleSystem::GetModuleCount | ( | ) | const |
Count of modules.
int deModuleSystem::GetModuleCountFor | ( | eModuleTypes | type | ) | const |
Count of modules of a given type.
deLoadableModule* deModuleSystem::GetModuleNamed | ( | const char * | name | ) | const |
Highest version module with the given name or NULL if not found.
deLoadableModule* deModuleSystem::GetModuleNamed | ( | const char * | name, |
const char * | version | ||
) | const |
Module with the given name and version or NULL if not found.
deLoadableModule* deModuleSystem::GetModuleNamedAtLeast | ( | const char * | name, |
const char * | version | ||
) | const |
Module with the given name and at least version or NULL if not found.
|
static |
Retrieves directory name for a given type.
|
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 |
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 |
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.