akregator/src

storage.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2005 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5 
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 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #ifndef AKREGATOR_BACKEND_STORAGE_H
26 #define AKREGATOR_BACKEND_STORAGE_H
27 
28 #include <tqobject.h>
29 
30 #include "akregator_export.h"
31 
32 class TQString;
33 class TQStringList;
34 
35 namespace Akregator {
36 namespace Backend {
37 
38 class FeedStorage;
39 
44 class AKREGATOR_EXPORT Storage : public TQObject
45 {
46  public:
47 
48  static Storage* getInstance();
49  static void setInstance(Storage* instance);
50 
51  virtual ~Storage() {}
52 
55  virtual void initialize(const TQStringList& params) = 0;
56 
61  virtual bool open(bool autoCommit = false) = 0;
62 
67  virtual bool commit() = 0;
68 
73  virtual bool rollback() = 0;
74 
79  virtual bool close() = 0;
80 
84  virtual FeedStorage* archiveFor(const TQString &url) = 0;
85  virtual bool autoCommit() const = 0;
86  virtual int unreadFor(const TQString &url) = 0;
87  virtual void setUnreadFor(const TQString &url, int unread) = 0;
88  virtual int totalCountFor(const TQString &url) = 0;
89  virtual void setTotalCountFor(const TQString &url, int total) = 0;
90  virtual int lastFetchFor(const TQString& url) = 0;
91  virtual void setLastFetchFor(const TQString& url, int lastFetch) = 0;
92 
97  virtual void storeFeedList(const TQString& opmlStr) = 0;
98  virtual TQString restoreFeedList() const = 0;
99 
100  virtual void storeTagSet(const TQString& xmlStr) = 0;
101  virtual TQString restoreTagSet() const = 0;
102 
105  virtual TQStringList feeds() const = 0;
106 
110  virtual void add(Storage* source) = 0;
111 
113  virtual void clear() = 0;
114 
115  private:
116 
117  static Storage *m_instance;
118 };
119 
120 }
121 }
122 
123 #endif
Storage is the main interface to the article archive.
Definition: storage.h:45
virtual bool commit()=0
Commit changes made in feeds and articles, making them persistent.
virtual void clear()=0
deletes all feed storages in this archive
virtual FeedStorage * archiveFor(const TQString &url)=0
virtual void storeFeedList(const TQString &opmlStr)=0
stores the feed list in the storage backend.
virtual bool open(bool autoCommit=false)=0
Open storage and prepare it for work.
virtual bool close()=0
Closes storage, freeing all allocated resources.
virtual bool rollback()=0
Rollback changes made in feeds and articles, reverting to last committed values.
virtual void initialize(const TQStringList &params)=0
initializes the storage object with given parameters
virtual void add(Storage *source)=0
adds all feed storages from a source to this storage existing articles are replaced
virtual TQStringList feeds() const =0
returns a list of all feeds (URLs) stored in this archive