#include <XFuConfigurationData.h>
Inheritance diagram for XFuConfigurationData:
Public Member Functions | |
virtual | ~XFuConfigurationData () |
Virtual destructor. | |
virtual CHAR * | get (const CHAR *aKey) |
Returns the value of a property as a string, or NULL if not found. | |
virtual XFcGLResourceSurface * | getImage (const CHAR *aKey) |
Returns a configuration data image by key, or NULL if not found. | |
virtual XFuPrinter * | getPrinter (const CHAR *aKey) |
Returns a configuration data printer by key, or NULL if not found. | |
virtual XFuConfigurationDataSoundInfo * | getSound (const CHAR *aKey) |
Returns a configuration data sound info by key, or NULL if not found. | |
virtual XFuConfigurationDataMusicInfo * | getMusic (const CHAR *aKey) |
Returns a configuration data music info by key, or NULL if not found. | |
virtual INT | getRectangle (XFcRectangle &aDest, const CHAR *aKey) |
Gets a property value by key, and then parses and returns the value as a rectangle. | |
virtual void | put (const CHAR *aKey, const CHAR *aValue) |
Sets the value of a property. | |
virtual INT | load (const CHAR *aFilename) |
Loads new configuration file and merges its data to the current set. | |
virtual INT | load (XFcFile *aFile) |
Loads new configuration file and merges its data to the current set. | |
void | setDeferredLoadingEnabled (INT aEnabled) |
Sets deferred loading mode status. | |
Static Public Member Functions | |
XFuConfigurationData * | create () |
Static constructor. | |
XFuConfigurationData * | create (const CHAR *aFilename) |
Static constructor. | |
XFuConfigurationData * | create (XFcFile *aFile) |
Static constructor. | |
XFcRectangle | parseRectangleString (const CHAR *aValue) |
Parses a rectangle value string. | |
Protected Types | |
typedef XFcHashtable< XFuStringKey, XFcGLResourceSurface * > | ImageSet |
Internal image container type. | |
typedef XFcHashtable< XFuStringKey, XFuPrinter * > | PrinterSet |
Internal printer container type. | |
typedef XFcHashtable< XFuStringKey, XFuConfigurationDataSoundInfo * > | SoundSet |
Internal sound info container type. | |
typedef XFcHashtable< XFuStringKey, XFuConfigurationDataMusicInfo * > | MusicSet |
Internal music info container type. | |
Protected Member Functions | |
XFuConfigurationData () | |
Protected constructor. | |
INT | init () |
Initializes a newly constructed object. | |
void | addImage (const CHAR *aValue) |
Adds and possibly loads a new image to the internal image container. | |
void | addPrinter (const CHAR *aValue) |
Adds and possibly loads a new printer to the internal printer container. | |
void | addSound (const CHAR *aValue) |
Adds a new sound to the internal sound container. | |
void | addMusic (const CHAR *aValue) |
Adds a new music to the internal music container. | |
void | loadImage (ImageSet::iterator &aIterator) |
Loads a new image to the internal image container. | |
void | loadPrinter (PrinterSet::iterator &aIterator) |
Loads a new printer to the internal printer container. | |
CHAR * | makePrefixedKey (const CHAR aPrefix, const CHAR *aKey) |
Allocates and returns a new key with a specified prefix char. | |
Protected Attributes | |
INT | mDeferredLoadingEnabled |
Non-zero if deferred loading is enabled. | |
ImageSet * | mImages |
Internal image container. | |
PrinterSet * | mPrinters |
Internal printer container. | |
SoundSet * | mSounds |
Internal sound container. | |
MusicSet * | mMusics |
Internal music container. |
Reads and parses a set of configuration data keys from a file. The format of the configuration file is such that there is one property on each row in a text file. Each property is a pair of a key and a value, delimited by a '=' char, for example:
fileName = HelloWorld.xff
Optionally the key can also have a type prefix which is delimited from the rest of the key with a ':' (colon) char, for example:
image : cursor = arrow.tga
Builtin types have getType-style methods which can be used to read the data easily by the key omitting the type prefix. Builtin types also have both long and short forms of the type, so the previous example could be also written:
i:cursor = arrow.tga
Leading and trailing spaces are trimmed. Lines starting with character '#' are treated as comment lines and are ignored. Optional parts of value strings can be omitted.
Recognized builtin types:
Long Type | Short Type | Value String Format and Description
|
---|---|---|
image | i | Value string: filename,type
image:menu.cursor = arrow.tga i:splash = splash.tga
|
printer | p | Value string: filename,spacing,type,colorkey
printer:menu.printer = smallfont.tga,0,1,#0000ff p:digitprinter = digits.tga,2,0
|
sound | s | Value string: filename,samplingrate,volume,panning,priority,looping,loopstart,loopend
sound:menu.select = menuselect.wav s:menu.move = menumove.wav,-1,0.5
|
music | m | Value string: filename,samplingrate,chanmode,bitmode,volume,priority
music:menumusic = menu.xm,16000,0,0,0.3,0 music:gamemusic = game.xm,8000,0,0,0.15,0
|
XFcGLResourceSurface
XFcRectangle
XFcAudio
Definition at line 204 of file XFuConfigurationData.h.
|
Internal image container type.
Definition at line 321 of file XFuConfigurationData.h. Referenced by init(). |
|
Internal music info container type.
Definition at line 330 of file XFuConfigurationData.h. Referenced by init(). |
|
Internal printer container type.
Definition at line 324 of file XFuConfigurationData.h. Referenced by init(). |
|
Internal sound info container type.
Definition at line 327 of file XFuConfigurationData.h. Referenced by init(). |
|
Virtual destructor.
Definition at line 102 of file XFuConfigurationData.cpp. References XFuConfiguration::clear(), mImages, mMusics, mPrinters, and mSounds. |
|
Protected constructor.
Definition at line 33 of file XFuConfigurationData.cpp. |
|
Adds and possibly loads a new image to the internal image container.
Definition at line 320 of file XFuConfigurationData.cpp. References loadImage(), mDeferredLoadingEnabled, and mImages. Referenced by put(). |
|
Adds a new music to the internal music container.
Definition at line 486 of file XFuConfigurationData.cpp. References XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), XFuConfigurationDataMusicInfo::m16Bit, XFuConfigurationDataMusicInfo::mFilename, XFuConfigurationDataMusicInfo::mFlags, mMusics, XFuConfigurationDataMusicInfo::mPriority, XFuConfigurationDataMusicInfo::mSamplingRate, XFuConfigurationDataMusicInfo::mStereo, XFuConfigurationDataMusicInfo::mVolume, XFuTokenizer::tokenize(), XFUCDAIF_PRIORITY, XFUCDAIF_SAMPLING_RATE, and XFUCDAIF_VOLUME. Referenced by put(). |
|
Adds and possibly loads a new printer to the internal printer container.
Definition at line 367 of file XFuConfigurationData.cpp. References loadPrinter(), mDeferredLoadingEnabled, and mPrinters. Referenced by put(). |
|
Adds a new sound to the internal sound container.
Definition at line 425 of file XFuConfigurationData.cpp. References XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), XFuConfigurationDataSoundInfo::mFilename, XFuConfigurationDataSoundInfo::mFlags, XFuConfigurationDataSoundInfo::mLoopEnd, XFuConfigurationDataSoundInfo::mLooping, XFuConfigurationDataSoundInfo::mLoopStart, XFuConfigurationDataSoundInfo::mPanning, XFuConfigurationDataSoundInfo::mPriority, XFuConfigurationDataSoundInfo::mSamplingRate, mSounds, XFuConfigurationDataSoundInfo::mVolume, XFuTokenizer::tokenize(), XFUCDAIF_LOOPEND, XFUCDAIF_LOOPING, XFUCDAIF_LOOPSTART, XFUCDAIF_PANNING, XFUCDAIF_PRIORITY, XFUCDAIF_SAMPLING_RATE, and XFUCDAIF_VOLUME. Referenced by put(). |
|
Static constructor.
Reimplemented from XFuConfiguration. Definition at line 66 of file XFuConfigurationData.cpp. |
|
Static constructor.
Reimplemented from XFuConfiguration. Definition at line 51 of file XFuConfigurationData.cpp. |
|
Static constructor.
Reimplemented from XFuConfiguration. Definition at line 39 of file XFuConfigurationData.cpp. References init(). Referenced by create(). |
|
Returns the value of a property as a string, or NULL if not found.
Reimplemented from XFuConfiguration. Definition at line 137 of file XFuConfigurationData.cpp. References XFuConfiguration::get(). Referenced by getImage(), getMusic(), getPrinter(), getRectangle(), and getSound(). |
|
Returns a configuration data image by key, or NULL if not found.
Definition at line 152 of file XFuConfigurationData.cpp. References get(), loadImage(), makePrefixedKey(), and mImages. |
|
Returns a configuration data music info by key, or NULL if not found.
Definition at line 235 of file XFuConfigurationData.cpp. References get(), makePrefixedKey(), and mMusics. |
|
Returns a configuration data printer by key, or NULL if not found.
Definition at line 169 of file XFuConfigurationData.cpp. References get(), loadPrinter(), makePrefixedKey(), and mPrinters. |
|
Gets a property value by key, and then parses and returns the value as a rectangle.
Rectangle value string format:
rectangle:laptime.position = 10,10 r:viewport = 4,4,160,120
Definition at line 208 of file XFuConfigurationData.cpp. References get(), and parseRectangleString(). |
|
Returns a configuration data sound info by key, or NULL if not found.
Definition at line 222 of file XFuConfigurationData.cpp. References get(), makePrefixedKey(), and mSounds. |
|
Initializes a newly constructed object.
Definition at line 81 of file XFuConfigurationData.cpp. References ImageSet, mImages, mMusics, mPrinters, mSounds, MusicSet, PrinterSet, and SoundSet. Referenced by create(). |
|
Loads new configuration file and merges its data to the current set.
Reimplemented from XFuConfiguration. Definition at line 255 of file XFuConfigurationData.cpp. References XFuConfiguration::load(). |
|
Loads new configuration file and merges its data to the current set.
Reimplemented from XFuConfiguration. Definition at line 248 of file XFuConfigurationData.cpp. References XFuConfiguration::load(). Referenced by create(). |
|
Loads a new image to the internal image container.
Definition at line 338 of file XFuConfigurationData.cpp. References XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), and XFuTokenizer::tokenize(). Referenced by addImage(), and getImage(). |
|
Loads a new printer to the internal printer container.
Definition at line 385 of file XFuConfigurationData.cpp. References XFuRLESpritePrinter::create(), XFuPrinter::create(), XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), XFuPrinter::setLetterSpacing(), and XFuTokenizer::tokenize(). Referenced by addPrinter(), and getPrinter(). |
|
Allocates and returns a new key with a specified prefix char.
Definition at line 144 of file XFuConfigurationData.cpp. Referenced by getImage(), getMusic(), getPrinter(), and getSound(). |
|
Parses a rectangle value string.
Definition at line 186 of file XFuConfigurationData.cpp. References XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), and XFuTokenizer::tokenize(). Referenced by getRectangle(). |
|
Sets the value of a property. If the key contains a type prefix delimited by ':' character from the rest of the key, and the type is a recognized builtin type, the value is parsed and possibly loaded according to the type. Properties with recognized builtin types can be accessed with type specific getType-style method. If the possible type prefix is unrecognized then the value must be accessed with get-method.
Reimplemented from XFuConfiguration. Definition at line 262 of file XFuConfigurationData.cpp. References addImage(), addMusic(), addPrinter(), addSound(), XFuTokenizer::getToken(), XFuTokenizer::getTokenCount(), XFuConfiguration::put(), XFuTokenizer::tokenize(), XFUCD_TYPE_IMAGE_SHORT_CHAR, XFUCD_TYPE_MUSIC_SHORT_CHAR, XFUCD_TYPE_PRINTER_SHORT_CHAR, and XFUCD_TYPE_SOUND_SHORT_CHAR. |
|
Sets deferred loading mode status. When deferred loading mode is enabled, all recognized object types held by this configuration data container are loaded only when an object is requested for the first time. By default deferred loading is disabled and all recognized types are loaded on load of a configuration file. Deferred loading must be enabled before calling load. Definition at line 521 of file XFuConfigurationData.cpp. References mDeferredLoadingEnabled. |
|
Non-zero if deferred loading is enabled.
Definition at line 358 of file XFuConfigurationData.h. Referenced by addImage(), addPrinter(), and setDeferredLoadingEnabled(). |
|
Internal image container.
Definition at line 360 of file XFuConfigurationData.h. Referenced by addImage(), getImage(), init(), and ~XFuConfigurationData(). |
|
Internal music container.
Definition at line 363 of file XFuConfigurationData.h. Referenced by addMusic(), getMusic(), init(), and ~XFuConfigurationData(). |
|
Internal printer container.
Definition at line 361 of file XFuConfigurationData.h. Referenced by addPrinter(), getPrinter(), init(), and ~XFuConfigurationData(). |
|
Internal sound container.
Definition at line 362 of file XFuConfigurationData.h. Referenced by addSound(), getSound(), init(), and ~XFuConfigurationData(). |
![]() | ||||
![]() |
Confidential Copyright © 2002-2003 Fathammer | with doxygen by Dimitri van Heesch |