2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #ifndef KNMEMORYMANAGER_H
16 #define KNMEMORYMANAGER_H
18 #include "knarticle.h"
19 #include "knarticlecollection.h"
23 class KNArticleCollection
;
25 /** Memory manager. */
26 class KNMemoryManager
{
32 /** Collection-Handling */
33 void updateCacheEntry( KNArticleCollection::Ptr c
);
34 void removeCacheEntry( KNArticleCollection::Ptr c
);
35 /** try to free enough memory for this collection */
36 void prepareLoad( KNArticleCollection::Ptr c
);
38 /** Article-Handling */
39 void updateCacheEntry( KNArticle::Ptr a
);
40 void removeCacheEntry( KNArticle::Ptr a
);
44 /** Article cache item. */
47 explicit ArticleItem( KNArticle::Ptr a
) { art
=a
; sync(); }
54 /// List of article cache items.
55 typedef QList
<KNMemoryManager::ArticleItem
*> List
;
58 /** Group/folder cache item. */
59 class CollectionItem
{
61 explicit CollectionItem( KNArticleCollection::Ptr c
)
69 KNArticleCollection::Ptr col
;
72 /// List of collection cache items.
73 typedef QList
<KNMemoryManager::CollectionItem
*> List
;
76 CollectionItem
* findCacheEntry( KNArticleCollection::Ptr c
, bool take
= false );
77 ArticleItem
* findCacheEntry( KNArticle::Ptr a
, bool take
= false );
78 void checkMemoryUsageCollections();
79 void checkMemoryUsageArticles();
81 CollectionItem::List mColList
;
82 ArticleItem::List mArtList
;
83 int c_ollCacheSize
, a_rtCacheSize
;