[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfutil.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfutil.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klfutil.h 983 2016-12-31 21:03:44Z phfaist $ */
23 
24 
25 #ifndef KLFUTIL_H
26 #define KLFUTIL_H
27 
28 #include <QString>
29 #include <QStringList>
30 #include <QUrl>
31 #include <QMap>
32 #include <QVariant>
33 //#include <QProgressDialog>
34 #include <QLabel>
35 //#include <QDomElement>
36 #include <QTextFormat>
37 
38 #include <klfdefs.h>
39 
40 
42 KLF_EXPORT bool klfEnsureDir(const QString& dir);
43 
44 
46 
50 template<class Value>
52 {
53 public:
54  bool operator()(const Value& a, const Value& b) { return a == b; }
55 };
56 
58 
65 {
66  Qt::CaseSensitivity cs;
67 public:
68  klfStrCaseEqualFunc(Qt::CaseSensitivity caseSensitive) : cs(caseSensitive) { }
69  bool operator()(const QString& a, const QString& b) { return QString::compare(a, b, cs) == 0; }
70 };
71 
72 
81 template<class Key, class Value, class ValCompareFunc>
82 inline bool klfMapIsIncludedIn(const QMap<Key,Value>& a, const QMap<Key,Value>& b,
83  ValCompareFunc cfunc = klfEqualFunc<Value>())
84 {
85  typename QMap<Key,Value>::const_iterator iter;
86  for (iter = a.begin(); iter != a.end(); ++iter) {
87  if (!b.contains(iter.key()) || ! cfunc(b[iter.key()], iter.value())) {
88  return false;
89  }
90  }
91  // the map a is included in b
92  return true;
93 }
94 
96 
100 template<class Key>
101 inline bool klfMapIsIncludedIn(const QMap<Key,QString>& a, const QMap<Key,QString>& b, Qt::CaseSensitivity cs)
102 {
103  return klfMapIsIncludedIn(a, b, klfStrCaseEqualFunc(cs));
104 }
105 
106 
108 
134 
140 };
142 
151 KLF_EXPORT uint klfUrlCompare(const QUrl& url1, const QUrl& url2, uint interestFlags = 0xffffffff,
152  const QStringList& interestQueryItems = QStringList());
153 
154 
166 KLF_EXPORT bool klfMatch(const QVariant& testForHitCandidateValue, const QVariant& queryValue,
167  Qt::MatchFlags flags, const QString& queryStringCache = QString());
168 
169 
170 
171 template<class T>
172 inline QVariantList klfListToVariantList(const QList<T>& list)
173 {
174  QVariantList l;
175  int k;
176  for (k = 0; k < list.size(); ++k)
177  l << QVariant::fromValue<T>(list[k]);
178 
179  return l;
180 }
181 
182 
183 template<class T>
184 inline QList<T> klfVariantListToList(const QVariantList& vlist)
185 {
186  QList<T> list;
187  int k;
188  for (k = 0; k < vlist.size(); ++k) {
189  list << vlist[k].value<T>();
190  }
191  return list;
192 }
193 
194 template<class T> inline QVariantMap klfMapToVariantMap(const QMap<QString, T>& map)
195 {
196  QVariantMap vmap;
197  for (typename QMap<QString,T>::const_iterator it = map.begin(); it != map.end(); ++it) {
198  vmap[it.key()] = QVariant::fromValue<T>(it.value());
199  }
200  return vmap;
201 }
202 
203 
204 template<class T>
205  inline QMap<QString, T> klfVariantMapToMap(const QVariantMap& vmap)
206 {
207  QMap<QString, T> map;
208  for (QVariantMap::const_iterator it = vmap.begin(); it != vmap.end(); ++it) {
209  map[it.key()] = it.value().value<T>();
210  }
211  return map;
212 }
213 
214 
215 
235 KLF_EXPORT QStringList klfSearchFind(const QString& wildcard_expression, int limit = -1);
236 
250 KLF_EXPORT QString klfSearchPath(const QString& prog, const QString& extra_path = "");
251 
260 KLF_EXPORT QString klfSearchPath(const QString& fname, const QStringList& path);
261 
262 
263 
272 
281  const QString& value);
282 
291  const QString& value);
292 
296 
300 
301 
304  KlfEnvPathPrepend = 0x0001,
305  KlfEnvPathReplace = 0x0002,
306  KlfEnvPathAppend = 0x0003,
311 
313  KlfEnvMergeExpandVars = 0x00010000,
316  KlfEnvMergeFlagsMask = 0x00ff0000
317 };
318 
319 
328 KLF_EXPORT void klfMergeEnvironment(QStringList * env, const QStringList& addvars,
329  const QStringList& pathvars = QStringList(),
330  uint mergeaction = KlfEnvPathPrepend);
331 
343  const QStringList& pathvars = QStringList(),
344  uint mergeaction = KlfEnvPathPrepend);
345 
352 
358 
365 
366 
377 KLF_EXPORT QString klfSetEnvironmentPath(const QString& oldpaths, const QString& newpaths,
379 
390 KLF_EXPORT QStringList klfSetEnvironmentPath(const QStringList& oldpaths, const QStringList& newpaths,
392 
400  const QString& var = QLatin1String("PATH"),
402 
409 KLF_EXPORT void klfSetEnvironmentPath(QStringList * env, const QStringList& newitems,
410  const QString& var = QLatin1String("PATH"),
412 
420  bool recursive = true);
421 
427 
428 
437 KLF_EXPORT QString klfPrefixedPath(const QString& path, const QString& reference = QString());
438 
439 
447 
448 
451 template<class T, class MapOp>
452 inline QList<T> klfListMap(const QList<T>& list, MapOp op)
453 {
454  QList<T> l;
455  for(typename QList<T>::const_iterator it = list.begin(); it != list.end(); ++it) {
456  l << op(*it);
457  }
458  return l;
459 }
460 
462 {
463  __klf_StrArg_MapOp(const QString& t) : templ(t) { }
465  inline QString operator()(const QString& str)
466  {
467  return templ.arg(str);
468  }
469 };
470 
483 inline QStringList klfMapStringList(const QStringList& list, const QString& mapstr)
484 {
485  return klfListMap(list, __klf_StrArg_MapOp(mapstr));
486 }
487 
488 template<class T> inline QList<T> klfMkList(const T& a) { return QList<T>()<<a; }
489 template<class T> inline QList<T> klfMkList(const T& a, const T& b) { return QList<T>()<<a<<b; }
490 template<class T> inline QList<T> klfMkList(const T& a, const T& b, const T& c) { return QList<T>()<<a<<b<<c; }
491 template<class T>
492 inline QList<T> klfMkList(const T& a, const T& b, const T& c, const T& d) { return QList<T>()<<a<<b<<c<<d; }
493 
494 
495 template<class Value>
496 struct KLFMapInitData { const char * key; Value value; };
497 
498 template<class Value>
500 {
502  int k;
503  for (k = 0; x[k].key != NULL; ++k) {
504  map[QString::fromUtf8(x[k].key)] = x[k].value;
505  }
506  return map;
507 }
508 
509 
510 class KLFTargeter;
511 
513 public:
514  KLFTarget() : pTargetOf() { }
515  virtual ~KLFTarget();
516 
517 protected:
519  friend class KLFTargeter;
520 };
521 
523 public:
524  KLFTargeter() : pTarget(NULL) { }
525  virtual ~KLFTargeter();
526 
527  virtual void setTarget(KLFTarget *target);
528 
529 protected:
531  friend class KLFTarget;
532 };
533 
534 
535 
536 
537 
538 
539 
613 template<class T> class KLFRefPtr
614 {
615 public:
617  typedef T* Pointer;
618 
619  KLFRefPtr() : p(NULL), autodelete(true)
620  {
622  }
623 
624  KLFRefPtr(const KLFRefPtr& copy) : p(copy.p), autodelete(copy.autodelete)
625  {
626  KLF_DEBUG_BLOCK(KLF_FUNC_NAME+" [copy]") ;
627  set();
628  }
629 
631  {
633  unset();
634  }
635 
636  T * ptr() { return p; }
637  const T * ptr() const { return p; }
638 
639  bool autoDelete() const { return autodelete; }
640  void setAutoDelete(bool on) { autodelete = on; }
641 
642  void setPointer(Pointer newptr)
643  {
644  klfDbg("new pointer: "<<newptr<<"; old pointer was "<<p) ;
645  if (newptr == p) // no change
646  return;
647  unset();
648  p = newptr;
649  set();
650  }
651  void setNull()
652  {
653  setPointer(NULL);
654  }
655 
657  {
658  KLF_DEBUG_BLOCK(KLF_FUNC_NAME+"(KLFRefPtr<T*>)") ;
659  setPointer(other.p);
660  autodelete = other.autodelete;
661  return *this;
662  }
663  template<class OtherPtr> KLFRefPtr<T>& operator=(OtherPtr aptr)
664  {
665  KLF_DEBUG_BLOCK(KLF_FUNC_NAME+"(OtherPtr)") ;
666  setPointer((T*)(aptr));
667  return *this;
668  }
669 
670  KLFRefPtr<T>& operator=(Pointer newptr)
671  {
672  KLF_DEBUG_BLOCK(KLF_FUNC_NAME+"(Pointer)") ;
673  setPointer(newptr);
674  return *this;
675  }
676 
677  /*
678  KLFRefPtr<T>& operator=(long int value)
679  {
680  if ((void*)value != (void*)NULL) {
681  klfWarning("ERROR: *** Cannot set non-NULL long int value "<<value) ;
682  }
683  setPointer(NULL);
684  return *this;
685  }
686  KLFRefPtr<T>& operator=(int value)
687  {
688  if ((void*)value != (void*)NULL) {
689  klfWarning("ERROR: *** Cannot set non-NULL long int value "<<value) ;
690  }
691  setPointer(NULL);
692  return *this;
693  }
694  */
695 
696  inline operator T *()
697  { return p; }
698  inline operator const T *() const
699  { return p; }
700 
701  inline T * operator()()
702  { return p; }
703  inline const T * operator()() const
704  { return p; }
705 
706  /* inline T & operator*()
707  { return *p; }
708  inline const T & operator*() const
709  { return *p; } */
710 
711  inline Pointer operator->()
712  { return p; }
713  inline Pointer operator->() const
714  { return p; }
715 
716  template<class OtherPtr>
717  inline OtherPtr dyn_cast() { return dynamic_cast<OtherPtr>(p); }
718 
719  template<class OtherPtr>
720  inline const OtherPtr dyn_cast() const { return dynamic_cast<const OtherPtr>(p); }
721 
722  inline bool operator==(void * otherptr) const
723  { return (void *)p == otherptr; }
724 
725  inline bool operator==(const KLFRefPtr<T>& otherptr) const
726  { return p == otherptr.p; }
727 
728  inline bool operator!=(void * otherptr) const
729  { return ! (this->operator==(otherptr)); }
730 
731  inline bool operator!=(const KLFRefPtr<T>& otherptr) const
732  { return ! (this->operator==(otherptr)); }
733 
734 
735 private:
736  void operator+=(int ) { }
737  void operator-=(int ) { }
738 
740  Pointer p;
743  bool autodelete;
744 
745  void unset() {
747  if (p != NULL) {
748  int n = p->deref();
749  klfDbg(p<<": deref()! n="<<n<<"; autodelete="<<autodelete) ;
750  if (autodelete && n <= 0) {
751  klfDbg("Deleting at refcount="<<n<<".") ;
752  delete p;
753  }
754  p = NULL;
755  }
756  }
757  void set() {
759  if (p != NULL) {
760  int n = p->ref();
761  Q_UNUSED(n) ;
762  klfDbg(p<<": ref()! n="<<n) ;
763  }
764  }
765 
766 };
767 
768 
769 
770 
771 
772 
773 
774 
775 
776 
779 {
780  KLFPointerGuard() : ptr(NULL), refcount(0) {}
781 
782  void * ptr;
783 
784  int ref() { return ++refcount; }
785  int deref() { return --refcount; }
786 private:
787  int refcount;
788 };
789 
835 template<class T>
837 {
838 public:
839  typedef T* Pointer;
840 
842  {
843  ptrguard = NULL;
844  }
846  {
847  }
848 
850  {
851  ptrguard = copy.ptrguard;
852  }
854  {
855  *this = obj;
856  }
857 
858  inline Pointer ptr()
859  {
860  if (ptrguard == NULL)
861  return NULL;
862  return (Pointer) ptrguard->ptr;
863  }
864 
865  inline operator T*()
866  { return ptr(); }
867  inline operator const T*()
868  { return ptr(); }
869 
870  inline T* operator()()
871  { return ptr(); }
872  inline const T* operator()() const
873  { return ptr(); }
874 
875  inline T& operator*()
876  { return *ptr(); }
877  inline const T& operator*() const
878  { return *ptr(); }
879 
880  inline T* operator->()
881  { return ptr(); }
882  inline const T* operator->() const
883  { return ptr(); }
884 
885 
886  Pointer operator=(Pointer p)
887  {
888  if (p == NULL) {
889  invalidate();
890  return NULL;
891  }
892  if (ptrguard != NULL) {
893  klfWarning("Leaving tracked pointer "<<ptrguard->ptr<<" for another pointer!") ;
894  } else {
895  ptrguard = new KLFPointerGuard;
896  }
897  ptrguard->ptr = (void*)p;
898  return p;
899  };
900 
902  {
903  KLF_ASSERT_CONDITION(ptrguard == NULL, "Leaving tracked pointer "<<ptrguard->ptr<<" for a copy pointer!",
904  ;) ;
905  ptrguard = copy.ptrguard;
906  return *this;
907  }
908 
909  void invalidate()
910  {
911  if (ptrguard != NULL)
912  ptrguard->ptr = NULL;
913  }
914 
915  void reset()
916  {
917  ptrguard.setNull();
918  }
919 
920 private:
922 };
923 
924 
925 
926 
927 
928 
929 
930 
931 
932 
933 
934 
935 
936 
937 
938 
939 
940 
941 // -----
942 
943 
944 
945 template<class T>
947  static QVariant convert(const T& value)
948  {
949  return QVariant::fromValue<T>(value);
950  }
951  static T recover(const QVariant& variant)
952  {
953  return variant.value<T>();
954  }
955 };
956 template<class T>
958  static QVariant convert(const QList<T>& list)
959  {
960  return QVariant::fromValue<QVariantList>(klfListToVariantList(list));
961  }
962  static QList<T> recover(const QVariant& variant)
963  {
964  return klfVariantListToList<T>(variant.toList());
965  }
966 };
967 template<>
969  static QVariant convert(const QTextCharFormat& value)
970  {
971  return QVariant::fromValue<QTextFormat>(value);
972  }
973  static QTextCharFormat recover(const QVariant& variant)
974  {
975  return variant.value<QTextFormat>().toCharFormat();
976  }
977 };
978 
979 
980 
981 
985 #define KLFTOOLS_INIT \
986  Q_INIT_RESOURCE(klftoolsres)
987 
988 
989 
990 #endif
T * operator()()
Definition: klfutil.h:870
const char * key
Definition: klfutil.h:496
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.
Definition: klfutil.cpp:78
KLF_EXPORT QString klfSearchPath(const QString &prog, const QString &extra_path="")
Smart executable searching in a given path list with wildcards.
Definition: klfutil.cpp:261
Merge environments by expanding new values according to current environment.
Definition: klfutil.h:313
KLF_EXPORT bool klfMatch(const QVariant &testForHitCandidateValue, const QVariant &queryValue, Qt::MatchFlags flags, const QString &queryStringCache=QString())
Generalized value matching.
Definition: klfutil.cpp:145
KLF_EXPORT QString klfPrefixedPath(const QString &path, const QString &reference=QString())
Returns absolute path to path as seen from reference.
Definition: klfutil.cpp:316
T * operator->()
Definition: klfutil.h:880
bool contains(const Key &key) const
Store a guarded pointer, synchronizing other copies of this pointer.
Definition: klfutil.h:836
Prepend given value to list of path items.
Definition: klfutil.h:304
typedef MatchFlags
KLFTarget()
Definition: klfutil.h:514
implements an equality tester between strings
Definition: klfutil.h:64
klfStrCaseEqualFunc(Qt::CaseSensitivity caseSensitive)
Definition: klfutil.h:68
Remove duplicates from the variable.
Definition: klfutil.h:309
KLFRefPtr(const KLFRefPtr &copy)
Definition: klfutil.h:624
void setPointer(Pointer newptr)
Definition: klfutil.h:642
const T * operator->() const
Definition: klfutil.h:882
bool operator()(const Value &a, const Value &b)
Definition: klfutil.h:54
QList< QVariant > toList() const
Base declarations for klatexformula and some utilities.
bool klfMapIsIncludedIn(const QMap< Key, Value > &a, const QMap< Key, Value > &b, ValCompareFunc cfunc=klfEqualFunc< Value >())
Compares two QMap&#39;s for inclusion.
Definition: klfutil.h:82
QMap< QString, Value > klfMakeMap(KLFMapInitData< Value > x[])
Definition: klfutil.h:499
bool autoDelete() const
Definition: klfutil.h:639
~KLFRefPtr()
Definition: klfutil.h:630
#define klfDbg(streamableItems)
print debug stream items
T value() const
#define KLF_DEBUG_BLOCK(msg)
Utility to debug the execution of a block.
KLFTarget * pTarget
Definition: klfutil.h:530
QList< T > klfMkList(const T &a)
Definition: klfutil.h:488
static QTextCharFormat recover(const QVariant &variant)
Definition: klfutil.h:973
bool operator==(void *otherptr) const
Definition: klfutil.h:722
bool operator!=(void *otherptr) const
Definition: klfutil.h:728
T * Pointer
Definition: klfutil.h:617
const T & operator*() const
Definition: klfutil.h:877
KLF_EXPORT QStringList klfCurrentEnvironment()
Returns the current system&#39;s environment.
Definition: klfutil.cpp:621
static QList< T > recover(const QVariant &variant)
Definition: klfutil.h:962
KlfUrlCompareFlag
Some relevant values for klfUrlCompare()
Definition: klfutil.h:120
Pointer operator=(Pointer p)
Definition: klfutil.h:886
int size() const
T value(int i) const
If we&#39;re expanding new environment variables, don&#39;t expand them recursively.
Definition: klfutil.h:315
QMap< QString, T > klfVariantMapToMap(const QVariantMap &vmap)
Definition: klfutil.h:205
Urls are equal. The order of query items may be different, but the same are given with the same value...
Definition: klfutil.h:123
QStringList klfMapStringList(const QStringList &list, const QString &mapstr)
Definition: klfutil.h:483
KLF_EXPORT QStringList klfGetEnvironmentPath(const QStringList &env, const QString &var=QLatin1String("PATH"))
get the path items of an environment variable (commonly $PATH)
Definition: klfutil.cpp:473
Append given path items to current list.
Definition: klfutil.h:306
KLFRefPtr< T > & operator=(const KLFRefPtr< T > &other)
Definition: klfutil.h:656
QString fromUtf8(const char *str, int size)
Pointer ptr()
Definition: klfutil.h:858
#define KLF_EXPORT
Definition: klfdefs.h:41
const Key & key() const
void setNull()
Definition: klfutil.h:651
bool operator==(const KLFRefPtr< T > &otherptr) const
Definition: klfutil.h:725
#define klfWarning(streamableItems)
bool operator==(const KLFPropertizedObject &a, const KLFPropertizedObject &b)
Definition: klfpobj.cpp:604
Mask out the path flags.
Definition: klfutil.h:310
Value value
Definition: klfutil.h:496
KLF_EXPORT void klfMergeEnvironment(QStringList *env, const QStringList &addvars, const QStringList &pathvars=QStringList(), uint mergeaction=KlfEnvPathPrepend)
merge two environment definitions
Definition: klfutil.cpp:443
T * operator()()
Definition: klfutil.h:701
KLF_EXPORT QString klfUrlLocalFilePath(const QUrl &url)
Definition: klfutil.cpp:634
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)
Definition: klfutil.cpp:548
QVariantMap klfMapToVariantMap(const QMap< QString, T > &map)
Definition: klfutil.h:194
const T & value() const
bool operator()(const QString &a, const QString &b)
Definition: klfutil.h:69
KLFSyncGuardPtr(const KLFSyncGuardPtr &copy)
Definition: klfutil.h:849
QList< T > klfListMap(const QList< T > &list, MapOp op)
Definition: klfutil.h:452
T * ptr()
Definition: klfutil.h:636
Don&#39;t take any action, just apply flags.
Definition: klfutil.h:307
void setAutoDelete(bool on)
Definition: klfutil.h:640
iterator end()
const KLFSyncGuardPtr & operator=(const KLFSyncGuardPtr &copy)
Definition: klfutil.h:901
KLF_EXPORT bool klfEnsureDir(const QString &dir)
Ensure existence of a directory.
Definition: klfutil.cpp:41
KLF_EXPORT QString klfJoinEnvironmentPath(const QStringList &paths)
join several paths together to form a PATH-like environment variable value (common for $PATH) ...
Definition: klfutil.cpp:497
const char * key
Definition: klfdatautil.cpp:96
Pointer operator->()
Definition: klfutil.h:711
iterator begin()
This is NOT a specific test. It modifies the behavior of klfUrlCompare() by instructing it to compare...
Definition: klfutil.h:139
Stores a pointer to an object with refcount.
Definition: klfutil.h:613
Urls have same base URL. All query items in url1 are present in url2 with the same values...
Definition: klfutil.h:127
iterator end()
static QVariant convert(const T &value)
Definition: klfutil.h:947
#define KLF_FUNC_NAME
KLF_EXPORT QMap< QString, QString > klfEnvironmentListToMap(const QStringList &env)
convert environment list into a map of variable names to values
Definition: klfutil.cpp:426
Mask out the requested action.
Definition: klfutil.h:308
QString operator()(const QString &str)
Definition: klfutil.h:465
KLF_EXPORT QString klfGetEnvironmentVariable(const QStringList &env, const QString &var)
returns the value of an environment variable, defined in env.
Definition: klfutil.cpp:364
void reset()
Definition: klfutil.h:915
QList< KLFTargeter * > pTargetOf
Definition: klfutil.h:518
KLF_EXPORT QStringList klfSearchFind(const QString &wildcard_expression, int limit=-1)
Find files matching a path with wildcards.
Definition: klfutil.cpp:243
KLFRefPtr< T > & operator=(Pointer newptr)
Definition: klfutil.h:670
KLF_EXPORT QString klfExpandEnvironmentVariables(const QString &expression, const QStringList &env=QStringList(), bool recursive=true)
Expands references to environment variables to their values.
Definition: klfutil.cpp:614
KLF_EXPORT QStringList klfMapToEnvironmentList(const QMap< QString, QString > &map)
convert a map of variable names to values to an environment list
Definition: klfutil.cpp:403
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...
Definition: klfutil.cpp:378
KLFTargeter()
Definition: klfutil.h:524
const T * ptr() const
Definition: klfutil.h:637
static QVariant convert(const QList< T > &list)
Definition: klfutil.h:958
T & operator*()
Definition: klfutil.h:875
__klf_StrArg_MapOp(const QString &t)
Definition: klfutil.h:463
Mask out the merge actions flags.
Definition: klfutil.h:316
QVariantList klfListToVariantList(const QList< T > &list)
Definition: klfutil.h:172
const T * operator()() const
Definition: klfutil.h:703
Urls have same base URL. All query items in url2 are present in url1 with the same values...
Definition: klfutil.h:131
QList< T > klfVariantListToList(const QVariantList &vlist)
Definition: klfutil.h:184
void * ptr
Definition: klfutil.h:782
KLFRefPtr()
Definition: klfutil.h:619
bool operator!=(const KLFRefPtr< T > &otherptr) const
Definition: klfutil.h:731
static T recover(const QVariant &variant)
Definition: klfutil.h:951
KLFRefPtr< T > & operator=(OtherPtr aptr)
Definition: klfutil.h:663
KLFSyncGuardPtr(T *obj)
Definition: klfutil.h:853
void invalidate()
Definition: klfutil.h:909
#define KLF_ASSERT_CONDITION(expr, msg, failaction)
Asserting Conditions (NON-FATAL)
Replace current path items by given ones.
Definition: klfutil.h:305
const OtherPtr dyn_cast() const
Definition: klfutil.h:720
int compare(const QString &other, Qt::CaseSensitivity cs) const
Pointer operator->() const
Definition: klfutil.h:713
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const
static QVariant convert(const QTextCharFormat &value)
Definition: klfutil.h:969
OtherPtr dyn_cast()
Definition: klfutil.h:717
Implements default equality tester with operator==.
Definition: klfutil.h:51
iterator begin()
KlfEnvAction
Used in klfMergeEnvironment() and klfSetEnvironmentPath().
Definition: klfutil.h:303
const T * operator()() const
Definition: klfutil.h:872
KLF_EXPORT QStringList klfSplitEnvironmentPath(const QString &value)
split the value of a PATH-like environment variable into paths (common for $PATH) ...
Definition: klfutil.cpp:480
const T value(const Key &key, const T &defaultValue) const
Urls have same base URL. Query items are ignored.
Definition: klfutil.h:133

Generated by doxygen 1.8.13