xoreos
0.0.5
|
The global 2DA registry, holding all current 2DAs. More...
#include <2dareg.h>
Public Member Functions | |
TwoDARegistry () | |
~TwoDARegistry () | |
void | clear () |
const TwoDAFile & | get2DA (const Common::UString &name) |
Get a certain 2DA, loading it if necessary. More... | |
const GDAFile & | getGDA (const Common::UString &name) |
Get a certain GDA, loading it if necessary. More... | |
const GDAFile & | getMGDA (const Common::UString &prefix) |
Get a certain multiple GDA, loading it if necessary. More... | |
void | add2DA (const Common::UString &name) |
Add a certain 2DA to the registry, reloading it if necessary. More... | |
void | remove2DA (const Common::UString &name) |
Remove a certain 2DA from the registry. More... | |
void | addGDA (const Common::UString &name) |
Add a certain GDA to the registry, reloading it if necessary. More... | |
void | addMGDA (const Common::UString &prefix) |
Add a certain multiple GDA to the registry, reloading it if necessary. More... | |
void | removeGDA (const Common::UString &name) |
Remove a certain GDA from the registry. More... | |
Private Types | |
typedef Common::PtrMap< Common::UString, TwoDAFile > | TwoDAMap |
typedef Common::PtrMap< Common::UString, GDAFile > | GDAMap |
Private Member Functions | |
TwoDAFile * | load2DA (const Common::UString &name) |
GDAFile * | loadGDA (const Common::UString &name) |
GDAFile * | loadMGDA (Common::UString prefix) |
Private Attributes | |
TwoDAMap | _twodas |
GDAMap | _gdas |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< TwoDARegistry > | |
static TwoDARegistry & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< TwoDARegistry > | |
typedef TwoDARegistry | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< TwoDARegistry > | |
Singleton () | |
virtual | ~Singleton () |
The global 2DA registry, holding all current 2DAs.
TwoDARegistry is to be used by the engines to hold and cache 2DAs and GDAs relevant to the current context, so that they don't need to be parsed multiple times for successive uses.
All loaded 2DAs and GDAs will be held in memory until the clear() method is called, which should be done in a moment appropriate for the game. Most likely, this moment is the unloading of a module or campaign, when the context of the current 2DAs/GDAs expires.
TwoDARegistry can also be used to load a so-called MGDA, a concat- enation of multiple GDA files with the same prefix. This is used by the Dragon Age games to allow for multiple GDAs to be used for the same resource type, each GDA holding the information for a range of resources. These GDAs complete each other instead of overwriting each other.
All 2DA and GDA files are directly and automatically loaded from the ResourceManager.
|
private |
|
private |
Aurora::TwoDARegistry::TwoDARegistry | ( | ) |
Definition at line 39 of file 2dareg.cpp.
Aurora::TwoDARegistry::~TwoDARegistry | ( | ) |
Definition at line 42 of file 2dareg.cpp.
References clear().
void Aurora::TwoDARegistry::add2DA | ( | const Common::UString & | name | ) |
Add a certain 2DA to the registry, reloading it if necessary.
Definition at line 99 of file 2dareg.cpp.
References _twodas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and load2DA().
void Aurora::TwoDARegistry::addGDA | ( | const Common::UString & | name | ) |
Add a certain GDA to the registry, reloading it if necessary.
Definition at line 118 of file 2dareg.cpp.
References _gdas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and loadGDA().
void Aurora::TwoDARegistry::addMGDA | ( | const Common::UString & | prefix | ) |
Add a certain multiple GDA to the registry, reloading it if necessary.
Definition at line 128 of file 2dareg.cpp.
References _gdas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and loadMGDA().
void Aurora::TwoDARegistry::clear | ( | ) |
Definition at line 46 of file 2dareg.cpp.
References _gdas, _twodas, and Common::PtrMap< Key, T, Compare, Deallocator >::clear().
Referenced by ~TwoDARegistry().
const TwoDAFile & Aurora::TwoDARegistry::get2DA | ( | const Common::UString & | name | ) |
Get a certain 2DA, loading it if necessary.
Definition at line 51 of file 2dareg.cpp.
References _twodas, and load2DA().
const GDAFile & Aurora::TwoDARegistry::getGDA | ( | const Common::UString & | name | ) |
Get a certain GDA, loading it if necessary.
Definition at line 67 of file 2dareg.cpp.
References _gdas, and loadGDA().
const GDAFile & Aurora::TwoDARegistry::getMGDA | ( | const Common::UString & | prefix | ) |
Get a certain multiple GDA, loading it if necessary.
Definition at line 83 of file 2dareg.cpp.
References _gdas, and loadMGDA().
|
private |
Definition at line 147 of file 2dareg.cpp.
References Common::StackException::add(), Common::UString::c_str(), Aurora::kFileType2DA, Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and ResMan.
Referenced by add2DA(), and get2DA().
|
private |
Definition at line 166 of file 2dareg.cpp.
References Common::StackException::add(), Common::UString::c_str(), Aurora::kFileTypeGDA, Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and ResMan.
Referenced by addGDA(), and getGDA().
|
private |
Definition at line 185 of file 2dareg.cpp.
References Common::StackException::add(), Common::UString::c_str(), Common::UString::empty(), Aurora::kFileTypeGDA, Common::UString::makeLower(), Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and ResMan.
Referenced by addMGDA(), and getMGDA().
void Aurora::TwoDARegistry::remove2DA | ( | const Common::UString & | name | ) |
Remove a certain 2DA from the registry.
Definition at line 109 of file 2dareg.cpp.
References _twodas, and Common::PtrMap< Key, T, Compare, Deallocator >::erase().
void Aurora::TwoDARegistry::removeGDA | ( | const Common::UString & | name | ) |
Remove a certain GDA from the registry.
Definition at line 138 of file 2dareg.cpp.
References _gdas, and Common::PtrMap< Key, T, Compare, Deallocator >::erase().
|
private |
|
private |