libquentier
0.5.0
The library for rich desktop clients of Evernote service
Toggle main menu visibility
Loading...
Searching...
No Matches
headers
quentier
local_storage
LocalStorageCacheManager.h
1
/*
2
* Copyright 2016-2020 Dmitry Ivanov
3
*
4
* This file is part of libquentier
5
*
6
* libquentier is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, version 3 of the License.
9
*
10
* libquentier is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_CACHE_MANAGER_H
20
#define LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_CACHE_MANAGER_H
21
22
#include <quentier/utility/Printable.h>
23
24
#include <memory>
25
26
namespace
quentier {
27
28
QT_FORWARD_DECLARE_CLASS(
LinkedNotebook
)
29
QT_FORWARD_DECLARE_CLASS(
Note
)
30
QT_FORWARD_DECLARE_CLASS(
Notebook
)
31
QT_FORWARD_DECLARE_CLASS(
Resource
)
32
QT_FORWARD_DECLARE_CLASS(
SavedSearch
)
33
QT_FORWARD_DECLARE_CLASS(
Tag
)
34
35
QT_FORWARD_DECLARE_CLASS(
ILocalStorageCacheExpiryChecker
)
36
37
QT_FORWARD_DECLARE_CLASS(LocalStorageCacheManagerPrivate)
38
class QUENTIER_EXPORT LocalStorageCacheManager : public Printable
39
{
40
public
:
41
LocalStorageCacheManager();
42
virtual
~LocalStorageCacheManager();
43
44
enum
WhichUid
45
{
46
LocalUid,
47
Guid
48
};
49
50
void
clear();
51
bool
empty()
const
;
52
53
// Notes cache
54
size_t
numCachedNotes()
const
;
55
void
cacheNote(
const
Note
& note);
56
void
expungeNote(
const
Note
& note);
57
58
const
Note
* findNote(
const
QString & uid,
const
WhichUid whichUid)
const
;
59
60
void
clearAllNotes();
61
62
// Resources cache
63
size_t
numCachedResources()
const
;
64
void
cacheResource(
const
Resource
& resource);
65
void
expungeResource(
const
Resource
& resource);
66
67
const
Resource
* findResource(
68
const
QString &
id
,
const
WhichUid whichUid)
const
;
69
70
void
clearAllResources();
71
72
// Notebooks cache
73
size_t
numCachedNotebooks()
const
;
74
void
cacheNotebook(
const
Notebook
& notebook);
75
void
expungeNotebook(
const
Notebook
& notebook);
76
77
const
Notebook
* findNotebook(
78
const
QString & uid,
const
WhichUid whichUid)
const
;
79
80
const
Notebook
* findNotebookByName(
const
QString & name)
const
;
81
void
clearAllNotebooks();
82
83
// Tags cache
84
size_t
numCachedTags()
const
;
85
void
cacheTag(
const
Tag
& tag);
86
void
expungeTag(
const
Tag
& tag);
87
const
Tag
* findTag(
const
QString & uid,
const
WhichUid whichUid)
const
;
88
const
Tag
* findTagByName(
const
QString & name)
const
;
89
void
clearAllTags();
90
91
// Linked notebooks cache
92
size_t
numCachedLinkedNotebooks()
const
;
93
void
cacheLinkedNotebook(
const
LinkedNotebook
& linkedNotebook);
94
void
expungeLinkedNotebook(
const
LinkedNotebook
& linkedNotebook);
95
const
LinkedNotebook
* findLinkedNotebook(
const
QString & guid)
const
;
96
void
clearAllLinkedNotebooks();
97
98
// Saved searches cache
99
size_t
numCachedSavedSearches()
const
;
100
void
cacheSavedSearch(
const
SavedSearch
& savedSearch);
101
void
expungeSavedSearch(
const
SavedSearch
& savedSearch);
102
103
const
SavedSearch
* findSavedSearch(
104
const
QString & uid,
const
WhichUid whichUid)
const
;
105
106
const
SavedSearch
* findSavedSearchByName(
const
QString & name)
const
;
107
void
clearAllSavedSearches();
108
109
void
installCacheExpiryFunction(
110
const
ILocalStorageCacheExpiryChecker
& checker);
111
112
virtual
QTextStream & print(QTextStream & strm)
const override
;
113
114
private
:
115
Q_DISABLE_COPY(LocalStorageCacheManager)
116
117
LocalStorageCacheManagerPrivate *
const
d_ptr;
118
Q_DECLARE_PRIVATE(LocalStorageCacheManager)
119
};
120
121
}
// namespace quentier
122
123
#endif
// LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_CACHE_MANAGER_H
quentier::ILocalStorageCacheExpiryChecker
The ILocalStorageCacheExpiryChecker class represents the interface for cache expiry checker used by L...
Definition
ILocalStorageCacheExpiryChecker.h:35
quentier::LinkedNotebook
Definition
LinkedNotebook.h:33
quentier::Note
Definition
Note.h:35
quentier::Notebook
Definition
Notebook.h:35
quentier::Resource
Definition
Resource.h:30
quentier::SavedSearch
Definition
SavedSearch.h:33
quentier::Tag
Definition
Tag.h:33
Generated on
for libquentier by
1.17.0