All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::ResourceLocator Class Reference

This class provides resource location utilities. More...

#include <Radiant/ResourceLocator.hpp>

Public Types

enum  Filter { FILES = (1 << 0), DIRS = (1 << 1), WRITEABLE = (1 << 2), ALL_ENTRIES = FILES & DIRS }
 This enum describes filtering options available to ResourceLocator; e.g. More...
 

Public Member Functions

void addSearchPath (const QString &path, bool inFront=false)
 Add a search path. More...
 
void addSearchPaths (const QStringList &paths, bool inFront=false)
 Add a list of search paths. More...
 
QStringList locate (const QString &path, Filter filter=ALL_ENTRIES) const
 Locate a path. More...
 
 ResourceLocator ()
 Constructs a new ResourceLocator.
 
const QStringList & searchPaths () const
 Get the defined search paths in the resource locator. More...
 
 ~ResourceLocator ()
 Destroys the ResourceLocator.
 

Static Public Member Functions

static void addDefaultSearchPath (const QString &path, bool inFront=false)
 Add a search path, this function is mostly for JavaScript code. More...
 

Detailed Description

This class provides resource location utilities.

This class contains a list of search paths that get searched for files whenever any Qt I/O operation is performed. This includes QFile, QDir, QFileInfo, etc. Other I/O APIs are not affected.

Member Enumeration Documentation

This enum describes filtering options available to ResourceLocator; e.g.

for ResourceLocator::locate(). The filter value is specified by combining values from the following list using bitwise OR operator:

Enumerator
FILES 

List files.

DIRS 

List directories.

WRITEABLE 

List files which the application has write access. Must be combined with Dirs or Files.

ALL_ENTRIES 

List directories and files.

Member Function Documentation

static void Radiant::ResourceLocator::addDefaultSearchPath ( const QString &  path,
bool  inFront = false 
)
inlinestatic

Add a search path, this function is mostly for JavaScript code.

Parameters
pathpath to add
inFrontif true, add to the front of the search list; otherwise add to the end
void Radiant::ResourceLocator::addSearchPath ( const QString &  path,
bool  inFront = false 
)

Add a search path.

Parameters
pathpath to add
inFrontif true, add to the front of the search list; otherwise add to the end
void Radiant::ResourceLocator::addSearchPaths ( const QStringList &  paths,
bool  inFront = false 
)

Add a list of search paths.

Parameters
pathspaths to add
inFrontif true, add to the front of the search list; otherwise add to the end
QStringList Radiant::ResourceLocator::locate ( const QString &  path,
Filter  filter = ALL_ENTRIES 
) const

Locate a path.

Returns a list of matching paths or an empty list if no matches are found.

Parameters
pathpath to search for
filterfilter the search results
Returns
list of matching paths or an empty list
const QStringList& Radiant::ResourceLocator::searchPaths ( ) const

Get the defined search paths in the resource locator.

Returns
list of search paths