32 #ifndef ResourceDatabase_INCLUDE_ONCE 33 #define ResourceDatabase_INCLUDE_ONCE 55 VL_DEBUG_SET_OBJECT_NAME()
58 const std::vector< ref<Object> >&
resources()
const {
return mResources; }
60 std::vector< ref<Object> >&
resources() {
return mResources; }
64 T*
next(
int& cur_pos)
const 66 for(
unsigned i=cur_pos; i<mResources.size(); ++i)
68 ref<T> r = cast<T>(mResources[i].get());
80 void get( std::vector< ref<T> >& resources,
bool clear_vector=true )
85 for(
unsigned i=0; i<mResources.size(); ++i )
87 ref<T> r = cast<T>(mResources[i].get());
89 resources.push_back(r);
95 void extract( std::vector<
ref<T> >& resources,
bool clear_vector=
true )
100 size_t start = resources.size();
102 for(
unsigned i=mResources.size(); i--; )
104 ref<T> r = cast<T>(mResources[i].get());
107 resources.push_back(r);
108 mResources.erase(mResources.begin()+i);
112 std::reverse(resources.begin()+start, resources.end());
120 for(
unsigned i=0; i<mResources.size(); ++i)
122 const T* r = cast_const<T>(mResources[i].get());
131 const T*
get(
int j)
const 134 for(
unsigned i=0; i<mResources.size(); ++i)
136 const T* r = cast_const<T>(mResources[i].get());
153 for(
unsigned i=0; i<mResources.size(); ++i)
155 T* r = cast<T>(mResources[i].get());
VLCORE_EXPORT bool canLoad(const String &path)
Short version of defLoadWriterManager()->canLoad(path).
std::vector< ref< Object > > mResources
std::vector< ref< Object > > & resources()
An abstract class representing a file.
T * next(int &cur_pos) const
Starts to look for the next object of the specified type from the given position. ...
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
size_t count() const
Don't use inside loops! Counts the number object of the specified type.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
VLCORE_EXPORT ref< ResourceDatabase > loadResource(const String &path, bool quick=true)
Short version of defLoadWriterManager()->loadResource(path, quick).
Visualization Library main namespace.
const std::vector< ref< Object > > & resources() const
The base class for all the reference counted objects.
VLCORE_EXPORT bool canWrite(const String &path)
Short version of defLoadWriterManager()->canWrite(path).
void extract(std::vector< ref< T > > &resources, bool clear_vector=true)
Returns all the objects of the specified type in the given vector and removes them from the ResourceD...
The ref<> class is used to reference-count an Object.
VLCORE_EXPORT bool writeResource(const String &path, ResourceDatabase *resource)
Short version of defLoadWriterManager()->writeResource(path, resource).
The ResourceDatabase class contains and manipulates a set of resources.