Base for all driver factories. More...
#include <driver.h>
Public Member Functions | |
virtual | ~DriverFactoryBase () |
Frees memory used for this->name. | |
virtual const char * | GetDescription ()=0 |
Get a nice description of the driver-class. | |
virtual Driver * | CreateInstance ()=0 |
Create an instance of this driver-class. | |
Static Public Member Functions | |
static void | ShutdownDrivers () |
Shuts down all active drivers. | |
static Driver * | SelectDriver (const char *name, Driver::Type type) |
Find the requested driver and return its class. | |
static char * | GetDriversInfo (char *p, const char *last) |
Build a human readable list of available drivers, grouped by type. | |
Protected Member Functions | |
void | RegisterDriver (const char *name, Driver::Type type, int priority) |
Register a driver internally, based on its name. | |
Private Types | |
typedef std::map< const char *, DriverFactoryBase *, StringCompare > | Drivers |
Type for a map of drivers. | |
Static Private Member Functions | |
static Drivers & | GetDrivers () |
Get the map with drivers. | |
static Driver ** | GetActiveDriver (Driver::Type type) |
Get the active driver for the given type. | |
static const char * | GetDriverTypeName (Driver::Type type) |
Get the driver type name. | |
Private Attributes | |
Driver::Type | type |
The type of driver. | |
const char * | name |
The name of the drivers of this factory. | |
int | priority |
The priority of this factory. |
Base for all driver factories.
Definition at line 60 of file driver.h.
virtual Driver* DriverFactoryBase::CreateInstance | ( | ) | [pure virtual] |
Create an instance of this driver-class.
Implemented in FMusicDriver_Allegro, FMusicDriver_BeMidi, FMusicDriver_Cocoa, FMusicDriver_DMusic, FMusicDriver_ExtMidi, FMusicDriver_LibTimidity, FMusicDriver_Null, FMusicDriver_OS2, FMusicDriver_QtMidi, FMusicDriver_Win32, FSoundDriver_Allegro, FSoundDriver_Cocoa, FSoundDriver_Null, FSoundDriver_SDL, FSoundDriver_Win32, FVideoDriver_Allegro, FVideoDriver_Cocoa, FVideoDriver_Dedicated, FVideoDriver_Null, FVideoDriver_SDL, and FVideoDriver_Win32.
Referenced by SelectDriver().
static Driver** DriverFactoryBase::GetActiveDriver | ( | Driver::Type | type | ) | [inline, static, private] |
Get the active driver for the given type.
type | The type to get the driver for. |
Definition at line 82 of file driver.h.
Referenced by SelectDriver().
virtual const char* DriverFactoryBase::GetDescription | ( | ) | [pure virtual] |
Get a nice description of the driver-class.
Implemented in FMusicDriver_Allegro, FMusicDriver_BeMidi, FMusicDriver_Cocoa, FMusicDriver_DMusic, FMusicDriver_ExtMidi, FMusicDriver_LibTimidity, FMusicDriver_Null, FMusicDriver_OS2, FMusicDriver_QtMidi, FMusicDriver_Win32, FSoundDriver_Allegro, FSoundDriver_Cocoa, FSoundDriver_Null, FSoundDriver_SDL, FSoundDriver_Win32, FVideoDriver_Allegro, FVideoDriver_Cocoa, FVideoDriver_Dedicated, FVideoDriver_Null, FVideoDriver_SDL, and FVideoDriver_Win32.
Referenced by GetDriversInfo().
char * DriverFactoryBase::GetDriversInfo | ( | char * | p, | |
const char * | last | |||
) | [static] |
Build a human readable list of available drivers, grouped by type.
p | The buffer to write to. | |
last | The last element in the buffer. |
Definition at line 199 of file driver.cpp.
References Driver::DT_BEGIN, GetDescription(), GetDrivers(), GetDriverTypeName(), name, priority, seprintf(), and type.
Referenced by ShowHelp().
static const char* DriverFactoryBase::GetDriverTypeName | ( | Driver::Type | type | ) | [inline, static, private] |
Get the driver type name.
type | The type of driver to get the name of. |
Definition at line 93 of file driver.h.
Referenced by GetDriversInfo(), RegisterDriver(), SelectDriver(), and ~DriverFactoryBase().
void DriverFactoryBase::RegisterDriver | ( | const char * | name, | |
Driver::Type | type, | |||
int | priority | |||
) | [protected] |
Register a driver internally, based on its name.
name | the name of the driver. | |
type | the type of driver to register | |
priority | the priority; how badly do we want this as default? |
Definition at line 173 of file driver.cpp.
References GetDrivers(), GetDriverTypeName(), lastof, and strecpy().
Driver * DriverFactoryBase::SelectDriver | ( | const char * | name, | |
Driver::Type | type | |||
) | [static] |
Find the requested driver and return its class.
name | the driver to select. | |
type | the type of driver to select |
Definition at line 88 of file driver.cpp.
References CreateInstance(), DEBUG, GetActiveDriver(), GetDrivers(), GetDriverTypeName(), lastof, lengthof, name, priority, Driver::Start(), strecpy(), StrEmpty(), type, and usererror().