summaryrefslogtreecommitdiffstats
path: root/qtools/qcache.h
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-04-21 21:10:51 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-04-21 21:10:51 (GMT)
commit5d31b7ab211586100301d6838be82f066f8f9af4 (patch)
tree81218085d3e6e15b1ce6c418734013d48e9deda8 /qtools/qcache.h
parent76e39987363c93fdd3f2d99ffdb9f87743d6af7c (diff)
downloadDoxygen-5d31b7ab211586100301d6838be82f066f8f9af4.zip
Doxygen-5d31b7ab211586100301d6838be82f066f8f9af4.tar.gz
Doxygen-5d31b7ab211586100301d6838be82f066f8f9af4.tar.bz2
Release-1.4.2-20050421
Diffstat (limited to 'qtools/qcache.h')
-rw-r--r--qtools/qcache.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/qtools/qcache.h b/qtools/qcache.h
index 39b9139..78cef3d 100644
--- a/qtools/qcache.h
+++ b/qtools/qcache.h
@@ -42,6 +42,9 @@
#include "qgcache.h"
#endif // QT_H
+#define USE_ASCII_STRING
+
+#ifndef USE_ASCII_STRING
template<class type> class Q_EXPORT QCache : public QGCache
{
@@ -74,6 +77,43 @@ private:
void deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
};
+#else
+
+
+template<class type> class Q_EXPORT QCache : public QGCache
+{
+public:
+ QCache( const QCache<type> &c ) : QGCache(c) {}
+ QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE )
+ : QGCache( maxCost, size, AsciiKey, caseSensitive, TRUE ) {}
+ ~QCache() { clear(); }
+ QCache<type> &operator=( const QCache<type> &c )
+ { return (QCache<type>&)QGCache::operator=(c); }
+ int maxCost() const { return QGCache::maxCost(); }
+ int totalCost() const { return QGCache::totalCost(); }
+ void setMaxCost( int m ) { QGCache::setMaxCost(m); }
+ uint count() const { return QGCache::count(); }
+ uint size() const { return QGCache::size(); }
+ bool isEmpty() const { return QGCache::count() == 0; }
+ void clear() { QGCache::clear(); }
+ bool insert( const char *k, const type *d, int c=1, int p=0 )
+ { return QGCache::insert_other(k,(Item)d,c,p);}
+ bool remove( const char *k )
+ { return QGCache::remove_other(k); }
+ type *take( const char *k )
+ { return (type *)QGCache::take_ascii(k); }
+ type *find( const char *k, bool ref=TRUE ) const
+ { return (type *)QGCache::find_other(k,ref);}
+ type *operator[]( const char *k ) const
+ { return (type *)QGCache::find_other(k);}
+ void statistics() const { QGCache::statistics(); }
+private:
+ void deleteItem( Item d ) { if ( del_item ) delete (type *)d; }
+};
+
+
+#endif
+
template<class type> class Q_EXPORT QCacheIterator : public QGCacheIterator
@@ -92,7 +132,11 @@ public:
type *toLast() { return (type *)QGCacheIterator::toLast(); }
operator type *() const { return (type *)QGCacheIterator::get(); }
type *current() const { return (type *)QGCacheIterator::get(); }
+#ifndef USE_ASCII_STRING
QString currentKey() const{ return QGCacheIterator::getKeyString(); }
+#else
+ const char *currentKey() const{ return QGCacheIterator::getKeyAscii(); }
+#endif
type *operator()() { return (type *)QGCacheIterator::operator()();}
type *operator++() { return (type *)QGCacheIterator::operator++(); }
type *operator+=(uint j) { return (type *)QGCacheIterator::operator+=(j);}