zenilib
0.5.3.0
|
A Texture Database Singleton. More...
#include <Database.h>
Inherited by Zeni::Sounds.
Public Member Functions | |
Database (const String &filename, const String &xml_identifier) | |
virtual | ~Database () |
void | clear (const String &name, const String &filename="") |
Clear an entry. More... | |
void | clear () |
Permanently clear all resources. More... | |
unsigned long | find (const String &name) const |
Get an id by name, without throwing an Error. More... | |
bool | find (const unsigned long &id) const |
Check to see that an id is valid. More... | |
unsigned long | get_id (const String &name) const |
Get an id by name, possibly throwing an Error. More... | |
unsigned long | give (const String &name, TYPE *const &type, const bool &keep, const String &filename="") |
Add an entry (which it will later delete) More... | |
unsigned long | lend (const String &name, TYPE *const &type, const bool &keep) |
Add an entry (which it will NEVER delete) More... | |
void | load_file (const String &filename) |
Load all resources from a given file, giving them highest priority. More... | |
void | lose_resources () |
Wipe losable resources and prepare to reload them when they are next needed. More... | |
const bool & | lost_resources () |
Check to see if resources have been lost. More... | |
TYPE & | operator[] (const String &name) const |
Get a TYPE by name. More... | |
TYPE & | operator[] (const unsigned long &id) const |
Get a TYPE by id. More... | |
void | reload () |
lose_resources + init More... | |
void | unload_file (const String &filename) |
Unload all resources from a given file, reloading lower priority resources. More... | |
void | unlose_resources () |
If resources have been lost, then reload them. More... | |
Protected Member Functions | |
bool | give_priority (const String &name, const bool &lent, const bool &keep, const String &filename="") |
If 'lent', 'keep', and 'filename' match, give priority over other 'name' entries. More... | |
void | init () |
void | uninit () |
Contact: bazal d@ze nipex .com
Definition at line 46 of file Database.h.
Zeni::Database< TYPE >::Database | ( | const String & | filename, |
const String & | xml_identifier | ||
) |
Definition at line 78 of file Database.hxx.
|
virtual |
Definition at line 86 of file Database.hxx.
void Zeni::Database< TYPE >::clear | ( | const String & | name, |
const String & | filename = "" |
||
) |
Clear an entry.
Definition at line 145 of file Database.hxx.
void Zeni::Database< TYPE >::clear | ( | ) |
Permanently clear all resources.
Definition at line 220 of file Database.hxx.
unsigned long Zeni::Database< TYPE >::find | ( | const String & | name | ) | const |
Get an id by name, without throwing an Error.
Definition at line 182 of file Database.hxx.
bool Zeni::Database< TYPE >::find | ( | const unsigned long & | id | ) | const |
Check to see that an id is valid.
Definition at line 192 of file Database.hxx.
unsigned long Zeni::Database< TYPE >::get_id | ( | const String & | name | ) | const |
Get an id by name, possibly throwing an Error.
Definition at line 172 of file Database.hxx.
Referenced by Zeni::Sprite::apply_Texture(), Zeni::decrement_sprite_frame(), Zeni::Sprite::get_size(), Zeni::increment_sprite_frame(), Zeni::Material::set(), and Zeni::Material::set_Texture().
unsigned long Zeni::Database< TYPE >::give | ( | const String & | name, |
TYPE *const & | type, | ||
const bool & | keep, | ||
const String & | filename = "" |
||
) |
Add an entry (which it will later delete)
Definition at line 91 of file Database.hxx.
References Zeni::Resource::assign(), and Zeni::get_Resource().
|
protected |
If 'lent', 'keep', and 'filename' match, give priority over other 'name' entries.
Definition at line 354 of file Database.hxx.
References Zeni::Database< TYPE >::Lookup::Handle::ptr.
|
protected |
Definition at line 314 of file Database.hxx.
References ZENI_LOGD().
unsigned long Zeni::Database< TYPE >::lend | ( | const String & | name, |
TYPE *const & | type, | ||
const bool & | keep | ||
) |
Add an entry (which it will NEVER delete)
Definition at line 118 of file Database.hxx.
References Zeni::Resource::assign(), and Zeni::get_Resource().
void Zeni::Database< TYPE >::load_file | ( | const String & | filename | ) |
Load all resources from a given file, giving them highest priority.
Definition at line 225 of file Database.hxx.
References Zeni::String::c_str(), error, sort_controllers::filename, Zeni::XML_Element_c::first(), Zeni::XML_Element_c::good(), Zeni::File_Ops::load_asset(), Zeni::XML_Document::load_mem(), Zeni::message_box(), and TYPE.
void Zeni::Database< TYPE >::lose_resources | ( | ) |
Wipe losable resources and prepare to reload them when they are next needed.
Definition at line 386 of file Database.hxx.
const bool & Zeni::Database< TYPE >::lost_resources | ( | ) |
Check to see if resources have been lost.
Definition at line 381 of file Database.hxx.
Referenced by Zeni::Textures::set_texturing_mode().
TYPE & Zeni::Database< TYPE >::operator[] | ( | const String & | name | ) | const |
Get a TYPE by name.
Definition at line 215 of file Database.hxx.
TYPE & Zeni::Database< TYPE >::operator[] | ( | const unsigned long & | id | ) | const |
Get a TYPE by id.
Definition at line 197 of file Database.hxx.
void Zeni::Database< TYPE >::reload | ( | ) |
lose_resources + init
Definition at line 308 of file Database.hxx.
References init().
Referenced by Zeni::Textures::set_texturing_mode().
|
protected |
Definition at line 330 of file Database.hxx.
void Zeni::Database< TYPE >::unload_file | ( | const String & | filename | ) |
Unload all resources from a given file, reloading lower priority resources.
Definition at line 269 of file Database.hxx.
References sort_controllers::filename.
void Zeni::Database< TYPE >::unlose_resources | ( | ) |
If resources have been lost, then reload them.
Definition at line 415 of file Database.hxx.
References init().
Referenced by Zeni::Video_GL_Fixed::begin_prerender(), Zeni::Video_GL_Shader::begin_prerender(), and Zeni::Video_DX9::begin_prerender().