Go to the documentation of this file.
29 #include <QStringList>
36 #include <QTextFormat>
54 bool operator()(
const Value& a,
const Value& b) {
return a == b; }
66 Qt::CaseSensitivity cs;
81 template<
class Key,
class Value,
class ValCompareFunc>
86 for (iter = a.
begin(); iter != a.
end(); ++iter) {
176 for (k = 0; k < list.
size(); ++k)
177 l << QVariant::fromValue<T>(list[k]);
188 for (k = 0; k < vlist.size(); ++k) {
189 list << vlist[k].
value<T>();
198 vmap[it.key()] = QVariant::fromValue<T>(it.value());
208 for (QVariantMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) {
209 map[it.key()] = it.
value().value<T>();
420 bool recursive =
true);
451 template<
class T,
class MapOp>
495 template<
class Value>
498 template<
class Value>
503 for (k = 0; x[k].
key != NULL; ++k) {
527 virtual void setTarget(
KLFTarget *target);
637 const T *
ptr()
const {
return p; }
644 klfDbg(
"new pointer: "<<newptr<<
"; old pointer was "<<p) ;
660 autodelete = other.autodelete;
696 inline operator T *()
698 inline operator const T *()
const
716 template<
class OtherPtr>
717 inline OtherPtr
dyn_cast() {
return dynamic_cast<OtherPtr>(p); }
719 template<
class OtherPtr>
720 inline const OtherPtr
dyn_cast()
const {
return dynamic_cast<const OtherPtr>(p); }
723 {
return (
void *)p == otherptr; }
726 {
return p == otherptr.p; }
736 void operator+=(
int ) { }
737 void operator-=(
int ) { }
749 klfDbg(p<<
": deref()! n="<<n<<
"; autodelete="<<autodelete) ;
750 if (autodelete && n <= 0) {
751 klfDbg(
"Deleting at refcount="<<n<<
".") ;
762 klfDbg(p<<
": ref()! n="<<n) ;
784 int ref() {
return ++refcount; }
785 int deref() {
return --refcount; }
851 ptrguard = copy.ptrguard;
860 if (ptrguard == NULL)
867 inline operator const T*()
892 if (ptrguard != NULL) {
893 klfWarning(
"Leaving tracked pointer "<<ptrguard->
ptr<<
" for another pointer!") ;
897 ptrguard->
ptr = (
void*)p;
905 ptrguard = copy.ptrguard;
911 if (ptrguard != NULL)
912 ptrguard->
ptr = NULL;
949 return QVariant::fromValue<T>(value);
953 return variant.
value<T>();
964 return klfVariantListToList<T>(variant.
toList());
971 return QVariant::fromValue<QTextFormat>(value);
985 #define KLFTOOLS_INIT \
986 Q_INIT_RESOURCE(klftoolsres)
implements an equality tester between strings
KLF_EXPORT QString klfSearchPath(const QString &prog, const QString &extra_path="")
Smart executable searching in a given path list with wildcards.
Remove duplicates from the variable.
KLF_EXPORT bool klfMatch(const QVariant &testForHitCandidateValue, const QVariant &queryValue, Qt::MatchFlags flags, const QString &queryStringCache=QString())
Generalized value matching.
Replace current path items by given ones.
QMap< QString, Value > klfMakeMap(KLFMapInitData< Value > x[])
KLF_EXPORT QString klfPrefixedPath(const QString &path, const QString &reference=QString())
Returns absolute path to path as seen from reference.
A Base class for storing abstract position data.
Merge environments by expanding new values according to current environment.
bool contains(const Key &key) const
QString fromUtf8(const char *str, int size)
bool operator()(const QString &a, const QString &b)
KLF_EXPORT QStringList klfSplitEnvironmentPath(const QString &value)
split the value of a PATH-like environment variable into paths (common for $PATH)
Append given path items to current list.
const T value(const Key &key, const T &defaultValue) const
Store a guarded pointer, synchronizing other copies of this pointer.
KlfUrlCompareFlag
Some relevant values for klfUrlCompare()
Pointer operator=(Pointer p)
bool klfMapIsIncludedIn(const QMap< Key, Value > &a, const QMap< Key, Value > &b, ValCompareFunc cfunc=klfEqualFunc< Value >())
Compares two QMap's for inclusion.
Urls have same base URL. Query items are ignored.
KLF_EXPORT QStringList klfCurrentEnvironment()
Returns the current system's environment.
QStringList klfMapStringList(const QStringList &list, const QString &mapstr)
Stores a pointer to an object with refcount.
If we're expanding new environment variables, don't expand them recursively.
KLF_EXPORT QStringList klfGetEnvironmentPath(const QStringList &env, const QString &var=QLatin1String("PATH"))
get the path items of an environment variable (commonly $PATH)
Urls are equal. The order of query items may be different, but the same are given with the same value...
bool operator!=(void *otherptr) const
#define klfDbg(streamableItems)
print debug stream items
QList< T > klfMkList(const T &a)
KLF_EXPORT bool klfEnsureDir(const QString &dir)
Ensure existence of a directory.
KLF_EXPORT void klfMergeEnvironment(QStringList *env, const QStringList &addvars, const QStringList &pathvars=QStringList(), uint mergeaction=KlfEnvPathPrepend)
merge two environment definitions
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)
void setAutoDelete(bool on)
#define KLF_DEBUG_BLOCK(msg)
Utility to debug the execution of a block.
KLFRefPtr< T > & operator=(const KLFRefPtr< T > &other)
QMap< QString, T > klfVariantMapToMap(const QVariantMap &vmap)
KLF_EXPORT QString klfExpandEnvironmentVariables(const QString &expression, const QStringList &env=QStringList(), bool recursive=true)
Expands references to environment variables to their values.
Urls have same base URL. All query items in url1 are present in url2 with the same values,...
QList< T > klfListMap(const QList< T > &list, MapOp op)
QList< T > klfVariantListToList(const QVariantList &vlist)
KLF_EXPORT QString klfUrlLocalFilePath(const QUrl &url)
KLF_EXPORT QStringList klfMapToEnvironmentList(const QMap< QString, QString > &map)
convert a map of variable names to values to an environment list
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.
QVariantMap klfMapToVariantMap(const QMap< QString, T > &map)
static QVariant convert(const T &value)
KLF_EXPORT QString klfGetEnvironmentVariable(const QStringList &env, const QString &var)
returns the value of an environment variable, defined in env.
QString operator()(const QString &str)
KLF_EXPORT QStringList klfSearchFind(const QString &wildcard_expression, int limit=-1)
Find files matching a path with wildcards.
#define klfWarning(streamableItems)
KLF_EXPORT QString klfJoinEnvironmentPath(const QStringList &paths)
join several paths together to form a PATH-like environment variable value (common for $PATH)
void setPointer(Pointer newptr)
#define KLF_ASSERT_CONDITION(expr, msg, failaction)
Asserting Conditions (NON-FATAL)
This is NOT a specific test. It modifies the behavior of klfUrlCompare() by instructing it to compare...
Mask out the requested action.
klfStrCaseEqualFunc(Qt::CaseSensitivity caseSensitive)
QList< QVariant > toList() const
KLF_EXPORT QMap< QString, QString > klfEnvironmentListToMap(const QStringList &env)
convert environment list into a map of variable names to values
Mask out the merge actions flags.
Don't take any action, just apply flags.
KlfEnvAction
Used in klfMergeEnvironment() and klfSetEnvironmentPath().
__klf_StrArg_MapOp(const QString &t)
bool operator()(const Value &a, const Value &b)
bool operator==(void *otherptr) const
Implements default equality tester with operator==.
Prepend given value to list of path items.
int compare(const QString &other, Qt::CaseSensitivity cs) const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const
Urls have same base URL. All query items in url2 are present in url1 with the same values,...
Base declarations for klatexformula and some utilities.
QVariantList klfListToVariantList(const QList< T > &list)
static T recover(const QVariant &variant)
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.
Generated by doxygen 1.8.16