Browse Source

Ability to easily get pointer to data from Resource.

Neither operator*() nor operator->() can be used to pass plain pointer
to function or store it in variable. Now it should be converted
automatically.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
45f349644f
  1. 6
      src/ResourceManager.h

6
src/ResourceManager.h

@ -345,6 +345,12 @@ template<class T, class U = T> class Resource {
return static_cast<U*>(data);
}
/** @brief %Resource data */
inline operator U*() {
acquire();
return static_cast<U*>(data);
}
private:
inline Resource(Implementation::ResourceManagerData<T>* manager, ResourceKey key): manager(manager), _key(key), lastCheck(0), _state(ResourceState::NotLoaded), data(nullptr) {
manager->incrementReferenceCount(key);

Loading…
Cancel
Save