libquentier  0.5.0
The library for rich desktop clients of Evernote service
LocalStorageManager.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_MANAGER_H
20 #define LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H
21 
22 #include <quentier/local_storage/Lists.h>
23 #include <quentier/local_storage/NoteSearchQuery.h>
24 #include <quentier/types/Account.h>
25 #include <quentier/types/ErrorString.h>
26 #include <quentier/utility/Linkage.h>
27 
28 #include <QHash>
29 #include <QString>
30 #include <QVector>
31 
32 #include <cstdint>
33 #include <memory>
34 #include <utility>
35 
36 namespace qevercloud {
37 
38 QT_FORWARD_DECLARE_STRUCT(Accounting)
39 QT_FORWARD_DECLARE_STRUCT(BusinessUserInfo)
40 QT_FORWARD_DECLARE_STRUCT(NoteAttributes)
41 QT_FORWARD_DECLARE_STRUCT(NotebookRestrictions)
42 QT_FORWARD_DECLARE_STRUCT(ResourceAttributes)
43 QT_FORWARD_DECLARE_STRUCT(PremiumInfo)
44 QT_FORWARD_DECLARE_STRUCT(SharedNotebook)
45 QT_FORWARD_DECLARE_STRUCT(UserAttributes)
46 
47 } // namespace qevercloud
48 
49 namespace quentier {
50 
51 QT_FORWARD_DECLARE_CLASS(ILocalStoragePatch)
52 QT_FORWARD_DECLARE_CLASS(LocalStorageManagerPrivate)
53 
54 class QUENTIER_EXPORT LocalStorageManager : public QObject
55 {
56  Q_OBJECT
57 public:
63  enum class StartupOption
64  {
72  ClearDatabase = 1,
81  OverrideLock = 2
82  };
83  Q_DECLARE_FLAGS(StartupOptions, StartupOption)
84 
85  friend QUENTIER_EXPORT QTextStream & operator<<(
86  QTextStream & strm, const StartupOption option);
87 
88  friend QUENTIER_EXPORT QDebug & operator<<(
89  QDebug & dbg, const StartupOption option);
90 
91  friend QUENTIER_EXPORT QTextStream & operator<<(
92  QTextStream & strm, const StartupOptions options);
93 
94  friend QUENTIER_EXPORT QDebug & operator<<(
95  QDebug & dbg, const StartupOptions options);
96 
109  const Account & account,
110 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
111  const StartupOptions options = {},
112 #else
113  const StartupOptions options = 0,
114 #endif
115  QObject * parent = nullptr);
116 
117  virtual ~LocalStorageManager() override;
118 
119 Q_SIGNALS:
130  void upgradeProgress(double progress);
131 
132 public:
143  enum class ListObjectsOption
144  {
145  ListAll = 0,
146  ListDirty = 1,
147  ListNonDirty = 2,
148  ListElementsWithoutGuid = 4,
149  ListElementsWithGuid = 8,
150  ListLocal = 16,
151  ListNonLocal = 32,
152  ListFavoritedElements = 64,
153  ListNonFavoritedElements = 128
154  };
155  Q_DECLARE_FLAGS(ListObjectsOptions, ListObjectsOption)
156 
157  friend QUENTIER_EXPORT QTextStream & operator<<(
158  QTextStream & strm, const ListObjectsOption option);
159 
160  friend QUENTIER_EXPORT QDebug & operator<<(
161  QDebug & dbg, const ListObjectsOption option);
162 
163  friend QUENTIER_EXPORT QTextStream & operator<<(
164  QTextStream & strm, const ListObjectsOptions options);
165 
166  friend QUENTIER_EXPORT QDebug & operator<<(
167  QDebug & dbg, const ListObjectsOptions options);
168 
186  const Account & account,
187 #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
188  const StartupOptions options = {});
189 #else
190  const StartupOptions options = 0);
191 #endif
192 
216  bool isLocalStorageVersionTooHigh(ErrorString & errorDescription);
217 
242  bool localStorageRequiresUpgrade(ErrorString & errorDescription);
243 
256  QVector<std::shared_ptr<ILocalStoragePatch>> requiredLocalStoragePatches();
257 
270  qint32 localStorageVersion(ErrorString & errorDescription);
271 
280 
291  int userCount(ErrorString & errorDescription) const;
292 
307  bool addUser(const User & user, ErrorString & errorDescription);
308 
323  bool updateUser(const User & user, ErrorString & errorDescription);
324 
337  bool findUser(User & user, ErrorString & errorDescription) const;
338 
348  bool deleteUser(const User & user, ErrorString & errorDescription);
349 
360  bool expungeUser(const User & user, ErrorString & errorDescription);
361 
372  int notebookCount(ErrorString & errorDescription) const;
373 
393  bool addNotebook(Notebook & notebook, ErrorString & errorDescription);
394 
413  bool updateNotebook(Notebook & notebook, ErrorString & errorDescription);
414 
445  Notebook & notebook, ErrorString & errorDescription) const;
446 
458  Notebook & notebook, ErrorString & errorDescription) const;
459 
471  Notebook & notebook, ErrorString & errorDescription) const;
472 
485  Notebook & notebook, ErrorString & errorDescription) const;
486 
492  enum class OrderDirection
493  {
494  Ascending = 0,
495  Descending
496  };
497 
498  friend QUENTIER_EXPORT QTextStream & operator<<(
499  QTextStream & strm, const OrderDirection orderDirection);
500 
501  friend QUENTIER_EXPORT QDebug & operator<<(
502  QDebug & dbg, const OrderDirection orderDirection);
503 
509  {
510  ByUpdateSequenceNumber = 0,
511  ByNotebookName,
512  ByCreationTimestamp,
513  ByModificationTimestamp,
514  NoOrder
515  };
516 
517  friend QUENTIER_EXPORT QTextStream & operator<<(
518  QTextStream & strm, const ListNotebooksOrder order);
519 
520  friend QUENTIER_EXPORT QDebug & operator<<(
521  QDebug & dbg, const ListNotebooksOrder order);
522 
556  QList<Notebook> listAllNotebooks(
557  ErrorString & errorDescription, const size_t limit = 0,
558  const size_t offset = 0,
559  const ListNotebooksOrder order = ListNotebooksOrder::NoOrder,
560  const OrderDirection orderDirection = OrderDirection::Ascending,
561  const QString & linkedNotebookGuid = QString()) const;
562 
596  QList<Notebook> listNotebooks(
597  const ListObjectsOptions flag, ErrorString & errorDescription,
598  const size_t limit = 0, const size_t offset = 0,
599  const ListNotebooksOrder order = ListNotebooksOrder::NoOrder,
600  const OrderDirection orderDirection = OrderDirection::Ascending,
601  const QString & linkedNotebookGuid = QString()) const;
602 
615  QList<SharedNotebook> listAllSharedNotebooks(
616  ErrorString & errorDescription) const;
617 
634  QList<SharedNotebook> listSharedNotebooksPerNotebookGuid(
635  const QString & notebookGuid, ErrorString & errorDescription) const;
636 
660  bool expungeNotebook(Notebook & notebook, ErrorString & errorDescription);
661 
671  int linkedNotebookCount(ErrorString & errorDescription) const;
672 
687  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
688 
702  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
703 
720  LinkedNotebook & linkedNotebook, ErrorString & errorDescription) const;
721 
727  {
728  ByUpdateSequenceNumber = 0,
729  ByShareName,
730  ByUsername,
731  NoOrder
732  };
733 
734  friend QUENTIER_EXPORT QTextStream & operator<<(
735  QTextStream & strm, const ListLinkedNotebooksOrder order);
736 
737  friend QUENTIER_EXPORT QDebug & operator<<(
738  QDebug & strm, const ListLinkedNotebooksOrder order);
739 
763  QList<LinkedNotebook> listAllLinkedNotebooks(
764  ErrorString & errorDescription, const size_t limit = 0,
765  const size_t offset = 0,
766  const ListLinkedNotebooksOrder order =
767  ListLinkedNotebooksOrder::NoOrder,
768  const OrderDirection orderDirection = OrderDirection::Ascending) const;
769 
797  QList<LinkedNotebook> listLinkedNotebooks(
798  const ListObjectsOptions flag, ErrorString & errorDescription,
799  const size_t limit = 0, const size_t offset = 0,
800  const ListLinkedNotebooksOrder order =
801  ListLinkedNotebooksOrder::NoOrder,
802  const OrderDirection orderDirection = OrderDirection::Ascending) const;
803 
822  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
823 
828  enum class NoteCountOption
829  {
830  IncludeNonDeletedNotes = 1,
831  IncludeDeletedNotes = 2
832  };
833  Q_DECLARE_FLAGS(NoteCountOptions, NoteCountOption)
834 
835  friend QUENTIER_EXPORT QTextStream & operator<<(
836  QTextStream & strm, const NoteCountOption option);
837 
838  friend QUENTIER_EXPORT QDebug & operator<<(
839  QDebug & dbg, const NoteCountOption option);
840 
841  friend QUENTIER_EXPORT QTextStream & operator<<(
842  QTextStream & strm, const NoteCountOptions options);
843 
844  friend QUENTIER_EXPORT QDebug & operator<<(
845  QDebug & strm, const NoteCountOptions options);
846 
860  ErrorString & errorDescription,
861  const NoteCountOptions options =
862  NoteCountOption::IncludeNonDeletedNotes) const;
863 
881  const Notebook & notebook, ErrorString & errorDescription,
882  const NoteCountOptions options =
883  NoteCountOption::IncludeNonDeletedNotes) const;
884 
902  const Tag & tag, ErrorString & errorDescription,
903  const NoteCountOptions options =
904  NoteCountOption::IncludeNonDeletedNotes) const;
905 
924  QHash<QString, int> & noteCountsPerTagLocalUid,
925  ErrorString & errorDescription,
926  const NoteCountOptions options =
927  NoteCountOption::IncludeNonDeletedNotes) const;
928 
948  const QStringList & notebookLocalUids, const QStringList & tagLocalUids,
949  ErrorString & errorDescription,
950  const NoteCountOptions options =
951  NoteCountOption::IncludeNonDeletedNotes) const;
952 
970  bool addNote(Note & note, ErrorString & errorDescription);
971 
981  enum class UpdateNoteOption
982  {
988  UpdateResourceMetadata = 1,
995  UpdateResourceBinaryData = 2,
999  UpdateTags = 4
1000  };
1001  Q_DECLARE_FLAGS(UpdateNoteOptions, UpdateNoteOption)
1002 
1003  friend QUENTIER_EXPORT QTextStream & operator<<(
1004  QTextStream & strm, const UpdateNoteOption option);
1005 
1006  friend QUENTIER_EXPORT QDebug & operator<<(
1007  QDebug & strm, const UpdateNoteOption option);
1008 
1009  friend QUENTIER_EXPORT QTextStream & operator<<(
1010  QTextStream & strm, const UpdateNoteOptions options);
1011 
1012  friend QUENTIER_EXPORT QDebug & operator<<(
1013  QDebug & strm, const UpdateNoteOptions options);
1014 
1057  Note & note, const UpdateNoteOptions options,
1058  ErrorString & errorDescription);
1059 
1071  enum class GetNoteOption
1072  {
1078  WithResourceMetadata = 1,
1085  WithResourceBinaryData = 2
1086  };
1087  Q_DECLARE_FLAGS(GetNoteOptions, GetNoteOption)
1088 
1089  friend QUENTIER_EXPORT QTextStream & operator<<(
1090  QTextStream & strm, const GetNoteOption option);
1091 
1092  friend QUENTIER_EXPORT QDebug & operator<<(
1093  QDebug & dbg, const GetNoteOption option);
1094 
1095  friend QUENTIER_EXPORT QTextStream & operator<<(
1096  QTextStream & strm, const GetNoteOptions options);
1097 
1098  friend QUENTIER_EXPORT QDebug & operator<<(
1099  QDebug & strm, const GetNoteOptions options);
1100 
1110  bool findNote(
1111  Note & note, const GetNoteOptions options,
1112  ErrorString & errorDescription) const;
1113 
1118  enum class ListNotesOrder
1119  {
1120  ByUpdateSequenceNumber = 0,
1121  ByTitle,
1122  ByCreationTimestamp,
1123  ByModificationTimestamp,
1124  ByDeletionTimestamp,
1125  ByAuthor,
1126  BySource,
1127  BySourceApplication,
1128  ByReminderTime,
1129  ByPlaceName,
1130  NoOrder
1131  };
1132 
1133  friend QUENTIER_EXPORT QTextStream & operator<<(
1134  QTextStream & strm, const ListNotesOrder order);
1135 
1136  friend QUENTIER_EXPORT QDebug & operator<<(
1137  QDebug & strm, const ListNotesOrder order);
1138 
1168  const Notebook & notebook, const GetNoteOptions options,
1169  ErrorString & errorDescription,
1170  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1171  const size_t limit = 0, const size_t offset = 0,
1172  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1173  const OrderDirection & orderDirection =
1174  OrderDirection::Ascending) const;
1175 
1203  QList<Note> listNotesPerTag(
1204  const Tag & tag, const GetNoteOptions options,
1205  ErrorString & errorDescription,
1206  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1207  const size_t limit = 0, const size_t offset = 0,
1208  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1209  const OrderDirection & orderDirection =
1210  OrderDirection::Ascending) const;
1211 
1243  const QStringList & notebookLocalUids, const QStringList & tagLocalUids,
1244  const GetNoteOptions options, ErrorString & errorDescription,
1245  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1246  const size_t limit = 0, const size_t offset = 0,
1247  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1248  const OrderDirection & orderDirection =
1249  OrderDirection::Ascending) const;
1250 
1283  const QStringList & noteLocalUids, const GetNoteOptions options,
1284  ErrorString & errorDescription,
1285  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1286  const size_t limit = 0, const size_t offset = 0,
1287  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1288  const OrderDirection & orderDirection =
1289  OrderDirection::Ascending) const;
1290 
1325  QList<Note> listNotes(
1326  const ListObjectsOptions flag, const GetNoteOptions options,
1327  ErrorString & errorDescription, const size_t limit = 0,
1328  const size_t offset = 0,
1329  const ListNotesOrder order = ListNotesOrder::NoOrder,
1330  const OrderDirection orderDirection = OrderDirection::Ascending,
1331  const QString & linkedNotebookGuid = QString()) const;
1332 
1345  const NoteSearchQuery & noteSearchQuery,
1346  ErrorString & errorDescription) const;
1347 
1364  const NoteSearchQuery & noteSearchQuery, const GetNoteOptions options,
1365  ErrorString & errorDescription) const;
1366 
1384  bool expungeNote(Note & note, ErrorString & errorDescription);
1385 
1395  int tagCount(ErrorString & errorDescription) const;
1396 
1410  bool addTag(Tag & tag, ErrorString & errorDescription);
1411 
1429  bool updateTag(Tag & tag, ErrorString & errorDescription);
1430 
1455  bool findTag(Tag & tag, ErrorString & errorDescription) const;
1456 
1461  enum class ListTagsOrder
1462  {
1463  ByUpdateSequenceNumber,
1464  ByName,
1465  NoOrder
1466  };
1467 
1468  friend QUENTIER_EXPORT QTextStream & operator<<(
1469  QTextStream & strm, const ListTagsOrder order);
1470 
1471  friend QUENTIER_EXPORT QDebug & operator<<(
1472  QDebug & strm, const ListTagsOrder order);
1473 
1503  const Note & note, ErrorString & errorDescription,
1504  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1505  const size_t limit = 0, const size_t offset = 0,
1506  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1507  const OrderDirection & orderDirection =
1508  OrderDirection::Ascending) const;
1509 
1540  QList<Tag> listAllTags(
1541  ErrorString & errorDescription, const size_t limit = 0,
1542  const size_t offset = 0,
1543  const ListTagsOrder order = ListTagsOrder::NoOrder,
1544  const OrderDirection orderDirection = OrderDirection::Ascending,
1545  const QString & linkedNotebookGuid = QString()) const;
1546 
1579  QList<Tag> listTags(
1580  const ListObjectsOptions flag, ErrorString & errorDescription,
1581  const size_t limit = 0, const size_t offset = 0,
1582  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1583  const OrderDirection orderDirection = OrderDirection::Ascending,
1584  const QString & linkedNotebookGuid = QString()) const;
1585 
1624  QList<std::pair<Tag, QStringList>> listTagsWithNoteLocalUids(
1625  const ListObjectsOptions flag, ErrorString & errorDescription,
1626  const size_t limit = 0, const size_t offset = 0,
1627  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1628  const OrderDirection orderDirection = OrderDirection::Ascending,
1629  const QString & linkedNotebookGuid = QString()) const;
1630 
1656  Tag & tag, QStringList & expungedChildTagLocalUids,
1657  ErrorString & errorDescription);
1658 
1670 
1682  int enResourceCount(ErrorString & errorDescription) const;
1683 
1700  bool addEnResource(Resource & resource, ErrorString & errorDescription);
1701 
1722  bool updateEnResource(Resource & resource, ErrorString & errorDescription);
1723 
1735  {
1740  WithBinaryData = 1
1741  };
1742  Q_DECLARE_FLAGS(GetResourceOptions, GetResourceOption)
1743 
1744  friend QUENTIER_EXPORT QTextStream & operator<<(
1745  QTextStream & strm, const GetResourceOption option);
1746 
1747  friend QUENTIER_EXPORT QDebug & operator<<(
1748  QDebug & strm, const GetResourceOption option);
1749 
1750  friend QUENTIER_EXPORT QTextStream & operator<<(
1751  QTextStream & strm, const GetResourceOptions options);
1752 
1753  friend QUENTIER_EXPORT QDebug & operator<<(
1754  QDebug & strm, const GetResourceOptions options);
1755 
1775  Resource & resource, const GetResourceOptions options,
1776  ErrorString & errorDescription) const;
1777 
1792  bool expungeEnResource(Resource & resource, ErrorString & errorDescription);
1793 
1803  int savedSearchCount(ErrorString & errorDescription) const;
1804 
1821  bool addSavedSearch(SavedSearch & search, ErrorString & errorDescription);
1822 
1842  SavedSearch & search, ErrorString & errorDescription);
1843 
1862  SavedSearch & search, ErrorString & errorDescription) const;
1863 
1869  {
1870  ByUpdateSequenceNumber = 0,
1871  ByName,
1872  ByFormat,
1873  NoOrder
1874  };
1875 
1876  friend QUENTIER_EXPORT QTextStream & operator<<(
1877  QTextStream & strm, const ListSavedSearchesOrder order);
1878 
1879  friend QUENTIER_EXPORT QDebug & operator<<(
1880  QDebug & strm, const ListSavedSearchesOrder order);
1881 
1904  QList<SavedSearch> listAllSavedSearches(
1905  ErrorString & errorDescription, const size_t limit = 0,
1906  const size_t offset = 0,
1907  const ListSavedSearchesOrder order = ListSavedSearchesOrder::NoOrder,
1908  const OrderDirection orderDirection = OrderDirection::Ascending) const;
1909 
1939  QList<SavedSearch> listSavedSearches(
1940  const ListObjectsOptions flag, ErrorString & errorDescription,
1941  const size_t limit = 0, const size_t offset = 0,
1942  const ListSavedSearchesOrder order = ListSavedSearchesOrder::NoOrder,
1943  const OrderDirection orderDirection = OrderDirection::Ascending) const;
1944 
1959  SavedSearch & search, ErrorString & errorDescription);
1960 
1979  const QString & linkedNotebookGuid, ErrorString & errorDescription);
1980 
1981 private:
1982  Q_DISABLE_COPY(LocalStorageManager)
1983 
1984  LocalStorageManagerPrivate * const d_ptr;
1985  Q_DECLARE_PRIVATE(LocalStorageManager)
1986 };
1987 
1988 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::GetNoteOptions)
1989 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::ListObjectsOptions)
1990 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::StartupOptions)
1991 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::UpdateNoteOptions)
1992 
1993 } // namespace quentier
1994 
1995 #endif // LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H
quentier::LocalStorageManager::updateNotebook
bool updateNotebook(Notebook &notebook, ErrorString &errorDescription)
updateNotebook updates the passed in Notebook in the local storage database
quentier::LocalStorageManager::listAllTags
QList< Tag > listAllTags(ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListTagsOrder order=ListTagsOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listAllTags lists all tags within the current user's account.
quentier::LocalStorageManager::findNote
bool findNote(Note &note, const GetNoteOptions options, ErrorString &errorDescription) const
findNote - attempts to find note in the local storage database
quentier::LocalStorageManager::updateNote
bool updateNote(Note &note, const UpdateNoteOptions options, ErrorString &errorDescription)
updateNote updates passed in Note in the local storage database.
quentier::Account
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:39
quentier::LocalStorageManager::listAllSharedNotebooks
QList< SharedNotebook > listAllSharedNotebooks(ErrorString &errorDescription) const
listAllSharedNotebooks attempts to list all shared notebooks within the account.
quentier::LocalStorageManager::expungeNote
bool expungeNote(Note &note, ErrorString &errorDescription)
expungeNote permanently deletes note from local storage.
quentier::LocalStorageManager::expungeLinkedNotebook
bool expungeLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
expungeLinkedNotebook permanently deletes specified linked notebook from the local storage database.
quentier::LocalStorageManager::listLinkedNotebooks
QList< LinkedNotebook > listLinkedNotebooks(const ListObjectsOptions flag, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListLinkedNotebooksOrder order=ListLinkedNotebooksOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending) const
listLinkedNotebooks attempts to list linked notebooks within the account according to the specified i...
quentier::LocalStorageManager::enResourceCount
int enResourceCount(ErrorString &errorDescription) const
enResourceCount (the name is not Resource to prevent problems with macro defined on some versions of ...
quentier::LocalStorageManager::listNotes
QList< Note > listNotes(const ListObjectsOptions flag, const GetNoteOptions options, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListNotesOrder order=ListNotesOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listNotes attempts to list notes within the account according to the specified input flag.
quentier::LocalStorageManager::NoteCountOption
NoteCountOption
The NoteCountOption enum is a QFlags enum which allows to specify some options for methods returning ...
Definition: LocalStorageManager.h:829
quentier::LocalStorageManager::findTag
bool findTag(Tag &tag, ErrorString &errorDescription) const
findTag attempts to find and fill the fields of passed in tag object.
quentier::LocalStorageManager::ListNotebooksOrder
ListNotebooksOrder
The ListNotebooksOrder allows to specify the results ordering for methods listing notebooks from the ...
Definition: LocalStorageManager.h:509
quentier::LocalStorageManager::localStorageRequiresUpgrade
bool localStorageRequiresUpgrade(ErrorString &errorDescription)
quentier::LocalStorageManager::listNotesPerTag
QList< Note > listNotesPerTag(const Tag &tag, const GetNoteOptions options, ErrorString &errorDescription, const ListObjectsOptions &flag=ListObjectsOption::ListAll, const size_t limit=0, const size_t offset=0, const ListNotesOrder &order=ListNotesOrder::NoOrder, const OrderDirection &orderDirection=OrderDirection::Ascending) const
listNotesPerTag attempts to list notes labeled with a given tag
quentier::LocalStorageManager::addTag
bool addTag(Tag &tag, ErrorString &errorDescription)
addTag adds passed in Tag to the local storage database. If tag has "remote" Evernote service's guid ...
quentier::LocalStorageManager::notebookCount
int notebookCount(ErrorString &errorDescription) const
notebookCount returns the number of notebooks currently stored in the local storage database
quentier::LocalStorageManager::isLocalStorageVersionTooHigh
bool isLocalStorageVersionTooHigh(ErrorString &errorDescription)
quentier::SavedSearch
Definition: SavedSearch.h:33
quentier::LocalStorageManager::linkedNotebookCount
int linkedNotebookCount(ErrorString &errorDescription) const
linkedNotebookCount returns the number of linked notebooks stored in the local storage database.
quentier::LocalStorageManager::deleteUser
bool deleteUser(const User &user, ErrorString &errorDescription)
deleteUser marks the user as deleted in local storage
quentier::LocalStorageManager::listSharedNotebooksPerNotebookGuid
QList< SharedNotebook > listSharedNotebooksPerNotebookGuid(const QString &notebookGuid, ErrorString &errorDescription) const
listSharedNotebooksPerNotebookGuid - attempts to list all shared notebooks per given notebook's remot...
quentier::LocalStorageManager::expungeEnResource
bool expungeEnResource(Resource &resource, ErrorString &errorDescription)
expungeResource permanently deletes resource from the local storage database.
quentier::LocalStorageManager::ListSavedSearchesOrder
ListSavedSearchesOrder
The ListSavedSearchesOrder enum allows to specify the results ordering for methods listing saved sear...
Definition: LocalStorageManager.h:1869
quentier::LocalStorageManager::findLinkedNotebook
bool findLinkedNotebook(LinkedNotebook &linkedNotebook, ErrorString &errorDescription) const
findLinkedNotebook attempts to find and set all found fields for passed in by reference LinkedNoteboo...
quentier::LocalStorageManager::addNotebook
bool addNotebook(Notebook &notebook, ErrorString &errorDescription)
addNotebook adds the passed in Notebook to the local storage database
quentier::LocalStorageManager::addNote
bool addNote(Note &note, ErrorString &errorDescription)
addNote adds passed in Note to the local storage database.
quentier::LocalStorageManager::noteCount
int noteCount(ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCount returns the number of notes currently stored in the local storage database.
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
quentier::LocalStorageManager::ListLinkedNotebooksOrder
ListLinkedNotebooksOrder
The ListLinkedNotebooksOrder enum allows to specify the results ordering for methods listing linked n...
Definition: LocalStorageManager.h:727
quentier::LocalStorageManager::listAllNotebooks
QList< Notebook > listAllNotebooks(ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListNotebooksOrder order=ListNotebooksOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listAllNotebooks attempts to list all notebooks within the current account from the local storage dat...
quentier::LocalStorageManager::findUser
bool findUser(User &user, ErrorString &errorDescription) const
findUser attempts to find and fill the fields of the passed in User object which must have "id" field...
quentier::LocalStorageManager::localStorageVersion
qint32 localStorageVersion(ErrorString &errorDescription)
quentier::LocalStorageManager::addUser
bool addUser(const User &user, ErrorString &errorDescription)
addUser adds the passed in User object to the local storage database
quentier::Notebook
Definition: Notebook.h:35
quentier::LocalStorageManager::expungeSavedSearch
bool expungeSavedSearch(SavedSearch &search, ErrorString &errorDescription)
expungeSavedSearch permanently deletes saved search from the local storage database.
quentier::LocalStorageManager::LocalStorageManager
LocalStorageManager(const Account &account, const StartupOptions options={}, QObject *parent=nullptr)
LocalStorageManager - constructor. Takes in the account for which the LocalStorageManager instance is...
quentier::LocalStorageManager::updateUser
bool updateUser(const User &user, ErrorString &errorDescription)
updateUser updates the passed in User object in the local storage database
quentier::LocalStorageManager
Definition: LocalStorageManager.h:55
quentier::LocalStorageManager::highestSupportedLocalStorageVersion
qint32 highestSupportedLocalStorageVersion() const
quentier::LocalStorageManager::updateSavedSearch
bool updateSavedSearch(SavedSearch &search, ErrorString &errorDescription)
updateSavedSearch updates passed in SavedSearch in the local storage database.
quentier::LocalStorageManager::UpdateNoteOption
UpdateNoteOption
The UpdateNoteOption enum is a QFlags enum which allows to specify which note fields should be update...
Definition: LocalStorageManager.h:982
quentier::LocalStorageManager::addLinkedNotebook
bool addLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
addLinkedNotebook adds passed in LinkedNotebook to the local storage database; LinkedNotebook must ha...
quentier::LocalStorageManager::GetNoteOption
GetNoteOption
The GetNoteOption enum is a QFlags enum which allows to specify which note fields should be included ...
Definition: LocalStorageManager.h:1072
quentier::LocalStorageManager::findNotesWithSearchQuery
NoteList findNotesWithSearchQuery(const NoteSearchQuery &noteSearchQuery, const GetNoteOptions options, ErrorString &errorDescription) const
findNotesWithSearchQuery attempts to find notes corresponding to the passed in NoteSearchQuery object...
quentier::LocalStorageManager::ListNotesOrder
ListNotesOrder
The ListNotesOrder enum allows to specify the results ordering for methods listing notes from the loc...
Definition: LocalStorageManager.h:1119
quentier::LocalStorageManager::upgradeProgress
void upgradeProgress(double progress)
LocalStorageManager is capable of performing automatic database upgrades if/when it is necessary.
quentier::LocalStorageManager::listSavedSearches
QList< SavedSearch > listSavedSearches(const ListObjectsOptions flag, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListSavedSearchesOrder order=ListSavedSearchesOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending) const
listSavedSearches attempts to list saved searches within the account according to the specified input...
quentier::LocalStorageManager::findSavedSearch
bool findSavedSearch(SavedSearch &search, ErrorString &errorDescription) const
findSavedSearch attempts to find and fill the fields of passed in saved search object.
quentier::LocalStorageManager::ListTagsOrder
ListTagsOrder
The ListTagsOrder enum allows to specify the results ordering for methods listing tags from the local...
Definition: LocalStorageManager.h:1462
quentier::LocalStorageManager::updateTag
bool updateTag(Tag &tag, ErrorString &errorDescription)
updateTag updates passed in Tag in the local storage database.
quentier::LocalStorageManager::noteCountPerTag
int noteCountPerTag(const Tag &tag, ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCountPerTag returns the number of notes currently stored in local storage database labeled with g...
quentier::Tag
Definition: Tag.h:33
quentier::LocalStorageManager::findNotebook
bool findNotebook(Notebook &notebook, ErrorString &errorDescription) const
findNotebook attempts to find and set all found fields of the passed in Notebook object
quentier::LocalStorageManager::expungeNotelessTagsFromLinkedNotebooks
bool expungeNotelessTagsFromLinkedNotebooks(ErrorString &errorDescription)
expungeNotelessTagsFromLinkedNotebooks permanently deletes from the local storage database those tags...
quentier::LocalStorageManager::requiredLocalStoragePatches
QVector< std::shared_ptr< ILocalStoragePatch > > requiredLocalStoragePatches()
quentier::LocalStorageManager::listNotebooks
QList< Notebook > listNotebooks(const ListObjectsOptions flag, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListNotebooksOrder order=ListNotebooksOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listNotebooks attempts to list notebooks within the account according to the specified input flag
quentier::LocalStorageManager::updateEnResource
bool updateEnResource(Resource &resource, ErrorString &errorDescription)
updateEnResource updates passed in resource in the local storage database.
quentier::LocalStorageManager::StartupOption
StartupOption
The StartupOption enum is a QFlags enum which allows to specify some options to be applied to the loc...
Definition: LocalStorageManager.h:64
quentier::LocalStorageManager::findLastUsedNotebook
bool findLastUsedNotebook(Notebook &notebook, ErrorString &errorDescription) const
findLastUsedNotebook attempts to find the last used notebook in the local storage database.
quentier::LocalStorageManager::listNotesByLocalUids
QList< Note > listNotesByLocalUids(const QStringList &noteLocalUids, const GetNoteOptions options, ErrorString &errorDescription, const ListObjectsOptions &flag=ListObjectsOption::ListAll, const size_t limit=0, const size_t offset=0, const ListNotesOrder &order=ListNotesOrder::NoOrder, const OrderDirection &orderDirection=OrderDirection::Ascending) const
listNotesByLocalUids attempts to list notes given their local uids
quentier::LocalStorageManager::noteCountsPerAllTags
bool noteCountsPerAllTags(QHash< QString, int > &noteCountsPerTagLocalUid, ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCountsPerAllTags returns the number of notes currently stored in local storage database labeled w...
quentier::LocalStorageManager::expungeUser
bool expungeUser(const User &user, ErrorString &errorDescription)
expungeUser permanently deletes the user from the local storage database
quentier::NoteSearchQuery
Definition: NoteSearchQuery.h:31
quentier::LocalStorageManager::noteCountPerNotebooksAndTags
int noteCountPerNotebooksAndTags(const QStringList &notebookLocalUids, const QStringList &tagLocalUids, ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCountPerNotebooksAndTags returns the number of notes currently stored in local storage database b...
quentier::LocalStorageManager::switchUser
void switchUser(const Account &account, const StartupOptions options={})
switchUser - switches to another local storage database file associated with the passed in account
quentier::Resource
Definition: Resource.h:30
quentier::User
Definition: User.h:34
quentier::LocalStorageManager::expungeNotebook
bool expungeNotebook(Notebook &notebook, ErrorString &errorDescription)
expungeNotebook permanently deletes the specified notebook from the local storage database.
quentier::LocalStorageManager::noteCountPerNotebook
int noteCountPerNotebook(const Notebook &notebook, ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCountPerNotebook returns the number of notes currently stored in the local storage database per g...
quentier::LocalStorageManager::savedSearchCount
int savedSearchCount(ErrorString &errorDescription) const
savedSearchCount returns the number of saved seacrhes currently stored in local storage database.
quentier::LocalStorageManager::GetResourceOption
GetResourceOption
The GetResourceOption enum is a QFlags enum which allows to specify which resource fields should be i...
Definition: LocalStorageManager.h:1735
quentier::LocalStorageManager::listTags
QList< Tag > listTags(const ListObjectsOptions flag, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListTagsOrder &order=ListTagsOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listTags attempts to list tags within the account according to the specified input flag.
quentier::LocalStorageManager::updateLinkedNotebook
bool updateLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
updateLinkedNotebook updates passd in LinkedNotebook in the local storage database; LinkedNotebook mu...
quentier::LocalStorageManager::addSavedSearch
bool addSavedSearch(SavedSearch &search, ErrorString &errorDescription)
addSavedSearch adds passed in SavedSearch to the local storage database; if search has "remote" Evern...
quentier::Note
Definition: Note.h:35
quentier::LinkedNotebook
Definition: LinkedNotebook.h:33
quentier::LocalStorageManager::listNotesPerNotebooksAndTags
QList< Note > listNotesPerNotebooksAndTags(const QStringList &notebookLocalUids, const QStringList &tagLocalUids, const GetNoteOptions options, ErrorString &errorDescription, const ListObjectsOptions &flag=ListObjectsOption::ListAll, const size_t limit=0, const size_t offset=0, const ListNotesOrder &order=ListNotesOrder::NoOrder, const OrderDirection &orderDirection=OrderDirection::Ascending) const
listNotesPerNotebooksAndTags attempts to list notes which are present within one of specified noteboo...
quentier::LocalStorageManager::findNoteLocalUidsWithSearchQuery
QStringList findNoteLocalUidsWithSearchQuery(const NoteSearchQuery &noteSearchQuery, ErrorString &errorDescription) const
findNoteLocalUidsWithSearchQuery attempts to find note local uids of notes corresponding to the passe...
quentier::LocalStorageManager::tagCount
int tagCount(ErrorString &errorDescription) const
tagCount returns the number of non-deleted tags currently stored in the local storage database.
quentier::LocalStorageManager::findDefaultOrLastUsedNotebook
bool findDefaultOrLastUsedNotebook(Notebook &notebook, ErrorString &errorDescription) const
findDefaultOrLastUsedNotebook attempts to find either the default or the last used notebook in the lo...
quentier::LocalStorageManager::listAllLinkedNotebooks
QList< LinkedNotebook > listAllLinkedNotebooks(ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListLinkedNotebooksOrder order=ListLinkedNotebooksOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending) const
listAllLinkedNotebooks - attempts to list all linked notebooks within the account.
quentier::LocalStorageManager::expungeTag
bool expungeTag(Tag &tag, QStringList &expungedChildTagLocalUids, ErrorString &errorDescription)
expungeTag permanently deletes tag from the local storage database.
quentier::LocalStorageManager::listAllTagsPerNote
QList< Tag > listAllTagsPerNote(const Note &note, ErrorString &errorDescription, const ListObjectsOptions &flag=ListObjectsOption::ListAll, const size_t limit=0, const size_t offset=0, const ListTagsOrder &order=ListTagsOrder::NoOrder, const OrderDirection &orderDirection=OrderDirection::Ascending) const
listAllTagsPerNote lists all tags per given note
quentier::LocalStorageManager::listTagsWithNoteLocalUids
QList< std::pair< Tag, QStringList > > listTagsWithNoteLocalUids(const ListObjectsOptions flag, ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListTagsOrder &order=ListTagsOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending, const QString &linkedNotebookGuid=QString()) const
listTagsWithNoteLocalUids attempts to list tags and their corresponding local uids within the account...
quentier::LocalStorageManager::findEnResource
bool findEnResource(Resource &resource, const GetResourceOptions options, ErrorString &errorDescription) const
findEnResource method attempts to find resource in the local storage database
quentier::LocalStorageManager::userCount
int userCount(ErrorString &errorDescription) const
userCount returns the number of non-deleted users currently stored in the local storage database
quentier::LocalStorageManager::ListObjectsOption
ListObjectsOption
The ListObjectsOption enum is a QFlags enum which allows to specify the desired local storage element...
Definition: LocalStorageManager.h:144
quentier::LocalStorageManager::listAllSavedSearches
QList< SavedSearch > listAllSavedSearches(ErrorString &errorDescription, const size_t limit=0, const size_t offset=0, const ListSavedSearchesOrder order=ListSavedSearchesOrder::NoOrder, const OrderDirection orderDirection=OrderDirection::Ascending) const
listAllSavedSearches lists all saved searches within the account.
quentier::LocalStorageManager::accountHighUsn
qint32 accountHighUsn(const QString &linkedNotebookGuid, ErrorString &errorDescription)
accountHighUsn returns the highest update sequence number within the data elements stored in the loca...
quentier::LocalStorageManager::OrderDirection
OrderDirection
The OrderDirection enum specifies the direction of ordering of the results for methods listing the ob...
Definition: LocalStorageManager.h:493
quentier::LocalStorageManager::listNotesPerNotebook
QList< Note > listNotesPerNotebook(const Notebook &notebook, const GetNoteOptions options, ErrorString &errorDescription, const ListObjectsOptions &flag=ListObjectsOption::ListAll, const size_t limit=0, const size_t offset=0, const ListNotesOrder &order=ListNotesOrder::NoOrder, const OrderDirection &orderDirection=OrderDirection::Ascending) const
listNotesPerNotebook attempts to list notes per given notebook
quentier::LocalStorageManager::addEnResource
bool addEnResource(Resource &resource, ErrorString &errorDescription)
addEnResource adds passed in resource to the local storage database.
quentier::LocalStorageManager::findDefaultNotebook
bool findDefaultNotebook(Notebook &notebook, ErrorString &errorDescription) const
findDefaultNotebook attempts to find the default notebook in the local storage database.