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... | |
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.
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. |
|
inlinestatic |
Add a search path, this function is mostly for JavaScript code.
| path | path to add |
| inFront | if 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.
| path | path to add |
| inFront | if 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.
| paths | paths to add |
| inFront | if 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.
| path | path to search for |
| filter | filter the search results |
| const QStringList& Radiant::ResourceLocator::searchPaths | ( | ) | const |
Get the defined search paths in the resource locator.