#include <QString>
#include <QStringList>
#include <QUrl>
#include <QMap>
#include <QVariant>
#include <QLabel>
#include <QTextFormat>
#include <klfdefs.h>
Go to the source code of this file.
Classes | |
class | klfEqualFunc< Value > |
Implements default equality tester with operator==. More... | |
class | klfStrCaseEqualFunc |
implements an equality tester between strings More... | |
struct | __klf_StrArg_MapOp |
struct | KLFMapInitData< Value > |
class | KLFTarget |
class | KLFTargeter |
class | KLFRefPtr< T > |
Stores a pointer to an object with refcount. More... | |
struct | KLFPointerGuard |
class | KLFSyncGuardPtr< T > |
Store a guarded pointer, synchronizing other copies of this pointer. More... | |
struct | KLFVariantConverter< T > |
struct | KLFVariantConverter< QList< T > > |
struct | KLFVariantConverter< QTextCharFormat > |
Defines | |
#define | KLFTOOLS_INIT |
Call this from your main program, so that the klftools resource is initialized. | |
Enumerations | |
enum | KlfUrlCompareFlag { KlfUrlCompareEqual = 0x01, KlfUrlCompareLessSpecific = 0x02, KlfUrlCompareMoreSpecific = 0x04, KlfUrlCompareBaseEqual = 0x08, klfUrlCompareFlagIgnoreQueryItemValueCase = 0x1000000 } |
Some relevant values for klfUrlCompare() More... | |
enum | KlfEnvAction { KlfEnvPathPrepend = 0x0001, KlfEnvPathReplace = 0x0002, KlfEnvPathAppend = 0x0003, KlfEnvPathNoAction = 0x0000, KlfEnvPathActionMask = 0x00ff, KlfEnvPathNoDuplicates = 0x0100, KlfEnvPathFlagsMask = 0xff00, KlfEnvMergeExpandVars = 0x00010000, KlfEnvMergeExpandNotRecursive = 0x00020000, KlfEnvMergeFlagsMask = 0x00ff0000 } |
Used in klfMergeEnvironment() and klfSetEnvironmentPath(). More... | |
Functions | |
KLF_EXPORT bool | klfEnsureDir (const QString &dir) |
Ensure existence of a directory. | |
template<class Key , class Value , class ValCompareFunc > | |
bool | klfMapIsIncludedIn (const QMap< Key, Value > &a, const QMap< Key, Value > &b, ValCompareFunc cfunc=klfEqualFunc< Value >()) |
Compares two QMap's for inclusion. | |
template<class Key > | |
bool | klfMapIsIncludedIn (const QMap< Key, QString > &a, const QMap< Key, QString > &b, Qt::CaseSensitivity cs) |
Compares two QMap's for inclusion (values QString's) | |
KLF_EXPORT uint | klfUrlCompare (const QUrl &url1, const QUrl &url2, uint interestFlags=0xffffffff, const QStringList &interestQueryItems=QStringList()) |
Compares two URLs and returns some flags as to how they differ. | |
KLF_EXPORT bool | klfMatch (const QVariant &testForHitCandidateValue, const QVariant &queryValue, Qt::MatchFlags flags, const QString &queryStringCache=QString()) |
Generalized value matching. | |
template<class T > | |
QVariantList | klfListToVariantList (const QList< T > &list) |
template<class T > | |
QList< T > | klfVariantListToList (const QVariantList &vlist) |
template<class T > | |
QVariantMap | klfMapToVariantMap (const QMap< QString, T > &map) |
template<class T > | |
QMap< QString, T > | klfVariantMapToMap (const QVariantMap &vmap) |
KLF_EXPORT QStringList | klfSearchFind (const QString &wildcard_expression, int limit=-1) |
Find files matching a path with wildcards. | |
KLF_EXPORT QString | klfSearchPath (const QString &prog, const QString &extra_path="") |
Smart executable searching in a given path list with wildcards. | |
KLF_EXPORT QString | klfSearchPath (const QString &fname, const QStringList &path) |
Search for a file withing a list of directories. | |
KLF_EXPORT QString | klfGetEnvironmentVariable (const QStringList &env, const QString &var) |
returns the value of an environment variable, defined in env . | |
KLF_EXPORT void | klfSetEnvironmentVariable (QStringList *env, const QString &var, const QString &value) |
set the value of a variable in environment variables list, replacing existing definition if any. | |
KLF_EXPORT QStringList | klfSetEnvironmentVariable (const QStringList &env, const QString &var, const QString &value) |
set the value of a variable in environment variables list, replacing existing definition if any. | |
KLF_EXPORT QStringList | klfMapToEnvironmentList (const QMap< QString, QString > &map) |
convert a map of variable names to values to an environment list | |
KLF_EXPORT QMap< QString, QString > | klfEnvironmentListToMap (const QStringList &env) |
convert environment list into a map of variable names to values | |
KLF_EXPORT void | klfMergeEnvironment (QStringList *env, const QStringList &addvars, const QStringList &pathvars=QStringList(), uint mergeaction=KlfEnvPathPrepend) |
merge two environment definitions | |
KLF_EXPORT QStringList | klfMergeEnvironment (const QStringList &env, const QStringList &addvars, const QStringList &pathvars=QStringList(), uint mergeaction=KlfEnvPathPrepend) |
merge two environment definitions | |
KLF_EXPORT QStringList | klfGetEnvironmentPath (const QStringList &env, const QString &var=QLatin1String("PATH")) |
get the path items of an environment variable (commonly $PATH) | |
KLF_EXPORT QStringList | klfSplitEnvironmentPath (const QString &value) |
split the value of a PATH-like environment variable into paths (common for $PATH) | |
KLF_EXPORT QString | klfJoinEnvironmentPath (const QStringList &paths) |
join several paths together to form a PATH-like environment variable value (common for $PATH) | |
KLF_EXPORT QString | klfSetEnvironmentPath (const QString &oldpaths, const QString &newpaths, uint action=KlfEnvPathAppend|KlfEnvPathNoDuplicates) |
set/add path items to a PATH-like environment variable (commonly $PATH) | |
KLF_EXPORT QStringList | klfSetEnvironmentPath (const QStringList &oldpaths, const QStringList &newpaths, uint action=KlfEnvPathAppend|KlfEnvPathNoDuplicates) |
set/add path items to a PATH-like environment variable (commonly $PATH) | |
KLF_EXPORT QStringList | klfSetEnvironmentPath (const QStringList &env, const QStringList &newitems, const QString &var=QLatin1String("PATH"), uint action=KlfEnvPathAppend|KlfEnvPathNoDuplicates) |
set/add path items to an environment variable (commonly $PATH) | |
KLF_EXPORT void | klfSetEnvironmentPath (QStringList *env, const QStringList &newitems, const QString &var=QLatin1String("PATH"), uint action=KlfEnvPathAppend|KlfEnvPathNoDuplicates) |
set/add path items to an environment variable (commonly $PATH) | |
KLF_EXPORT QString | klfExpandEnvironmentVariables (const QString &expression, const QStringList &env=QStringList(), bool recursive=true) |
Expands references to environment variables to their values. | |
KLF_EXPORT QStringList | klfCurrentEnvironment () |
Returns the current system's environment. | |
KLF_EXPORT QString | klfPrefixedPath (const QString &path, const QString &reference=QString()) |
Returns absolute path to path as seen from reference . | |
KLF_EXPORT QString | klfUrlLocalFilePath (const QUrl &url) |
template<class T , class MapOp > | |
QList< T > | klfListMap (const QList< T > &list, MapOp op) |
QStringList | klfMapStringList (const QStringList &list, const QString &mapstr) |
template<class T > | |
QList< T > | klfMkList (const T &a) |
template<class T > | |
QList< T > | klfMkList (const T &a, const T &b) |
template<class T > | |
QList< T > | klfMkList (const T &a, const T &b, const T &c) |
template<class T > | |
QList< T > | klfMkList (const T &a, const T &b, const T &c, const T &d) |
template<class Value > | |
QMap< QString, Value > | klfMakeMap (KLFMapInitData< Value > x[]) |
#define KLFTOOLS_INIT |
enum KlfEnvAction |
Used in klfMergeEnvironment() and klfSetEnvironmentPath().
enum KlfUrlCompareFlag |
Some relevant values for klfUrlCompare()
http://host.com/path/to/somewhere/file.php?x=ABC&otherkey=othervalue&x=XYZ and http://host.com/path/to/somewhere/file.php?x=XYZ&otherkey=othervalue
KlfUrlCompareEqual |
Urls are equal. The order of query items may be different, but the same are given with the same values. |
KlfUrlCompareLessSpecific |
Urls have same base URL. All query items in |
KlfUrlCompareMoreSpecific |
Urls have same base URL. All query items in |
KlfUrlCompareBaseEqual |
Urls have same base URL. Query items are ignored. |
klfUrlCompareFlagIgnoreQueryItemValueCase |
This is NOT a specific test. It modifies the behavior of klfUrlCompare() by instructing it to compare query item _values_ in a non-case-sensitive manner (query item name (=key) comparisions are always case sensitive). Namely, with this flag set |
KLF_EXPORT QStringList klfCurrentEnvironment | ( | ) |
Returns the current system's environment.
it is formatted like for klfGetEnvironmentVariable().
Definition at line 621 of file klfutil.cpp.
References QProcess::systemEnvironment().
KLF_EXPORT bool klfEnsureDir | ( | const QString & | dir | ) |
Ensure existence of a directory.
Definition at line 41 of file klfutil.cpp.
References QDir::mkpath(), and QFile::setPermissions().
KLF_EXPORT QMap<QString,QString> klfEnvironmentListToMap | ( | const QStringList & | env | ) |
convert environment list into a map of variable names to values
Definition at line 426 of file klfutil.cpp.
References QMap::contains(), and klfWarning.
KLF_EXPORT QString klfExpandEnvironmentVariables | ( | const QString & | expression, |
const QStringList & | env = QStringList() , |
||
bool | recursive = true |
||
) |
Expands references to environment variables to their values.
Examines expression
, and replaces occurrences of "$VARNAME"
by the value of VARNAME in the environment env
. (env
is expected to be like for klfGetEnvironmentVariable()). If env
is empty, the current environment is queried.
Definition at line 614 of file klfutil.cpp.
Referenced by klfMergeEnvironment().
KLF_EXPORT QStringList klfGetEnvironmentPath | ( | const QStringList & | env, |
const QString & | var = QLatin1String("PATH") |
||
) |
get the path items of an environment variable (commonly $PATH)
Like klfGetEnvironmentVariable(), but splits the result at colons `:' for Unix/Mac and at semicolons for Windows.
Definition at line 473 of file klfutil.cpp.
References klfGetEnvironmentVariable(), and klfSplitEnvironmentPath().
Referenced by klfSetEnvironmentPath().
KLF_EXPORT QString klfGetEnvironmentVariable | ( | const QStringList & | env, |
const QString & | var | ||
) |
returns the value of an environment variable, defined in env
.
env
is expected to be a list of strings, each starting with "VARNAME="
, and the rest being the value, like the output of 'env'
in a terminal.
A null QString() is returned if var
is not defined in env
.
Definition at line 364 of file klfutil.cpp.
References QString::length(), QList::mid(), and QList::size().
Referenced by klfGetEnvironmentPath(), and klfMergeEnvironment().
KLF_EXPORT QString klfJoinEnvironmentPath | ( | const QStringList & | paths | ) |
join several paths together to form a PATH-like environment variable value (common for $PATH)
Definition at line 497 of file klfutil.cpp.
References QStringList::join(), and KLF_PATH_SEP.
Referenced by klfSetEnvironmentPath().
QList<T> klfListMap | ( | const QList< T > & | list, |
MapOp | op | ||
) | [inline] |
Applies operation MapOp
to each element of list list
, and returns the 'mapped' list. This utility can be considered a simplistic version of the 'map' primitive in PERL.
Definition at line 452 of file klfutil.h.
References QList::begin(), and QList::end().
Referenced by klfMapStringList().
QVariantList klfListToVariantList | ( | const QList< T > & | list | ) | [inline] |
Definition at line 172 of file klfutil.h.
References QList::size().
Referenced by KLFVariantConverter< QList< T > >::convert().
QMap<QString, Value> klfMakeMap | ( | KLFMapInitData< Value > | x[] | ) | [inline] |
Definition at line 499 of file klfutil.h.
References QString::fromUtf8(), key, KLFMapInitData< Value >::key, and KLFMapInitData< Value >::value.
bool klfMapIsIncludedIn | ( | const QMap< Key, Value > & | a, |
const QMap< Key, Value > & | b, | ||
ValCompareFunc | cfunc = klfEqualFunc<Value>() |
||
) | [inline] |
Compares two QMap's for inclusion.
returns TRUE if all keys in a
are present in b
, with same values. It is still possible however that map b
contains more keys than a
.
This function uses a general value comparer helper, cfunc
. You can give for example klfEqualFunc or klfStrCaseEqualFunc.
Definition at line 82 of file klfutil.h.
References QMap::begin(), QMap::contains(), QMap::end(), QMap::const_iterator::key(), and QMap::const_iterator::value().
Referenced by klfMapIsIncludedIn(), and klfUrlCompare().
bool klfMapIsIncludedIn | ( | const QMap< Key, QString > & | a, |
const QMap< Key, QString > & | b, | ||
Qt::CaseSensitivity | cs | ||
) | [inline] |
Compares two QMap's for inclusion (values QString's)
Same as klfMapIsIncludedIn(const QMap<Key,Value>&, const QMap<Key,Value>&, ValCompareFunc), except that values have to be QStrings, and that the value comparision is done by comparing strings for equality, with case sensitivity cs
.
Definition at line 101 of file klfutil.h.
References klfMapIsIncludedIn().
QStringList klfMapStringList | ( | const QStringList & | list, |
const QString & | mapstr | ||
) | [inline] |
Applies mapping string mapstr
to each element in list and returns the resulting list. mapstr
is a string that contains a "%1"
that can be used with the QString::arg() function.
Example:
QStringList names = QStringList()<<"Jill"<<"Jenny"<<"Joe"<<"John"; QStringList greetings = klfMapStringList(names, "Hi, my name is %1!") ;
See also QStringList::replaceInStrings().
Definition at line 483 of file klfutil.h.
References klfListMap().
KLF_EXPORT QStringList klfMapToEnvironmentList | ( | const QMap< QString, QString > & | map | ) |
convert a map of variable names to values to an environment list
Definition at line 403 of file klfutil.cpp.
References QMap::begin(), QMap::end(), and QList::value().
QVariantMap klfMapToVariantMap | ( | const QMap< QString, T > & | map | ) | [inline] |
Definition at line 194 of file klfutil.h.
References QMap::begin(), and QMap::end().
KLF_EXPORT bool klfMatch | ( | const QVariant & | testForHitCandidateValue, |
const QVariant & | queryValue, | ||
Qt::MatchFlags | flags, | ||
const QString & | queryStringCache = QString() |
||
) |
Generalized value matching.
This function tests to see if the value testForHitCandidateValue
matches the value queryValue
according to the match flags flags
.
If you call this function repeatedly with the same queryValue
, the query value may be converted (unnecessarily) repeatedly to a string with queryValue.toString()
. To optimize this, you may cache that string and pass each time the string representation for the queryValue
as parameter to queryStringCache
. If however a null string is passed, the conversion is performed automatically.
Definition at line 145 of file klfutil.cpp.
References QString::compare(), QString::contains(), QString::endsWith(), QString::isNull(), QString::startsWith(), and QVariant::toString().
KLF_EXPORT void klfMergeEnvironment | ( | QStringList * | env, |
const QStringList & | addvars, | ||
const QStringList & | pathvars = QStringList() , |
||
uint | mergeaction = KlfEnvPathPrepend |
||
) |
merge two environment definitions
Addes the environment variables specified in addvars
into env, overwriting previous entries for those variables if they already exist.
If some variable names are specified in pathvars
, then those variables will be treated as containing paths like PATH or TEXINPUTS, and the new values will be prepended to the old ones.
Definition at line 443 of file klfutil.cpp.
References QStringList::contains(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, KlfEnvMergeExpandNotRecursive, KlfEnvMergeExpandVars, klfExpandEnvironmentVariables(), klfGetEnvironmentVariable(), klfSetEnvironmentPath(), and klfSetEnvironmentVariable().
Referenced by klfMergeEnvironment().
KLF_EXPORT QStringList klfMergeEnvironment | ( | const QStringList & | env, |
const QStringList & | addvars, | ||
const QStringList & | pathvars = QStringList() , |
||
uint | mergeaction = KlfEnvPathPrepend |
||
) |
merge two environment definitions
Addes the environment variables specified in addvars
into env, overwriting previous entries for those variables if they already exist.
If some variable names are specified in pathvars
, then those variables will be treated as containing paths like PATH or TEXINPUTS, and the new values will be prepended to the old ones.
env
itself is not modified, and the merged list is retured.
Definition at line 463 of file klfutil.cpp.
References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, and klfMergeEnvironment().
KLF_EXPORT QString klfPrefixedPath | ( | const QString & | path, |
const QString & | reference = QString() |
||
) |
Returns absolute path to path
as seen from reference
.
If path
is absolute, then path
is returned as is. Otherwise, an absolute path constructed by concatenating path
to reference
is returned.
If reference
is empty, then the reference is considered to be the application's location, see QCoreApplication::applicationDirPath().
Definition at line 316 of file klfutil.cpp.
References QFileInfo::absoluteFilePath(), QCoreApplication::applicationDirPath(), QString::endsWith(), QDir::homePath(), QFileInfo::isAbsolute(), QString::isEmpty(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, QString::mid(), and QString::startsWith().
KLF_EXPORT QStringList klfSearchFind | ( | const QString & | wildcard_expression, |
int | limit = -1 |
||
) |
Find files matching a path with wildcards.
This function returns at most limit
file names that match the given wildcard_expression
. The latter may be any absolute path in which (any number of) *
and ? wildcards may be placed.
This function splits the wildcard_expression
at '/'
characters, and by starting at the root directory, recursively exploring all directories matching the given section of the pattern. (native '\' separators on windows are appropriately converted to universal '/'
, so you don't have to worry about passing '\'-style paths).
For example, searching for "/usr/lib*
/kde4/kate*.so"
will start looking in the root directory for a directory named "usr"
, in which a directory matching "lib*"
is searched for. In each of those matches, a directory named "kde4"
is searched for, in which files named "lib*.so.*"
are listed. All found matches are returned (up to a given limit
number of entries if limit
is positive).
The drive letter in wildcard_expression
on windows may not contain a wildcard.
Definition at line 243 of file klfutil.cpp.
References QRegExp::exactMatch(), QDir::fromNativeSeparators(), klfDbg, QList::pop_front(), and QString::split().
Referenced by klfSearchPath().
KLF_EXPORT QString klfSearchPath | ( | const QString & | prog, |
const QString & | extra_path = "" |
||
) |
Smart executable searching in a given path list with wildcards.
This function looks for an executable named programName
. It looks in the directories given in argument extra_path
, and in the system environment variable PATH
. extra_path
and PATH
are assumed to be a colon-separated list of directories (semicolon-separated on windows, see KLF_PATH_SEP). Each given directory may contain wildcards (in particular, wildcards in PATH
are also parsed). programName
itself may also contain wildcards.
This function splits extra_path
and PATH
into a directory list, and then, for each directory in that list, calls klfSearchFind() with as argument the string "<directory>/<programName>"
. This function then returns the first result that is an executable file (this check is explicitely performed).
Definition at line 261 of file klfutil.cpp.
References QFileInfo::exists(), QFileInfo::isAbsolute(), QString::isEmpty(), QFileInfo::isExecutable(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, KLF_PATH_SEP, klfDbg, klfSearchFind(), QList::size(), and QString::split().
KLF_EXPORT QString klfSearchPath | ( | const QString & | fname, |
const QStringList & | path | ||
) |
Search for a file withing a list of directories.
very much like klfSearchPath(const QString&, const QString&), except that it is not explicitely targeted at searching for executables. Just look for a file named 'fname' in the given path list. Both 'path' and 'fname' may contain klfSearchFind()-compatible wildcards.
Definition at line 294 of file klfutil.cpp.
References QFile::exists(), KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, klfSearchFind(), and QList::size().
KLF_EXPORT QString klfSetEnvironmentPath | ( | const QString & | oldpaths, |
const QString & | newpaths, | ||
uint | action = KlfEnvPathAppend|KlfEnvPathNoDuplicates |
||
) |
set/add path items to a PATH-like environment variable (commonly $PATH)
This function only processes changes to the variable value. You will still need to use klfSetEnvironmentVariable() to apply that change to an environment.
See KlfEnvAction enum for possible actions.
oldpaths | a colon-separated list of paths of "old" values. don't include the variable name. |
newpaths | a colon-separated list of paths of "new" values. don't include the variable name. |
Definition at line 548 of file klfutil.cpp.
References KLF_PATH_SEP, klfSetEnvironmentPath(), and klfSplitEnvironmentPath().
KLF_EXPORT QStringList klfSetEnvironmentPath | ( | const QStringList & | oldpaths, |
const QStringList & | newpaths, | ||
uint | action = KlfEnvPathAppend|KlfEnvPathNoDuplicates |
||
) |
set/add path items to a PATH-like environment variable (commonly $PATH)
This function only processes changes to the variable value. You will still need to use klfSetEnvironmentVariable() to apply that change to an environment.
See KlfEnvAction enum for possible actions.
oldpaths | a list of paths of "old" values. |
newpaths | a list of paths of "new" values. |
Definition at line 514 of file klfutil.cpp.
References QList::append(), QStringList::contains(), KlfEnvPathActionMask, KlfEnvPathAppend, KlfEnvPathNoAction, KlfEnvPathNoDuplicates, KlfEnvPathPrepend, KlfEnvPathReplace, klfWarning, and QList::size().
Referenced by klfMergeEnvironment(), and klfSetEnvironmentPath().
KLF_EXPORT QStringList klfSetEnvironmentPath | ( | const QStringList & | env, |
const QStringList & | newitems, | ||
const QString & | var = QLatin1String("PATH") , |
||
uint | action = KlfEnvPathAppend|KlfEnvPathNoDuplicates |
||
) |
set/add path items to an environment variable (commonly $PATH)
See KlfEnvPathAction enum for possible actions.
env
itself is not changed. Definition at line 555 of file klfutil.cpp.
References klfGetEnvironmentPath(), klfJoinEnvironmentPath(), klfSetEnvironmentPath(), and klfSetEnvironmentVariable().
KLF_EXPORT void klfSetEnvironmentPath | ( | QStringList * | env, |
const QStringList & | newitems, | ||
const QString & | var = QLatin1String("PATH") , |
||
uint | action = KlfEnvPathAppend|KlfEnvPathNoDuplicates |
||
) |
set/add path items to an environment variable (commonly $PATH)
See KlfEnvPathAction enum for possible actions.
Modifies env
directly.
Definition at line 563 of file klfutil.cpp.
References klfGetEnvironmentPath(), klfJoinEnvironmentPath(), klfSetEnvironmentPath(), and klfSetEnvironmentVariable().
KLF_EXPORT void klfSetEnvironmentVariable | ( | QStringList * | env, |
const QString & | var, | ||
const QString & | value | ||
) |
set the value of a variable in environment variables list, replacing existing definition if any.
If variable var
exists in env
, then its definition is replaced. If it does not exist, a definition for var
is appended to env
.
env
is expected to be in the form described in klfGetEnvironmentVariable().
Definition at line 378 of file klfutil.cpp.
References QList::append(), QList::size(), and QList::startsWith().
Referenced by klfMergeEnvironment(), klfSetEnvironmentPath(), and klfSetEnvironmentVariable().
KLF_EXPORT QStringList klfSetEnvironmentVariable | ( | const QStringList & | env, |
const QString & | var, | ||
const QString & | value | ||
) |
set the value of a variable in environment variables list, replacing existing definition if any.
Same as klfSetEnvironmentVariable(QStringList *, const QString&, const QString&), except this function does not modify the original list and returns the new one.
env
itself is not changed. Definition at line 395 of file klfutil.cpp.
References klfSetEnvironmentVariable().
KLF_EXPORT QStringList klfSplitEnvironmentPath | ( | const QString & | value | ) |
split the value of a PATH-like environment variable into paths (common for $PATH)
Do NOT specify the variable name (i.e. "VARNAME=") in the value.
Definition at line 480 of file klfutil.cpp.
References QString::isEmpty(), QList::isEmpty(), KLF_PATH_SEP, QList::removeAt(), QList::size(), and QString::split().
Referenced by klfGetEnvironmentPath(), and klfSetEnvironmentPath().
KLF_EXPORT uint klfUrlCompare | ( | const QUrl & | url1, |
const QUrl & | url2, | ||
uint | interestFlags = 0xffffffff , |
||
const QStringList & | interestQueryItems = QStringList() |
||
) |
Compares two URLs and returns some flags as to how they differ.
The return value is an binary-OR'ed value of flags given in KlfUrlCompareFlag.
If the interestFlag
parameter is set, only the tests that are given in interestFlags
are performed. The returned flags are those flags set in interestFlags
that are true.
If the interestQueryItems
is set, all query items other than those specified in interestQueryItems
are ignored. If interestQueryItems
is an empty list, no query items are ignored, they are all taken into account.
Definition at line 78 of file klfutil.cpp.
References KLF_DEBUG_BLOCK, KLF_FUNC_NAME, klfDbg, klfMapIsIncludedIn(), KlfUrlCompareBaseEqual, KlfUrlCompareEqual, klfUrlCompareFlagIgnoreQueryItemValueCase, KlfUrlCompareLessSpecific, KlfUrlCompareMoreSpecific, and QUrl::setQuery().
KLF_EXPORT QString klfUrlLocalFilePath | ( | const QUrl & | url | ) |
Returns the file path represented in url
, interpreted as an (absolute) path to a local file.
On windows, this ensures that there is no slash preceeding the drive letter, eg. fixes "/C:/..." to "C:/...", but keeps forward-slashes.
Definition at line 634 of file klfutil.cpp.
References QString::mid(), QUrl::path(), and QString::startsWith().
QList<T> klfVariantListToList | ( | const QVariantList & | vlist | ) | [inline] |
Definition at line 184 of file klfutil.h.
References QList::value().
QMap<QString, T> klfVariantMapToMap | ( | const QVariantMap & | vmap | ) | [inline] |
Definition at line 205 of file klfutil.h.
References QMap::value().