Visualization Library 2.1.0
A 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. More... | |
const std::vector< ref< ResourceLoadWriter > > & | loadWriters () const |
Returns the set of registered ResourceLoadWriter objects. More... | |
template<class T > | |
T * | loadWriter () |
Returns the first ResourceLoadWriter of the specified type found. More... | |
bool | canLoad (const String &path) const |
Returns true if there is a ResourceLoadWriter registered to load the specified path or extension. More... | |
bool | canLoad (VirtualFile *file) const |
Returns true if there is a ResourceLoadWriter registered to load the specified file. More... | |
bool | canWrite (const String &path) const |
Returns true if there is a ResourceLoadWriter registered to write the specified path or extension. More... | |
bool | canWrite (VirtualFile *file) const |
Returns true if there is a ResourceLoadWriter registered to write the specified file. More... | |
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. More... | |
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. More... | |
const ResourceLoadWriter * | findLoader (VirtualFile *file) const |
Returns the ResourceLoadWriter that has been registered to load the resource type specified by the given file. More... | |
const ResourceLoadWriter * | findWriter (VirtualFile *file) const |
Returns the ResourceLoadWriter that has been registered to write the resource type specified by the given file. More... | |
ref< ResourceDatabase > | loadResource (const String &path, bool quick=true) const |
Loads the resource specified by the given path using the appropriate ResourceLoadWriter. More... | |
ref< ResourceDatabase > | loadResource (VirtualFile *file, bool quick=true) const |
Loads the resource specified by the given file using the appropriate ResourceLoadWriter. More... | |
bool | writeResource (const String &path, ResourceDatabase *resource) const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter. More... | |
bool | writeResource (VirtualFile *file, ResourceDatabase *resource) const |
Writes the resource specified by the given file using the appropriate ResourceLoadWriter. More... | |
const std::vector< ref< LoadCallback > > & | loadCallbacks () const |
const std::vector< ref< WriteCallback > > & | writeCallbacks () const |
std::vector< ref< LoadCallback > > & | loadCallbacks () |
std::vector< ref< WriteCallback > > & | writeCallbacks () |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Attributes | |
std::vector< ref< ResourceLoadWriter > > | mLoadWriters |
std::vector< ref< LoadCallback > > | mLoadCallbacks |
std::vector< ref< WriteCallback > > | mWriteCallbacks |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
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.
|
inline |
Definition at line 65 of file LoadWriterManager.hpp.
References vl::registerLoadWriter().
|
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().
|
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().
|
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().
|
inline |
Returns true if there is a ResourceLoadWriter registered to write the specified file.
Definition at line 101 of file LoadWriterManager.hpp.
References vl::loadResource(), NULL, vl::VirtualFile::path(), and vl::writeResource().
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::ResourceLoadWriter::canLoad(), vl::String::extractFileExtension(), loadWriters(), NULL, and vl::String::toLowerCase().
Referenced by findLoader(), and loadResource().
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 | ( | 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 168 of file LoadWriterManager.cpp.
References vl::String::extractFileExtension(), loadWriters(), NULL, and vl::String::toLowerCase().
Referenced by findWriter(), and writeResource().
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().
|
inline |
Definition at line 127 of file LoadWriterManager.hpp.
Referenced by loadResource().
|
inline |
Definition at line 131 of file LoadWriterManager.hpp.
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::String::left(), vl::locateFile(), NULL, vl::VirtualFile::path(), vl::VirtualFile::setPath(), and vl::GZipCodec::setStream().
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::MemoryFile::allocateBuffer(), 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::MemoryFile::ptr(), vl::VirtualFile::read(), vl::VirtualFile::setPath(), and vl::VirtualFile::size().
|
inline |
Returns the first ResourceLoadWriter of the specified type found.
Definition at line 80 of file LoadWriterManager.hpp.
References NULL.
|
inline |
Returns the set of registered ResourceLoadWriter objects.
Definition at line 73 of file LoadWriterManager.hpp.
Referenced by findLoader(), findWriter(), and registerLoadWriter().
|
inline |
Returns the set of registered ResourceLoadWriter objects.
Definition at line 76 of file LoadWriterManager.hpp.
void LoadWriterManager::registerLoadWriter | ( | ResourceLoadWriter * | load_writer | ) |
Definition at line 178 of file LoadWriterManager.cpp.
References loadWriters().
Referenced by vl::registerLoadWriter().
|
inline |
Definition at line 129 of file LoadWriterManager.hpp.
Referenced by writeResource().
|
inline |
Definition at line 133 of file LoadWriterManager.hpp.
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().
|
protected |
Definition at line 137 of file LoadWriterManager.hpp.
|
protected |
Definition at line 136 of file LoadWriterManager.hpp.
|
protected |
Definition at line 138 of file LoadWriterManager.hpp.
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:51.
© Copyright Michele Bosi. All rights reserved.