DriverFactoryBase Class Reference

Inheritance diagram for DriverFactoryBase:
MusicDriverFactoryBase SoundDriverFactoryBase VideoDriverFactoryBase MusicDriverFactory< T > MusicDriverFactory< FMusicDriver_Allegro > MusicDriverFactory< FMusicDriver_BeMidi > MusicDriverFactory< FMusicDriver_Cocoa > MusicDriverFactory< FMusicDriver_DMusic > MusicDriverFactory< FMusicDriver_ExtMidi > MusicDriverFactory< FMusicDriver_LibTimidity > MusicDriverFactory< FMusicDriver_Null > MusicDriverFactory< FMusicDriver_OS2 > MusicDriverFactory< FMusicDriver_QtMidi > MusicDriverFactory< FMusicDriver_Win32 > SoundDriverFactory< T > SoundDriverFactory< FSoundDriver_Allegro > SoundDriverFactory< FSoundDriver_Cocoa > SoundDriverFactory< FSoundDriver_Null > SoundDriverFactory< FSoundDriver_SDL > SoundDriverFactory< FSoundDriver_Win32 > VideoDriverFactory< T > VideoDriverFactory< FVideoDriver_Allegro > VideoDriverFactory< FVideoDriver_Cocoa > VideoDriverFactory< FVideoDriver_Dedicated > VideoDriverFactory< FVideoDriver_Null > VideoDriverFactory< FVideoDriver_SDL > VideoDriverFactory< FVideoDriver_Win32 >

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 DriverCreateInstance ()=0
 Create an instance of this driver-class.

Static Public Member Functions

static void ShutdownDrivers ()
 Shuts down all active drivers.
static DriverSelectDriver (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

Static Private Member Functions

static Drivers & GetDrivers ()
static Driver ** GetActiveDriver (Driver::Type type)
static const char * GetDriverTypeName (Driver::Type type)

Private Attributes

Driver::Type type
const char * name
int priority

Detailed Description

Definition at line 46 of file driver.h.


Member Function Documentation

void DriverFactoryBase::RegisterDriver ( const char *  name,
Driver::Type  type,
int  priority 
) [protected]

Register a driver internally, based on its name.

Parameters:
name the name of the driver.
type the type of driver to register
priority the priority; how badly do we want this as default?
Note:
an assert() will be trigger if 2 driver with the same name try to register.

Definition at line 153 of file driver.cpp.

References lastof, and strecpy().

Driver * DriverFactoryBase::SelectDriver ( const char *  name,
Driver::Type  type 
) [static]

Find the requested driver and return its class.

Parameters:
name the driver to select.
type the type of driver to select
Postcondition:
Sets the driver so GetCurrentDriver() returns it too.

Definition at line 68 of file driver.cpp.

References CreateInstance(), lastof, lengthof, strecpy(), StrEmpty(), and usererror().


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

Generated on Wed Apr 21 20:32:26 2010 for OpenTTD by  doxygen 1.6.1