diff options
Diffstat (limited to 'doc/man/man3/tqcache.3qt')
-rw-r--r-- | doc/man/man3/tqcache.3qt | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/doc/man/man3/tqcache.3qt b/doc/man/man3/tqcache.3qt index a37868537..56b1f3a3b 100644 --- a/doc/man/man3/tqcache.3qt +++ b/doc/man/man3/tqcache.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCache 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCache 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,19 +7,19 @@ .ad l .nh .SH NAME -QCache \- Template class that provides a cache based on TQString keys +TQCache \- Template class that provides a cache based on TQString keys .SH SYNOPSIS -\fC#include <ntqcache.h>\fR +\fC#include <tqcache.h>\fR .PP Inherits TQPtrCollection. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQCache\fR ( int maxCost = 100, int size = 17, bool caseSensitive = TRUE )" +.BI "\fBTQCache\fR ( int maxCost = 100, int size = 17, bool caseSensitive = TRUE )" .br .ti -1c -.BI "\fB~QCache\fR ()" +.BI "\fB~TQCache\fR ()" .br .ti -1c .BI "int \fBmaxCost\fR () const" @@ -71,11 +71,11 @@ Inherits TQPtrCollection. .br .in -1c .SH DESCRIPTION -The QCache class is a template class that provides a cache based on TQString keys. +The TQCache class is a template class that provides a cache based on TQString keys. .PP A cache is a least recently used (LRU) list of cache items. Each cache item has a key and a certain cost. The sum of item costs, totalCost(), never exceeds the maximum cache cost, maxCost(). If inserting a new item would cause the total cost to exceed the maximum cost, the least recently used items in the cache are removed. .PP -QCache is a template class. QCache<X> defines a cache that operates on pointers to X, or X*. +TQCache is a template class. TQCache<X> defines a cache that operates on pointers to X, or X*. .PP Apart from insert(), by far the most important function is find() (which also exists as operator[]()). This function looks up an item, returns it, and by default marks it as being the most recently used item. .PP @@ -85,13 +85,13 @@ When inserting an item into the cache, only the pointer is copied, not the item .PP When removing a cache item, the virtual function TQPtrCollection::deleteItem() is called. The default implementation deletes the item if auto-deletion is enabled, and does nothing otherwise. .PP -There is a QCacheIterator that can be used to traverse the items in the cache in arbitrary order. +There is a TQCacheIterator that can be used to traverse the items in the cache in arbitrary order. .PP -In QCache, the cache items are accessed via TQString keys, which are Unicode strings. If you want to use non-Unicode, plain 8-bit \fCchar*\fR keys, use the QAsciiCache template. A QCache has the same performance as a QAsciiCache. +In TQCache, the cache items are accessed via TQString keys, which are Unicode strings. If you want to use non-Unicode, plain 8-bit \fCchar*\fR keys, use the TQAsciiCache template. A TQCache has the same performance as a TQAsciiCache. .PP -See also QCacheIterator, QAsciiCache, QIntCache, Collection Classes, and Non-GUI Classes. +See also TQCacheIterator, TQAsciiCache, TQIntCache, Collection Classes, and Non-GUI Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCache::QCache ( int maxCost = 100, int size = 17, bool caseSensitive = TRUE )" +.SH "TQCache::TQCache ( int maxCost = 100, int size = 17, bool caseSensitive = TRUE )" Constructs a cache whose contents will never have a total cost greater than \fImaxCost\fR and which is expected to contain less than \fIsize\fR items. .PP \fIsize\fR is actually the size of an internal hash array; it's usually best to make it a prime number and at least 50% bigger than the largest expected number of items in the cache. @@ -99,13 +99,13 @@ Constructs a cache whose contents will never have a total cost greater than \fIm Each inserted item has an associated cost. When inserting a new item, if the total cost of all items in the cache will exceed \fImaxCost\fR, the cache will start throwing out the older (least recently used) items until there is enough room for the new item to be inserted. .PP If \fIcaseSensitive\fR is TRUE (the default), the cache keys are case sensitive; if it is FALSE, they are case-insensitive. Case-insensitive comparison considers all Unicode letters. -.SH "QCache::~QCache ()" +.SH "TQCache::~TQCache ()" Removes all items from the cache and destroys it. All iterators that access this cache will be reset. .SH "bool TQPtrCollection::autoDelete () const" Returns the setting of the auto-delete option. The default is FALSE. .PP See also setAutoDelete(). -.SH "void QCache::clear ()\fC [virtual]\fR" +.SH "void TQCache::clear ()\fC [virtual]\fR" Removes all items from the cache and deletes them if auto-deletion has been enabled. .PP All cache iterators that operate this on cache are reset. @@ -113,31 +113,31 @@ All cache iterators that operate this on cache are reset. See also remove() and take(). .PP Reimplemented from TQPtrCollection. -.SH "uint QCache::count () const\fC [virtual]\fR" +.SH "uint TQCache::count () const\fC [virtual]\fR" Returns the number of items in the cache. .PP See also totalCost(). .PP Reimplemented from TQPtrCollection. -.SH "type * QCache::find ( const TQString & k, bool ref = TRUE ) const" +.SH "type * TQCache::find ( const TQString & k, bool ref = TRUE ) const" Returns the item associated with key \fIk\fR, or 0 if the key does not exist in the cache. If \fIref\fR is TRUE (the default), the item is moved to the front of the least recently used list. .PP If there are two or more items with equal keys, the one that was inserted last is returned. -.SH "bool QCache::insert ( const TQString & k, const type * d, int c = 1, int p = 0 )" +.SH "bool TQCache::insert ( const TQString & k, const type * d, int c = 1, int p = 0 )" Inserts the item \fId\fR into the cache with key \fIk\fR and associated cost, \fIc\fR. Returns TRUE if it is successfully inserted; otherwise returns FALSE. .PP -The cache's size is limited, and if the total cost is too high, QCache will remove old, least recently used items until there is room for this new item. +The cache's size is limited, and if the total cost is too high, TQCache will remove old, least recently used items until there is room for this new item. .PP The parameter \fIp\fR is internal and should be left at the default value (0). .PP \fBWarning:\fR If this function returns FALSE (which could happen, e.g. if the cost of this item alone exceeds maxCost()) you must delete \fId\fR yourself. Additionally, be very careful about using \fId\fR after calling this function because any other insertions into the cache, from anywhere in the application or within TQt itself, could cause the object to be discarded from the cache and the pointer to become invalid. -.SH "bool QCache::isEmpty () const" +.SH "bool TQCache::isEmpty () const" Returns TRUE if the cache is empty; otherwise returns FALSE. -.SH "int QCache::maxCost () const" +.SH "int TQCache::maxCost () const" Returns the maximum allowed total cost of the cache. .PP See also setMaxCost() and totalCost(). -.SH "type * QCache::operator[] ( const TQString & k ) const" +.SH "type * TQCache::operator[] ( const TQString & k ) const" Returns the item associated with key \fIk\fR, or 0 if \fIk\fR does not exist in the cache, and moves the item to the front of the least recently used list. .PP If there are two or more items with equal keys, the one that was inserted last is returned. @@ -145,7 +145,7 @@ If there are two or more items with equal keys, the one that was inserted last i This is the same as find( k, TRUE ). .PP See also find(). -.SH "bool QCache::remove ( const TQString & k )" +.SH "bool TQCache::remove ( const TQString & k )" Removes the item associated with \fIk\fR, and returns TRUE if the item was present in the cache; otherwise returns FALSE. .PP The item is deleted if auto-deletion has been enabled, i.e., if you have called setAutoDelete(TRUE). @@ -168,15 +168,15 @@ See also autoDelete(). .PP Examples: .)l grapher/grapher.cpp, scribble/scribble.cpp, and table/bigtable/main.cpp. -.SH "void QCache::setMaxCost ( int m )" +.SH "void TQCache::setMaxCost ( int m )" Sets the maximum allowed total cost of the cache to \fIm\fR. If the current total cost is greater than \fIm\fR, some items are deleted immediately. .PP See also maxCost() and totalCost(). -.SH "uint QCache::size () const" +.SH "uint TQCache::size () const" Returns the size of the hash array used to implement the cache. This should be a bit bigger than count() is likely to be. -.SH "void QCache::statistics () const" +.SH "void TQCache::statistics () const" A debug-only utility function. Prints out cache usage, hit/miss, and distribution information using tqDebug(). This function does nothing in the release library. -.SH "type * QCache::take ( const TQString & k )" +.SH "type * TQCache::take ( const TQString & k )" Takes the item associated with \fIk\fR out of the cache without deleting it, and returns a pointer to the item taken out, or 0 if the key does not exist in the cache. .PP If there are two or more items with equal keys, the one that was inserted last is taken. @@ -184,13 +184,13 @@ If there are two or more items with equal keys, the one that was inserted last i All iterators that refer to the taken item are set to point to the next item in the cache's traversal order. .PP See also remove() and clear(). -.SH "int QCache::totalCost () const" +.SH "int TQCache::totalCost () const" Returns the total cost of the items in the cache. This is an integer in the range 0 to maxCost(). .PP See also setMaxCost(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqcache.html +.BR http://doc.trolltech.com/tqcache.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the |