Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Static Private Member Functions | Private Attributes

BlitterFactory Class Reference

The base factory, keeping track of all blitters. More...

#include <factory.hpp>

Inheritance diagram for BlitterFactory:
FBlitter_32bppAnim FBlitter_32bppOptimized FBlitter_32bppSimple FBlitter_8bppOptimized FBlitter_8bppSimple FBlitter_Null

Public Member Functions

const char * GetName () const
 Get the long, human readable, name for the Blitter-class.
const char * GetDescription () const
 Get a nice description of the blitter-class.
virtual BlitterCreateInstance ()=0
 Create an instance of this Blitter-class.

Static Public Member Functions

static BlitterSelectBlitter (const char *name)
 Find the requested blitter and return his class.
static BlitterFactoryGetBlitterFactory (const char *name)
 Get the blitter factory with the given name.
static BlitterGetCurrentBlitter ()
 Get the current active blitter (always set by calling SelectBlitter).
static char * GetBlittersInfo (char *p, const char *last)
 Fill a buffer with information about the blitters.

Protected Member Functions

 BlitterFactory (const char *name, const char *description, bool usable=true)
 Construct the blitter, and register it.

Private Types

typedef std::map< const char
*, BlitterFactory
*, StringCompare
Blitters
 Map of blitter factories.

Static Private Member Functions

static BlittersGetBlitters ()
 Get the map with currently known blitters.
static Blitter ** GetActiveBlitter ()
 Get the currently active blitter.

Private Attributes

const char * name
 The name of the blitter factory.
const char * description
 The description of the blitter.

Detailed Description

The base factory, keeping track of all blitters.

Definition at line 28 of file factory.hpp.


Constructor & Destructor Documentation

BlitterFactory::BlitterFactory ( const char *  name,
const char *  description,
bool  usable = true 
) [inline, protected]

Construct the blitter, and register it.

Parameters:
name The name of the blitter.
description A longer description for the blitter.
usable Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them.
Precondition:
name != NULL.
description != NULL.
There is no blitter registered with this name.

Definition at line 65 of file factory.hpp.

References DEBUG, and GetBlitters().


Member Function Documentation

static Blitter** BlitterFactory::GetActiveBlitter (  )  [inline, static, private]

Get the currently active blitter.

Returns:
The currently active blitter.

Definition at line 49 of file factory.hpp.

Referenced by GetCurrentBlitter(), and SelectBlitter().

static BlitterFactory* BlitterFactory::GetBlitterFactory ( const char *  name  )  [inline, static]

Get the blitter factory with the given name.

Parameters:
name the blitter factory to select.
Returns:
The blitter factory, or NULL when there isn't one with the wanted name.

Definition at line 114 of file factory.hpp.

References GetBlitters(), name, and StrEmpty().

Referenced by SelectBlitter(), and SwitchNewGRFBlitter().

static Blitters& BlitterFactory::GetBlitters (  )  [inline, static, private]

Get the map with currently known blitters.

Returns:
The known blitters.

Definition at line 39 of file factory.hpp.

Referenced by BlitterFactory(), GetBlitterFactory(), and GetBlittersInfo().

static char* BlitterFactory::GetBlittersInfo ( char *  p,
const char *  last 
) [inline, static]

Fill a buffer with information about the blitters.

Parameters:
p The buffer to fill.
last The last element of the buffer.
Returns:
p The location till where we filled the buffer.

Definition at line 158 of file factory.hpp.

References GetBlitters(), GetDescription(), name, and seprintf().

Referenced by ShowHelp().

static Blitter* BlitterFactory::SelectBlitter ( const char *  name  )  [inline, static]

Find the requested blitter and return his class.

Parameters:
name the blitter to select.
Postcondition:
Sets the blitter so GetCurrentBlitter() returns it too.

Definition at line 96 of file factory.hpp.

References CreateInstance(), DEBUG, GetActiveBlitter(), GetBlitterFactory(), Blitter::GetName(), and StrEmpty().

Referenced by openttd_main(), VideoDriver_Null::Start(), and SwitchNewGRFBlitter().


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