XRef provides functionality to resolve relative paths to external.
files into absolute paths
#include <xref.h>
Public Member Functions |
|
void | AddAbsoluteUrl (QString sAbsoluteUrl) |
Adds an absolute url to the
XRef object. |
|
QString | ResolveUrl (const QString &sRelativeUrl) const |
Attempts to resolve the given url to a
absolute url to an existing file or directory. |
|
QStringList | ResolveUrls (const QString &sRelativeUrl) const |
Attempts to resolve the given url to
absolute urls to existing files or directories. |
|
QFileInfoList | ResolveUrls (const QString &sRelativeUrl, const QString &sNameFilter, QDir::Filters eTypeFilters=QDir::Files) const |
Attempts to resolve the given url to
absolute urls to existing files or directories. |
|
Protected Member Functions |
|
virtual | ~XRef () |
Protected Attributes |
|
QVector< QFileInfo > | m_aAbsPaths |
virtual ~XRef | ( | ) | [protected, virtual] |
void AddAbsoluteUrl | ( | QString | sAbsoluteUrl | ) |
QString ResolveUrl | ( | const QString & | sRelativeUrl | ) | const |
Attempts to resolve the given url to a absolute url to an existing file or directory.
If none is found, this method will return the url that was passed in. Note that resolution against the absolute urls takes place in the reverse order that they were added. In other words the last absolute url registered with this object is the first to be checked.
[in] | sRelativeUrl | The relative url to resolve |
QStringList ResolveUrls | ( | const QString & | sRelativeUrl | ) | const |
Attempts to resolve the given url to absolute urls to existing files or directories.
Returns a list of matching urls. If no valid urls are found, this method will return an empty list.
[in] | sRelativeUrl | The relative url to resolve |
QFileInfoList ResolveUrls | ( | const QString & | sRelativeUrl, |
const QString & | sNameFilter, | ||
QDir::Filters | eTypeFilters =
QDir::Files |
||
) | const |
Attempts to resolve the given url to absolute urls to existing files or directories.
Returns a list of matching urls. If no valid urls are found, this method will return an empty list.
For example, say you have the following directory structure: c:/folder1/folder2/file1.png c:/folder1/folder2/file2.tga c:/folder3/folder2/file1.png c:/folder3/folder2/file2.tga
And your code looks like: Kernel()->XRef()->AddAbsoluteUrl( "c:/folder1/" ); Kernel()->XRef()->AddAbsoluteUrl( "c:/folder3/" );
QFileInfoList cList = Kernel()->XRef()->ResolveUrls( "folder2", "*.png" );
cList will contain two elements: c:/folder3/folder2/file1.png c:/folder1/folder2/file1.png
[in] | sRelativeUrl | The relative url to resolve |
[in] | sNameFilter | wildcard pattern to match urls, for example "*.mud" |
[in] | eTypeFilters | The types of directory entries to match. See the QDir docs for more details. |
QVector< QFileInfo > m_aAbsPaths
[protected] |