32 #ifndef ZENI_DATABASE_H
33 #define ZENI_DATABASE_H
51 Handle(
TYPE *
const &ptr_,
const String &filename_,
const bool &lent_,
const bool &keep_);
61 typedef std::list<Handle> Handles;
65 Lookup(
const Lookup &);
66 Lookup & operator=(
const Lookup &);
70 Lookup(
const unsigned long &id_,
const Handle &handle_);
76 typedef std::list<String> Filenames;
90 bool find(
const unsigned long &
id)
const;
116 virtual void on_load() {}
117 virtual void on_clear() {}
118 virtual void on_lose() {}
120 virtual TYPE * load(XML_Element_c &xml_element,
const String &
name,
const String &
filename) = 0;
122 String m_xml_identifier;
125 #pragma warning( push )
126 #pragma warning( disable : 4251 )
128 Filenames m_filenames;
132 #pragma warning( pop )
void lose_resources()
Wipe losable resources and prepare to reload them when they are next needed.
unsigned long give(const String &name, TYPE *const &type, const bool &keep, const String &filename="")
Add an entry (which it will later delete)
unsigned long lend(const String &name, TYPE *const &type, const bool &keep)
Add an entry (which it will NEVER delete)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Database_Load_Entry_Failed(const String &identifier)
unsigned long get_id(const String &name) const
Get an id by name, possibly throwing an Error.
EGLImageKHR EGLint * name
void reload()
lose_resources + init
void load_file(const String &filename)
Load all resources from a given file, giving them highest priority.
A Texture Database Singleton.
void clear()
Permanently clear all resources.
Database_File_Not_Loaded(const String &identifier)
TYPE & operator[](const String &name) const
Get a TYPE by name.
bool operator==(const Handle &rhs) const
unsigned long find(const String &name) const
Get an id by name, without throwing an Error.
void unlose_resources()
If resources have been lost, then reload them.
const bool & lost_resources()
Check to see if resources have been lost.
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. ...
Database_Entry_Not_Found(const String &identifier)
void unload_file(const String &filename)
Unload all resources from a given file, reloading lower priority resources.
Null_Database_Entry_Set()