X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresourcemanager.h;h=e7c8c04b3224d87b3eff51686013b9536d2d90a1;hb=da5629982b65a4cbf31abc30a0cf930801fcc940;hp=a2a4975db5185eaf3eadf7348e995f9a0b4ca5b7;hpb=508319df28270eccdfa03a880a8604549278a139;p=libs%2Fgl.git diff --git a/source/resourcemanager.h b/source/resourcemanager.h index a2a4975d..e7c8c04b 100644 --- a/source/resourcemanager.h +++ b/source/resourcemanager.h @@ -16,6 +16,7 @@ class ResourceWatcher; class resource_load_error: public std::runtime_error { public: + resource_load_error(const std::string &, const std::string &); resource_load_error(const std::string &, const std::exception &); virtual ~resource_load_error() throw() { } }; @@ -31,6 +32,15 @@ public: LOAD_MANUALLY }; + struct ResourceLocation + { + DataFile::Collection *collection; + std::string name; + + ResourceLocation(); + ResourceLocation(DataFile::Collection &, const std::string &); + }; + private: struct ManagedResource { @@ -45,8 +55,7 @@ private: }; Resource *resource; - DataFile::Collection *collection; - std::string name; + ResourceLocation location; IO::Seekable *io; Resource::AsyncLoader *loader; State state; @@ -126,7 +135,10 @@ public: void add_resource(Resource &); void *get_data_for_resource(const Resource &); void set_resource_location(Resource &, DataFile::Collection &, const std::string &); + void set_resource_location(Resource &, const ResourceLocation &); + const ResourceLocation *get_resource_location(const Resource &) const; void load_resource(Resource &); + bool is_resource_loaded(const Resource &) const; void resource_used(const Resource &); void remove_resource(Resource &);