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 #include <quentier/utility/Macros.h>
28 
29 #include <QHash>
30 #include <QString>
31 #include <QVector>
32 
33 #include <cstdint>
34 #include <memory>
35 #include <utility>
36 
37 namespace qevercloud {
38 
39 QT_FORWARD_DECLARE_STRUCT(Accounting)
40 QT_FORWARD_DECLARE_STRUCT(BusinessUserInfo)
41 QT_FORWARD_DECLARE_STRUCT(NoteAttributes)
42 QT_FORWARD_DECLARE_STRUCT(NotebookRestrictions)
43 QT_FORWARD_DECLARE_STRUCT(ResourceAttributes)
44 QT_FORWARD_DECLARE_STRUCT(PremiumInfo)
45 QT_FORWARD_DECLARE_STRUCT(SharedNotebook)
46 QT_FORWARD_DECLARE_STRUCT(UserAttributes)
47 
48 } // namespace qevercloud
49 
50 namespace quentier {
51 
52 QT_FORWARD_DECLARE_CLASS(ILocalStoragePatch)
53 QT_FORWARD_DECLARE_CLASS(LocalStorageManagerPrivate)
54 
55 class QUENTIER_EXPORT LocalStorageManager: public QObject
56 {
57  Q_OBJECT
58 public:
64  enum class StartupOption
65  {
73  ClearDatabase = 1,
82  OverrideLock = 2
83  };
84  Q_DECLARE_FLAGS(StartupOptions, StartupOption)
85 
86  friend QUENTIER_EXPORT QTextStream & operator<<(
87  QTextStream & strm, const StartupOption option);
88 
89  friend QUENTIER_EXPORT QDebug & operator<<(
90  QDebug & dbg, const StartupOption option);
91 
92  friend QUENTIER_EXPORT QTextStream & operator<<(
93  QTextStream & strm, const StartupOptions options);
94 
95  friend QUENTIER_EXPORT QDebug & operator<<(
96  QDebug & dbg, const StartupOptions options);
97 
110  const Account & account, const StartupOptions options = 0,
111  QObject * parent = nullptr);
112 
113  virtual ~LocalStorageManager() override;
114 
115 Q_SIGNALS:
126  void upgradeProgress(double progress);
127 
128 public:
139  enum class ListObjectsOption {
140  ListAll = 0,
141  ListDirty = 1,
142  ListNonDirty = 2,
143  ListElementsWithoutGuid = 4,
144  ListElementsWithGuid = 8,
145  ListLocal = 16,
146  ListNonLocal = 32,
147  ListFavoritedElements = 64,
148  ListNonFavoritedElements = 128
149  };
150  Q_DECLARE_FLAGS(ListObjectsOptions, ListObjectsOption)
151 
152  friend QUENTIER_EXPORT QTextStream & operator<<(
153  QTextStream & strm, const ListObjectsOption option);
154 
155  friend QUENTIER_EXPORT QDebug & operator<<(
156  QDebug & dbg, const ListObjectsOption option);
157 
158  friend QUENTIER_EXPORT QTextStream & operator<<(
159  QTextStream & strm, const ListObjectsOptions options);
160 
161  friend QUENTIER_EXPORT QDebug & operator<<(
162  QDebug & dbg, const ListObjectsOptions options);
163 
180  void switchUser(const Account & account, const StartupOptions options = 0);
181 
205  bool isLocalStorageVersionTooHigh(ErrorString & errorDescription);
206 
231  bool localStorageRequiresUpgrade(ErrorString & errorDescription);
232 
245  QVector<std::shared_ptr<ILocalStoragePatch>> requiredLocalStoragePatches();
246 
259  qint32 localStorageVersion(ErrorString & errorDescription);
260 
269 
280  int userCount(ErrorString & errorDescription) const;
281 
296  bool addUser(const User & user, ErrorString & errorDescription);
297 
312  bool updateUser(const User & user, ErrorString & errorDescription);
313 
326  bool findUser(User & user, ErrorString & errorDescription) const;
327 
337  bool deleteUser(const User & user, ErrorString & errorDescription);
338 
349  bool expungeUser(const User & user, ErrorString & errorDescription);
350 
361  int notebookCount(ErrorString & errorDescription) const;
362 
382  bool addNotebook(Notebook & notebook, ErrorString & errorDescription);
383 
402  bool updateNotebook(Notebook & notebook, ErrorString & errorDescription);
403 
433  bool findNotebook(Notebook & notebook, ErrorString & errorDescription) const;
434 
446  Notebook & notebook, ErrorString & errorDescription) const;
447 
459  Notebook & notebook, ErrorString & errorDescription) const;
460 
473  Notebook & notebook, ErrorString & errorDescription) const;
474 
480  enum class OrderDirection
481  {
482  Ascending = 0,
483  Descending
484  };
485 
486  friend QUENTIER_EXPORT QTextStream & operator<<(
487  QTextStream & strm, const OrderDirection orderDirection);
488 
489  friend QUENTIER_EXPORT QDebug & operator<<(
490  QDebug & dbg, const OrderDirection orderDirection);
491 
497  {
498  ByUpdateSequenceNumber = 0,
499  ByNotebookName,
500  ByCreationTimestamp,
501  ByModificationTimestamp,
502  NoOrder
503  };
504 
505  friend QUENTIER_EXPORT QTextStream & operator<<(
506  QTextStream & strm, const ListNotebooksOrder order);
507 
508  friend QUENTIER_EXPORT QDebug & operator<<(
509  QDebug & dbg, const ListNotebooksOrder order);
510 
544  QList<Notebook> listAllNotebooks(
545  ErrorString & errorDescription,
546  const size_t limit = 0, const size_t offset = 0,
547  const ListNotebooksOrder order = ListNotebooksOrder::NoOrder,
548  const OrderDirection orderDirection = OrderDirection::Ascending,
549  const QString & linkedNotebookGuid = QString()) const;
550 
584  QList<Notebook> listNotebooks(
585  const ListObjectsOptions flag,
586  ErrorString & errorDescription,
587  const size_t limit = 0, const size_t offset = 0,
588  const ListNotebooksOrder order = ListNotebooksOrder::NoOrder,
589  const OrderDirection orderDirection = OrderDirection::Ascending,
590  const QString & linkedNotebookGuid = QString()) const;
591 
604  QList<SharedNotebook> listAllSharedNotebooks(
605  ErrorString & errorDescription) const;
606 
623  QList<SharedNotebook> listSharedNotebooksPerNotebookGuid(
624  const QString & notebookGuid, ErrorString & errorDescription) const;
625 
649  bool expungeNotebook(Notebook & notebook, ErrorString & errorDescription);
650 
660  int linkedNotebookCount(ErrorString & errorDescription) const;
661 
676  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
677 
691  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
692 
709  LinkedNotebook & linkedNotebook, ErrorString & errorDescription) const;
710 
716  {
717  ByUpdateSequenceNumber = 0,
718  ByShareName,
719  ByUsername,
720  NoOrder
721  };
722 
723  friend QUENTIER_EXPORT QTextStream & operator<<(
724  QTextStream & strm, const ListLinkedNotebooksOrder order);
725 
726  friend QUENTIER_EXPORT QDebug & operator<<(
727  QDebug & strm, const ListLinkedNotebooksOrder order);
728 
752  QList<LinkedNotebook> listAllLinkedNotebooks(
753  ErrorString & errorDescription,
754  const size_t limit = 0, const size_t offset = 0,
755  const ListLinkedNotebooksOrder order = ListLinkedNotebooksOrder::NoOrder,
756  const OrderDirection orderDirection = OrderDirection::Ascending) const;
757 
785  QList<LinkedNotebook> listLinkedNotebooks(
786  const ListObjectsOptions flag, ErrorString & errorDescription,
787  const size_t limit = 0, const size_t offset = 0,
788  const ListLinkedNotebooksOrder order = ListLinkedNotebooksOrder::NoOrder,
789  const OrderDirection orderDirection = OrderDirection::Ascending) const;
790 
809  const LinkedNotebook & linkedNotebook, ErrorString & errorDescription);
810 
815  enum class NoteCountOption
816  {
817  IncludeNonDeletedNotes = 1,
818  IncludeDeletedNotes = 2
819  };
820  Q_DECLARE_FLAGS(NoteCountOptions, NoteCountOption)
821 
822  friend QUENTIER_EXPORT QTextStream & operator<<(
823  QTextStream & strm, const NoteCountOption option);
824 
825  friend QUENTIER_EXPORT QDebug & operator<<(
826  QDebug & dbg, const NoteCountOption option);
827 
828  friend QUENTIER_EXPORT QTextStream & operator<<(
829  QTextStream & strm, const NoteCountOptions options);
830 
831  friend QUENTIER_EXPORT QDebug & operator<<(
832  QDebug & strm, const NoteCountOptions options);
833 
847  ErrorString & errorDescription,
848  const NoteCountOptions options =
849  NoteCountOption::IncludeNonDeletedNotes) const;
850 
868  const Notebook & notebook,
869  ErrorString & errorDescription,
870  const NoteCountOptions options =
871  NoteCountOption::IncludeNonDeletedNotes) const;
872 
890  const Tag & tag, ErrorString & errorDescription,
891  const NoteCountOptions options =
892  NoteCountOption::IncludeNonDeletedNotes) const;
893 
912  QHash<QString, int> & noteCountsPerTagLocalUid,
913  ErrorString & errorDescription,
914  const NoteCountOptions options =
915  NoteCountOption::IncludeNonDeletedNotes) const;
916 
936  const QStringList & notebookLocalUids,
937  const QStringList & tagLocalUids, ErrorString & errorDescription,
938  const NoteCountOptions options =
939  NoteCountOption::IncludeNonDeletedNotes) const;
940 
958  bool addNote(Note & note, ErrorString & errorDescription);
959 
969  enum class UpdateNoteOption
970  {
976  UpdateResourceMetadata = 1,
983  UpdateResourceBinaryData = 2,
987  UpdateTags = 4
988  };
989  Q_DECLARE_FLAGS(UpdateNoteOptions, UpdateNoteOption)
990 
991  friend QUENTIER_EXPORT QTextStream & operator<<(
992  QTextStream & strm, const UpdateNoteOption option);
993 
994  friend QUENTIER_EXPORT QDebug & operator<<(
995  QDebug & strm, const UpdateNoteOption option);
996 
997  friend QUENTIER_EXPORT QTextStream & operator<<(
998  QTextStream & strm, const UpdateNoteOptions options);
999 
1000  friend QUENTIER_EXPORT QDebug & operator<<(
1001  QDebug & strm, const UpdateNoteOptions options);
1002 
1049  Note & note, const UpdateNoteOptions options,
1050  ErrorString & errorDescription);
1051 
1063  enum class GetNoteOption
1064  {
1070  WithResourceMetadata = 1,
1077  WithResourceBinaryData = 2
1078  };
1079  Q_DECLARE_FLAGS(GetNoteOptions, GetNoteOption)
1080 
1081  friend QUENTIER_EXPORT QTextStream & operator<<(
1082  QTextStream & strm, const GetNoteOption option);
1083 
1084  friend QUENTIER_EXPORT QDebug & operator<<(
1085  QDebug & dbg, const GetNoteOption option);
1086 
1087  friend QUENTIER_EXPORT QTextStream & operator<<(
1088  QTextStream & strm, const GetNoteOptions options);
1089 
1090  friend QUENTIER_EXPORT QDebug & operator<<(
1091  QDebug & strm, const GetNoteOptions options);
1092 
1102  bool findNote(
1103  Note & note, const GetNoteOptions options,
1104  ErrorString & errorDescription) const;
1105 
1110  enum class ListNotesOrder
1111  {
1112  ByUpdateSequenceNumber = 0,
1113  ByTitle,
1114  ByCreationTimestamp,
1115  ByModificationTimestamp,
1116  ByDeletionTimestamp,
1117  ByAuthor,
1118  BySource,
1119  BySourceApplication,
1120  ByReminderTime,
1121  ByPlaceName,
1122  NoOrder
1123  };
1124 
1125  friend QUENTIER_EXPORT QTextStream & operator<<(
1126  QTextStream & strm, const ListNotesOrder order);
1127 
1128  friend QUENTIER_EXPORT QDebug & operator<<(
1129  QDebug & strm, const ListNotesOrder order);
1130 
1160  const Notebook & notebook,
1161  const GetNoteOptions options,
1162  ErrorString & errorDescription,
1163  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1164  const size_t limit = 0, const size_t offset = 0,
1165  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1166  const OrderDirection & orderDirection = OrderDirection::Ascending) const;
1167 
1195  QList<Note> listNotesPerTag(
1196  const Tag & tag, const GetNoteOptions options,
1197  ErrorString & errorDescription,
1198  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1199  const size_t limit = 0, const size_t offset = 0,
1200  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1201  const OrderDirection & orderDirection = OrderDirection::Ascending) const;
1202 
1234  const QStringList & notebookLocalUids,
1235  const QStringList & tagLocalUids,
1236  const GetNoteOptions options,
1237  ErrorString & errorDescription,
1238  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1239  const size_t limit = 0, const size_t offset = 0,
1240  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1241  const OrderDirection & orderDirection = OrderDirection::Ascending) const;
1242 
1275  const QStringList & noteLocalUids,
1276  const GetNoteOptions options,
1277  ErrorString & errorDescription,
1278  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1279  const size_t limit = 0, const size_t offset = 0,
1280  const ListNotesOrder & order = ListNotesOrder::NoOrder,
1281  const OrderDirection & orderDirection = OrderDirection::Ascending) const;
1282 
1317  QList<Note> listNotes(
1318  const ListObjectsOptions flag, const GetNoteOptions options,
1319  ErrorString & errorDescription,
1320  const size_t limit = 0, const size_t offset = 0,
1321  const ListNotesOrder order = ListNotesOrder::NoOrder,
1322  const OrderDirection orderDirection = OrderDirection::Ascending,
1323  const QString & linkedNotebookGuid = QString()) const;
1324 
1337  const NoteSearchQuery & noteSearchQuery,
1338  ErrorString & errorDescription) const;
1339 
1356  const NoteSearchQuery & noteSearchQuery,
1357  const GetNoteOptions options, ErrorString & errorDescription) const;
1358 
1376  bool expungeNote(Note & note, ErrorString & errorDescription);
1377 
1387  int tagCount(ErrorString & errorDescription) const;
1388 
1402  bool addTag(Tag & tag, ErrorString & errorDescription);
1403 
1421  bool updateTag(Tag & tag, ErrorString & errorDescription);
1422 
1447  bool findTag(Tag & tag, ErrorString & errorDescription) const;
1448 
1453  enum class ListTagsOrder
1454  {
1455  ByUpdateSequenceNumber,
1456  ByName,
1457  NoOrder
1458  };
1459 
1460  friend QUENTIER_EXPORT QTextStream & operator<<(
1461  QTextStream & strm, const ListTagsOrder order);
1462 
1463  friend QUENTIER_EXPORT QDebug & operator<<(
1464  QDebug & strm, const ListTagsOrder order);
1465 
1495  const Note & note, ErrorString & errorDescription,
1496  const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1497  const size_t limit = 0, const size_t offset = 0,
1498  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1499  const OrderDirection & orderDirection = OrderDirection::Ascending) const;
1500 
1531  QList<Tag> listAllTags(
1532  ErrorString & errorDescription,
1533  const size_t limit = 0, const size_t offset = 0,
1534  const ListTagsOrder order = ListTagsOrder::NoOrder,
1535  const OrderDirection orderDirection = OrderDirection::Ascending,
1536  const QString & linkedNotebookGuid = QString()) const;
1537 
1570  QList<Tag> listTags(
1571  const ListObjectsOptions flag,
1572  ErrorString & errorDescription,
1573  const size_t limit = 0, const size_t offset = 0,
1574  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1575  const OrderDirection orderDirection = OrderDirection::Ascending,
1576  const QString & linkedNotebookGuid = QString()) const;
1577 
1616  QList<std::pair<Tag, QStringList>> listTagsWithNoteLocalUids(
1617  const ListObjectsOptions flag, ErrorString & errorDescription,
1618  const size_t limit = 0, const size_t offset = 0,
1619  const ListTagsOrder & order = ListTagsOrder::NoOrder,
1620  const OrderDirection orderDirection = OrderDirection::Ascending,
1621  const QString & linkedNotebookGuid = QString()) const;
1622 
1648  Tag & tag, QStringList & expungedChildTagLocalUids,
1649  ErrorString & errorDescription);
1650 
1662 
1674  int enResourceCount(ErrorString & errorDescription) const;
1675 
1692  bool addEnResource(Resource & resource, ErrorString & errorDescription);
1693 
1714  bool updateEnResource(Resource & resource, ErrorString & errorDescription);
1715 
1727  {
1732  WithBinaryData = 1
1733  };
1734  Q_DECLARE_FLAGS(GetResourceOptions, GetResourceOption)
1735 
1736  friend QUENTIER_EXPORT QTextStream & operator<<(
1737  QTextStream & strm, const GetResourceOption option);
1738 
1739  friend QUENTIER_EXPORT QDebug & operator<<(
1740  QDebug & strm, const GetResourceOption option);
1741 
1742  friend QUENTIER_EXPORT QTextStream & operator<<(
1743  QTextStream & strm, const GetResourceOptions options);
1744 
1745  friend QUENTIER_EXPORT QDebug & operator<<(
1746  QDebug & strm, const GetResourceOptions options);
1747 
1767  Resource & resource, const GetResourceOptions options,
1768  ErrorString & errorDescription) const;
1769 
1784  bool expungeEnResource(Resource & resource, ErrorString & errorDescription);
1785 
1795  int savedSearchCount(ErrorString & errorDescription) const;
1796 
1813  bool addSavedSearch(SavedSearch & search, ErrorString & errorDescription);
1814 
1833  bool updateSavedSearch(SavedSearch & search, ErrorString & errorDescription);
1834 
1853  SavedSearch & search, ErrorString & errorDescription) const;
1854 
1860  {
1861  ByUpdateSequenceNumber = 0,
1862  ByName,
1863  ByFormat,
1864  NoOrder
1865  };
1866 
1867  friend QUENTIER_EXPORT QTextStream & operator<<(
1868  QTextStream & strm, const ListSavedSearchesOrder order);
1869 
1870  friend QUENTIER_EXPORT QDebug & operator<<(
1871  QDebug & strm, const ListSavedSearchesOrder order);
1872 
1895  QList<SavedSearch> listAllSavedSearches(
1896  ErrorString & errorDescription,
1897  const size_t limit = 0, const size_t offset = 0,
1898  const ListSavedSearchesOrder order = ListSavedSearchesOrder::NoOrder,
1899  const OrderDirection orderDirection = OrderDirection::Ascending) const;
1900 
1930  QList<SavedSearch> listSavedSearches(
1931  const ListObjectsOptions flag, ErrorString & errorDescription,
1932  const size_t limit = 0, const size_t offset = 0,
1933  const ListSavedSearchesOrder order = ListSavedSearchesOrder::NoOrder,
1934  const OrderDirection orderDirection = OrderDirection::Ascending) const;
1935 
1950  SavedSearch & search, ErrorString & errorDescription);
1951 
1970  const QString & linkedNotebookGuid, ErrorString & errorDescription);
1971 
1972 private:
1973  Q_DISABLE_COPY(LocalStorageManager)
1974 
1975  LocalStorageManagerPrivate * const d_ptr;
1976  Q_DECLARE_PRIVATE(LocalStorageManager)
1977 };
1978 
1979 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::GetNoteOptions)
1980 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::ListObjectsOptions)
1981 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::StartupOptions)
1982 Q_DECLARE_OPERATORS_FOR_FLAGS(LocalStorageManager::UpdateNoteOptions)
1983 
1984 } // namespace quentier
1985 
1986 #endif // LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:40
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
Definition: LinkedNotebook.h:33
Definition: LocalStorageManager.h:56
bool isLocalStorageVersionTooHigh(ErrorString &errorDescription)
bool localStorageRequiresUpgrade(ErrorString &errorDescription)
int noteCount(ErrorString &errorDescription, const NoteCountOptions options=NoteCountOption::IncludeNonDeletedNotes) const
noteCount returns the number of notes currently stored in the local storage database.
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
bool updateNotebook(Notebook &notebook, ErrorString &errorDescription)
updateNotebook updates the passed in Notebook in the local storage database
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...
bool updateNote(Note &note, const UpdateNoteOptions options, ErrorString &errorDescription)
updateNote updates passed in Note in the local storage database.
bool addNotebook(Notebook &notebook, ErrorString &errorDescription)
addNotebook adds the passed in Notebook to the local storage database
void switchUser(const Account &account, const StartupOptions options=0)
switchUser - switches to another local storage database file associated with the passed in account
qint32 localStorageVersion(ErrorString &errorDescription)
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.
void upgradeProgress(double progress)
LocalStorageManager is capable of performing automatic database upgrades if/when it is necessary.
GetResourceOption
The GetResourceOption enum is a QFlags enum which allows to specify which resource fields should be i...
Definition: LocalStorageManager.h:1727
bool addTag(Tag &tag, ErrorString &errorDescription)
addTag adds passed in Tag to the local storage database. If tag has "remote" Evernote service's guid ...
int enResourceCount(ErrorString &errorDescription) const
enResourceCount (the name is not Resource to prevent problems with macro defined on some versions of ...
bool updateUser(const User &user, ErrorString &errorDescription)
updateUser updates the passed in User object in the local storage database
QList< SharedNotebook > listAllSharedNotebooks(ErrorString &errorDescription) const
listAllSharedNotebooks attempts to list all shared notebooks within the account.
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
int userCount(ErrorString &errorDescription) const
userCount returns the number of non-deleted users currently stored in the local storage database
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...
bool expungeTag(Tag &tag, QStringList &expungedChildTagLocalUids, ErrorString &errorDescription)
expungeTag permanently deletes tag from the local storage database.
bool updateEnResource(Resource &resource, ErrorString &errorDescription)
updateEnResource updates passed in resource in the local storage database.
bool findNotebook(Notebook &notebook, ErrorString &errorDescription) const
findNotebook attempts to find and set all found fields of the passed in Notebook object
bool expungeSavedSearch(SavedSearch &search, ErrorString &errorDescription)
expungeSavedSearch permanently deletes saved search from the local storage database.
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
bool findNote(Note &note, const GetNoteOptions options, ErrorString &errorDescription) const
findNote - attempts to find note in the local storage database
UpdateNoteOption
The UpdateNoteOption enum is a QFlags enum which allows to specify which note fields should be update...
Definition: LocalStorageManager.h:970
int savedSearchCount(ErrorString &errorDescription) const
savedSearchCount returns the number of saved seacrhes currently stored in local storage database.
bool addEnResource(Resource &resource, ErrorString &errorDescription)
addEnResource adds passed in resource to the local storage database.
ListSavedSearchesOrder
The ListSavedSearchesOrder enum allows to specify the results ordering for methods listing saved sear...
Definition: LocalStorageManager.h:1860
qint32 highestSupportedLocalStorageVersion() const
int notebookCount(ErrorString &errorDescription) const
notebookCount returns the number of notebooks currently stored in the local storage database
bool updateSavedSearch(SavedSearch &search, ErrorString &errorDescription)
updateSavedSearch updates passed in SavedSearch in the local storage database.
bool expungeNote(Note &note, ErrorString &errorDescription)
expungeNote permanently deletes note from local storage.
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.
QVector< std::shared_ptr< ILocalStoragePatch > > requiredLocalStoragePatches()
qint32 accountHighUsn(const QString &linkedNotebookGuid, ErrorString &errorDescription)
accountHighUsn returns the highest update sequence number within the data elements stored in the loca...
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.
bool findSavedSearch(SavedSearch &search, ErrorString &errorDescription) const
findSavedSearch attempts to find and fill the fields of passed in saved search object.
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...
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...
bool expungeLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
expungeLinkedNotebook permanently deletes specified linked notebook from the local storage database.
bool findLastUsedNotebook(Notebook &notebook, ErrorString &errorDescription) const
findLastUsedNotebook attempts to find the last used notebook in the local storage database.
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
GetNoteOption
The GetNoteOption enum is a QFlags enum which allows to specify which note fields should be included ...
Definition: LocalStorageManager.h:1064
ListNotesOrder
The ListNotesOrder enum allows to specify the results ordering for methods listing notes from the loc...
Definition: LocalStorageManager.h:1111
bool addUser(const User &user, ErrorString &errorDescription)
addUser adds the passed in User object to the local storage database
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...
StartupOption
The StartupOption enum is a QFlags enum which allows to specify some options to be applied to the loc...
Definition: LocalStorageManager.h:65
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.
OrderDirection
The OrderDirection enum specifies the direction of ordering of the results for methods listing the ob...
Definition: LocalStorageManager.h:481
bool expungeNotebook(Notebook &notebook, ErrorString &errorDescription)
expungeNotebook permanently deletes the specified notebook from the local storage database.
bool findLinkedNotebook(LinkedNotebook &linkedNotebook, ErrorString &errorDescription) const
findLinkedNotebook attempts to find and set all found fields for passed in by reference LinkedNoteboo...
ListTagsOrder
The ListTagsOrder enum allows to specify the results ordering for methods listing tags from the local...
Definition: LocalStorageManager.h:1454
bool findTag(Tag &tag, ErrorString &errorDescription) const
findTag attempts to find and fill the fields of passed in tag object.
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
QStringList findNoteLocalUidsWithSearchQuery(const NoteSearchQuery &noteSearchQuery, ErrorString &errorDescription) const
findNoteLocalUidsWithSearchQuery attempts to find note local uids of notes corresponding to the passe...
NoteList findNotesWithSearchQuery(const NoteSearchQuery &noteSearchQuery, const GetNoteOptions options, ErrorString &errorDescription) const
findNotesWithSearchQuery attempts to find notes corresponding to the passed in NoteSearchQuery object...
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...
bool expungeEnResource(Resource &resource, ErrorString &errorDescription)
expungeResource permanently deletes resource from the local storage database.
ListNotebooksOrder
The ListNotebooksOrder allows to specify the results ordering for methods listing notebooks from the ...
Definition: LocalStorageManager.h:497
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...
bool expungeUser(const User &user, ErrorString &errorDescription)
expungeUser permanently deletes the user from the local storage database
bool expungeNotelessTagsFromLinkedNotebooks(ErrorString &errorDescription)
expungeNotelessTagsFromLinkedNotebooks permanently deletes from the local storage database those tags...
NoteCountOption
The NoteCountOption enum is a QFlags enum which allows to specify some options for methods returning ...
Definition: LocalStorageManager.h:816
bool findDefaultOrLastUsedNotebook(Notebook &notebook, ErrorString &errorDescription) const
findDefaultOrLastUsedNotebook attempts to find either the default or the last used notebook in the lo...
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...
bool addNote(Note &note, ErrorString &errorDescription)
addNote adds passed in Note to the local storage database.
QList< SharedNotebook > listSharedNotebooksPerNotebookGuid(const QString &notebookGuid, ErrorString &errorDescription) const
listSharedNotebooksPerNotebookGuid - attempts to list all shared notebooks per given notebook's remot...
bool findDefaultNotebook(Notebook &notebook, ErrorString &errorDescription) const
findDefaultNotebook attempts to find the default notebook in the local storage database.
bool deleteUser(const User &user, ErrorString &errorDescription)
deleteUser marks the user as deleted in local storage
bool updateLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
updateLinkedNotebook updates passd in LinkedNotebook in the local storage database; LinkedNotebook mu...
bool updateTag(Tag &tag, ErrorString &errorDescription)
updateTag updates passed in Tag in the local storage database.
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...
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...
bool addSavedSearch(SavedSearch &search, ErrorString &errorDescription)
addSavedSearch adds passed in SavedSearch to the local storage database; if search has "remote" Evern...
bool addLinkedNotebook(const LinkedNotebook &linkedNotebook, ErrorString &errorDescription)
addLinkedNotebook adds passed in LinkedNotebook to the local storage database; LinkedNotebook must ha...
bool findEnResource(Resource &resource, const GetResourceOptions options, ErrorString &errorDescription) const
findEnResource method attempts to find resource in the local storage database
int linkedNotebookCount(ErrorString &errorDescription) const
linkedNotebookCount returns the number of linked notebooks stored in the local storage database.
ListObjectsOption
The ListObjectsOption enum is a QFlags enum which allows to specify the desired local storage element...
Definition: LocalStorageManager.h:139
LocalStorageManager(const Account &account, const StartupOptions options=0, QObject *parent=nullptr)
LocalStorageManager - constructor. Takes in the account for which the LocalStorageManager instance is...
int tagCount(ErrorString &errorDescription) const
tagCount returns the number of non-deleted tags currently stored in the local storage database.
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.
ListLinkedNotebooksOrder
The ListLinkedNotebooksOrder enum allows to specify the results ordering for methods listing linked n...
Definition: LocalStorageManager.h:716
Definition: NoteSearchQuery.h:31
Definition: Note.h:35
Definition: Notebook.h:35
Definition: Resource.h:30
Definition: SavedSearch.h:33
Definition: Tag.h:33
Definition: User.h:34