Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::ResourceLoadWriter Class Referenceabstract

The ResourceLoadWriter class is an abstract class used to implement read/write support for one or more resource types. More...

#include <ResourceLoadWriter.hpp>

+ Inheritance diagram for vl::ResourceLoadWriter:

Public Member Functions

 ResourceLoadWriter (const String &load_extensions, const String &write_extensions)
 
virtual ref< ResourceDatabaseloadResource (const String &path) const =0
 
virtual ref< ResourceDatabaseloadResource (VirtualFile *file) const =0
 
virtual bool writeResource (const String &path, ResourceDatabase *resource) const =0
 
virtual bool writeResource (VirtualFile *file, ResourceDatabase *resource) const =0
 
bool canLoad (const String &extension) const
 Returns true if the given file type can be loaded. More...
 
const StringloadExtensions () const
 Returns the string containing the file types that can be loaded. More...
 
void setLoadExtensions (const String &extensions)
 Sets the set of file extensions that can be loaded. More...
 
bool canWrite (const String &extension) const
 Returns true if the given file type can be written. More...
 
const StringwriteExtensions () const
 Returns the string containing the file types that can be written. More...
 
void setWriteExtensions (const String &extensions)
 Sets the set of file extensions that can be written. More...
 
- 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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

String mLoadExtensions
 
String mWriteExtensions
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The ResourceLoadWriter class is an abstract class used to implement read/write support for one or more resource types.

Definition at line 44 of file ResourceLoadWriter.hpp.

Constructor & Destructor Documentation

◆ ResourceLoadWriter()

vl::ResourceLoadWriter::ResourceLoadWriter ( const String load_extensions,
const String write_extensions 
)
inline

Definition at line 49 of file ResourceLoadWriter.hpp.

References loadResource(), and writeResource().

Member Function Documentation

◆ canLoad()

bool vl::ResourceLoadWriter::canLoad ( const String extension) const
inline

Returns true if the given file type can be loaded.

Note that the check is not case sensitive.

Definition at line 58 of file ResourceLoadWriter.hpp.

References vl::String::find(), mLoadExtensions, and vl::String::toLowerCase().

Referenced by vl::LoadWriterManager::findLoader().

◆ canWrite()

bool vl::ResourceLoadWriter::canWrite ( const String extension) const
inline

Returns true if the given file type can be written.

Note that the check is not case sensitive.

Definition at line 72 of file ResourceLoadWriter.hpp.

References vl::String::find(), mWriteExtensions, and vl::String::toLowerCase().

◆ loadExtensions()

const String& vl::ResourceLoadWriter::loadExtensions ( ) const
inline

Returns the string containing the file types that can be loaded.

The extensions returned are always lower-case.

Definition at line 62 of file ResourceLoadWriter.hpp.

References mLoadExtensions.

◆ loadResource() [1/2]

virtual ref<ResourceDatabase> vl::ResourceLoadWriter::loadResource ( const String path) const
pure virtual

◆ loadResource() [2/2]

virtual ref<ResourceDatabase> vl::ResourceLoadWriter::loadResource ( VirtualFile file) const
pure virtual

◆ setLoadExtensions()

void vl::ResourceLoadWriter::setLoadExtensions ( const String extensions)
inline

Sets the set of file extensions that can be loaded.

The string must be of the form "|.ext1|.ext2|.ext3|" for example "|.jpg|.png|.gif|". Note that the file extension matching is non case sensitive, so for example the above extension includes also files with the following extensions: .JPG .Png, GiF and so on.

Definition at line 68 of file ResourceLoadWriter.hpp.

References mLoadExtensions, and vl::String::toLowerCase().

◆ setWriteExtensions()

void vl::ResourceLoadWriter::setWriteExtensions ( const String extensions)
inline

Sets the set of file extensions that can be written.

The string must be of the form "|.ext1|.ext2|.ext3|" for example "|.jpg|.png|.gif|". Note that the file extension matching is non case sensitive, so for example the above extension includes also files with the following extensions: .JPG .Png, GiF and so on.

Definition at line 82 of file ResourceLoadWriter.hpp.

References mWriteExtensions, and vl::String::toLowerCase().

◆ writeExtensions()

const String& vl::ResourceLoadWriter::writeExtensions ( ) const
inline

Returns the string containing the file types that can be written.

The extensions returned are always lower-case.

Definition at line 76 of file ResourceLoadWriter.hpp.

References mWriteExtensions.

◆ writeResource() [1/2]

virtual bool vl::ResourceLoadWriter::writeResource ( const String path,
ResourceDatabase resource 
) const
pure virtual

◆ writeResource() [2/2]

virtual bool vl::ResourceLoadWriter::writeResource ( VirtualFile file,
ResourceDatabase resource 
) const
pure virtual

Member Data Documentation

◆ mLoadExtensions

String vl::ResourceLoadWriter::mLoadExtensions
protected

Definition at line 85 of file ResourceLoadWriter.hpp.

Referenced by canLoad(), loadExtensions(), and setLoadExtensions().

◆ mWriteExtensions

String vl::ResourceLoadWriter::mWriteExtensions
protected

Definition at line 86 of file ResourceLoadWriter.hpp.

Referenced by canWrite(), setWriteExtensions(), and writeExtensions().


The documentation for this class was generated from the following file: