Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The LoadWriterManager class loads and writes resources using the registered ResourceLoadWriter objects. More...
#include <LoadWriterManager.hpp>
Public Member Functions | |
LoadWriterManager () | |
void | registerLoadWriter (ResourceLoadWriter *) |
std::vector< ref < ResourceLoadWriter > > & | loadWriters () |
Returns the set of registered ResourceLoadWriter objects. | |
const std::vector< ref < ResourceLoadWriter > > & | loadWriters () const |
Returns the set of registered ResourceLoadWriter objects. | |
template<class T > | |
T * | loadWriter () |
Returns the first ResourceLoadWriter of the specified type found. | |
bool | canLoad (const String &path) const |
Returns true if there is a ResourceLoadWriter registered to load the specified path or extension. | |
bool | canLoad (VirtualFile *file) const |
Returns true if there is a ResourceLoadWriter registered to load the specified file. | |
bool | canWrite (const String &path) const |
Returns true if there is a ResourceLoadWriter registered to write the specified path or extension. | |
bool | canWrite (VirtualFile *file) const |
Returns true if there is a ResourceLoadWriter registered to write the specified file. | |
const ResourceLoadWriter * | findLoader (const String &path) const |
Returns the ResourceLoadWriter that has been registered to load the resource type specified by the given path or extension. | |
const ResourceLoadWriter * | findWriter (const String &path) const |
Returns the ResourceLoadWriter that has been registered to write the resource type specified by the given path or extension. | |
const ResourceLoadWriter * | findLoader (VirtualFile *file) const |
Returns the ResourceLoadWriter that has been registered to load the resource type specified by the given file. | |
const ResourceLoadWriter * | findWriter (VirtualFile *file) const |
Returns the ResourceLoadWriter that has been registered to write the resource type specified by the given file. | |
ref< ResourceDatabase > | loadResource (const String &path, bool quick=true) const |
Loads the resource specified by the given path using the appropriate ResourceLoadWriter. | |
ref< ResourceDatabase > | loadResource (VirtualFile *file, bool quick=true) const |
Loads the resource specified by the given file using the appropriate ResourceLoadWriter. | |
bool | writeResource (const String &path, ResourceDatabase *resource) const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter. | |
bool | writeResource (VirtualFile *file, ResourceDatabase *resource) const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter. | |
const std::vector< ref < LoadCallback > > & | loadCallbacks () const |
const std::vector< ref < WriteCallback > > & | writeCallbacks () const |
std::vector< ref< LoadCallback > > & | loadCallbacks () |
std::vector< ref < WriteCallback > > & | writeCallbacks () |
Protected Attributes | |
std::vector< ref < ResourceLoadWriter > > | mLoadWriters |
std::vector< ref< LoadCallback > > | mLoadCallbacks |
std::vector< ref< WriteCallback > > | mWriteCallbacks |
The LoadWriterManager class loads and writes resources using the registered ResourceLoadWriter objects.
You can install a LoadCallback to operate on loaded data or you can install a WriteCallback to operate on the data to be written, using the methods loadCallbacks() and writeCallbacks().
Definition at line 60 of file LoadWriterManager.hpp.
vl::LoadWriterManager::LoadWriterManager | ( | ) | [inline] |
Definition at line 65 of file LoadWriterManager.hpp.
References VL_DEBUG_SET_OBJECT_NAME.
void LoadWriterManager::registerLoadWriter | ( | ResourceLoadWriter * | load_writer ) |
Definition at line 176 of file LoadWriterManager.cpp.
References loadWriters().
Referenced by vl::registerLoadWriter().
std::vector< ref<ResourceLoadWriter> >& vl::LoadWriterManager::loadWriters | ( | ) | [inline] |
Returns the set of registered ResourceLoadWriter objects.
Definition at line 73 of file LoadWriterManager.hpp.
Referenced by findLoader(), findWriter(), and registerLoadWriter().
const std::vector< ref<ResourceLoadWriter> >& vl::LoadWriterManager::loadWriters | ( | ) | const [inline] |
Returns the set of registered ResourceLoadWriter objects.
Definition at line 76 of file LoadWriterManager.hpp.
T* vl::LoadWriterManager::loadWriter | ( | ) | [inline] |
Returns the first ResourceLoadWriter of the specified type found.
Definition at line 80 of file LoadWriterManager.hpp.
References NULL.
bool vl::LoadWriterManager::canLoad | ( | const String & | path ) | const [inline] |
Returns true if there is a ResourceLoadWriter registered to load the specified path or extension.
Definition at line 92 of file LoadWriterManager.hpp.
References NULL.
Referenced by vl::canLoad().
bool vl::LoadWriterManager::canLoad | ( | VirtualFile * | file ) | const [inline] |
Returns true if there is a ResourceLoadWriter registered to load the specified file.
Definition at line 95 of file LoadWriterManager.hpp.
References NULL, and vl::VirtualFile::path().
bool vl::LoadWriterManager::canWrite | ( | const String & | path ) | const [inline] |
Returns true if there is a ResourceLoadWriter registered to write the specified path or extension.
Definition at line 98 of file LoadWriterManager.hpp.
References NULL.
Referenced by vl::canWrite().
bool vl::LoadWriterManager::canWrite | ( | VirtualFile * | file ) | const [inline] |
Returns true if there is a ResourceLoadWriter registered to write the specified file.
Definition at line 101 of file LoadWriterManager.hpp.
References NULL, and vl::VirtualFile::path().
const ResourceLoadWriter * LoadWriterManager::findLoader | ( | const String & | path ) | const |
Returns the ResourceLoadWriter that has been registered to load the resource type specified by the given path or extension.
Definition at line 156 of file LoadWriterManager.cpp.
References vl::String::extractFileExtension(), loadWriters(), NULL, and vl::String::toLowerCase().
Referenced by findLoader(), and loadResource().
const ResourceLoadWriter * LoadWriterManager::findWriter | ( | const String & | path ) | const |
Returns the ResourceLoadWriter that has been registered to write the resource type specified by the given path or extension.
Definition at line 166 of file LoadWriterManager.cpp.
References vl::String::extractFileExtension(), loadWriters(), NULL, and vl::String::toLowerCase().
Referenced by findWriter(), and writeResource().
const ResourceLoadWriter * LoadWriterManager::findLoader | ( | VirtualFile * | file ) | const |
Returns the ResourceLoadWriter that has been registered to load the resource type specified by the given file.
Definition at line 41 of file LoadWriterManager.cpp.
References vl::String::empty(), findLoader(), vl::VirtualFile::path(), and vl::Log::warning().
const ResourceLoadWriter * LoadWriterManager::findWriter | ( | VirtualFile * | file ) | const |
Returns the ResourceLoadWriter that has been registered to write the resource type specified by the given file.
Definition at line 48 of file LoadWriterManager.cpp.
References vl::String::empty(), findWriter(), vl::VirtualFile::path(), and vl::Log::warning().
ref< ResourceDatabase > LoadWriterManager::loadResource | ( | const String & | path, |
bool | quick = true |
||
) | const |
Loads the resource specified by the given path using the appropriate ResourceLoadWriter.
Definition at line 55 of file LoadWriterManager.cpp.
References vl::Log::debug(), vl::String::endsWith(), vl::ref< T >::get(), vl::locateFile(), and NULL.
Referenced by vl::loadImage(), and vl::loadResource().
ref< ResourceDatabase > LoadWriterManager::loadResource | ( | VirtualFile * | file, |
bool | quick = true |
||
) | const |
Loads the resource specified by the given file using the appropriate ResourceLoadWriter.
Definition at line 89 of file LoadWriterManager.cpp.
References vl::VirtualFile::close(), vl::Log::error(), findLoader(), vl::ref< T >::get(), loadCallbacks(), vl::ResourceLoadWriter::loadResource(), NULL, vl::OM_ReadOnly, vl::VirtualFile::open(), vl::VirtualFile::path(), vl::VirtualFile::read(), and vl::VirtualFile::size().
bool LoadWriterManager::writeResource | ( | const String & | path, |
ResourceDatabase * | resource | ||
) | const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter.
Definition at line 120 of file LoadWriterManager.cpp.
References vl::Log::error(), findWriter(), writeCallbacks(), and vl::ResourceLoadWriter::writeResource().
Referenced by vl::saveImage(), and vl::writeResource().
bool LoadWriterManager::writeResource | ( | VirtualFile * | file, |
ResourceDatabase * | resource | ||
) | const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter.
Definition at line 138 of file LoadWriterManager.cpp.
References vl::Log::error(), findWriter(), vl::VirtualFile::path(), writeCallbacks(), and vl::ResourceLoadWriter::writeResource().
const std::vector< ref<LoadCallback> >& vl::LoadWriterManager::loadCallbacks | ( | ) | const [inline] |
Definition at line 127 of file LoadWriterManager.hpp.
Referenced by loadResource().
const std::vector< ref<WriteCallback> >& vl::LoadWriterManager::writeCallbacks | ( | ) | const [inline] |
Definition at line 129 of file LoadWriterManager.hpp.
Referenced by writeResource().
std::vector< ref<LoadCallback> >& vl::LoadWriterManager::loadCallbacks | ( | ) | [inline] |
Definition at line 131 of file LoadWriterManager.hpp.
std::vector< ref<WriteCallback> >& vl::LoadWriterManager::writeCallbacks | ( | ) | [inline] |
Definition at line 133 of file LoadWriterManager.hpp.
std::vector< ref<ResourceLoadWriter> > vl::LoadWriterManager::mLoadWriters [protected] |
Definition at line 136 of file LoadWriterManager.hpp.
std::vector< ref<LoadCallback> > vl::LoadWriterManager::mLoadCallbacks [protected] |
Definition at line 137 of file LoadWriterManager.hpp.
std::vector< ref<WriteCallback> > vl::LoadWriterManager::mWriteCallbacks [protected] |
Definition at line 138 of file LoadWriterManager.hpp.