19 #ifndef LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H 20 #define LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H 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> 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)
51 QT_FORWARD_DECLARE_CLASS(ILocalStoragePatch)
52 QT_FORWARD_DECLARE_CLASS(LocalStorageManagerPrivate)
85 friend QUENTIER_EXPORT QTextStream & operator<<(
88 friend QUENTIER_EXPORT QDebug & operator<<(
91 friend QUENTIER_EXPORT QTextStream & operator<<(
92 QTextStream & strm,
const StartupOptions options);
94 friend QUENTIER_EXPORT QDebug & operator<<(
95 QDebug & dbg,
const StartupOptions options);
110 #
if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
111 const StartupOptions options = {},
113 const StartupOptions options = 0,
115 QObject * parent =
nullptr);
130 void upgradeProgress(
double progress);
148 ListElementsWithoutGuid = 4,
149 ListElementsWithGuid = 8,
152 ListFavoritedElements = 64,
153 ListNonFavoritedElements = 128
157 friend QUENTIER_EXPORT QTextStream & operator<<(
160 friend QUENTIER_EXPORT QDebug & operator<<(
163 friend QUENTIER_EXPORT QTextStream & operator<<(
164 QTextStream & strm,
const ListObjectsOptions options);
166 friend QUENTIER_EXPORT QDebug & operator<<(
167 QDebug & dbg,
const ListObjectsOptions options);
187 #
if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
188 const StartupOptions options = {});
190 const StartupOptions options = 0);
216 bool isLocalStorageVersionTooHigh(
ErrorString & errorDescription);
242 bool localStorageRequiresUpgrade(
ErrorString & errorDescription);
256 QVector<std::shared_ptr<ILocalStoragePatch>> requiredLocalStoragePatches();
270 qint32 localStorageVersion(
ErrorString & errorDescription);
279 qint32 highestSupportedLocalStorageVersion()
const;
291 int userCount(
ErrorString & errorDescription)
const;
372 int notebookCount(
ErrorString & errorDescription)
const;
457 bool findDefaultNotebook(
470 bool findLastUsedNotebook(
484 bool findDefaultOrLastUsedNotebook(
498 friend QUENTIER_EXPORT QTextStream & operator<<(
501 friend QUENTIER_EXPORT QDebug & operator<<(
510 ByUpdateSequenceNumber = 0,
513 ByModificationTimestamp,
517 friend QUENTIER_EXPORT QTextStream & operator<<(
520 friend QUENTIER_EXPORT QDebug & operator<<(
556 QList<Notebook> listAllNotebooks(
557 ErrorString & errorDescription,
const size_t limit = 0,
558 const size_t offset = 0,
561 const QString & linkedNotebookGuid = QString())
const;
596 QList<Notebook> listNotebooks(
597 const ListObjectsOptions flag,
ErrorString & errorDescription,
598 const size_t limit = 0,
const size_t offset = 0,
601 const QString & linkedNotebookGuid = QString())
const;
615 QList<SharedNotebook> listAllSharedNotebooks(
634 QList<SharedNotebook> listSharedNotebooksPerNotebookGuid(
635 const QString & notebookGuid,
ErrorString & errorDescription)
const;
671 int linkedNotebookCount(
ErrorString & errorDescription)
const;
686 bool addLinkedNotebook(
701 bool updateLinkedNotebook(
719 bool findLinkedNotebook(
728 ByUpdateSequenceNumber = 0,
734 friend QUENTIER_EXPORT QTextStream & operator<<(
737 friend QUENTIER_EXPORT QDebug & operator<<(
763 QList<LinkedNotebook> listAllLinkedNotebooks(
764 ErrorString & errorDescription,
const size_t limit = 0,
765 const size_t offset = 0,
767 ListLinkedNotebooksOrder::NoOrder,
768 const OrderDirection orderDirection = OrderDirection::Ascending)
const;
797 QList<LinkedNotebook> listLinkedNotebooks(
798 const ListObjectsOptions flag,
ErrorString & errorDescription,
799 const size_t limit = 0,
const size_t offset = 0,
801 ListLinkedNotebooksOrder::NoOrder,
802 const OrderDirection orderDirection = OrderDirection::Ascending)
const;
821 bool expungeLinkedNotebook(
830 IncludeNonDeletedNotes = 1,
831 IncludeDeletedNotes = 2
835 friend QUENTIER_EXPORT QTextStream & operator<<(
838 friend QUENTIER_EXPORT QDebug & operator<<(
841 friend QUENTIER_EXPORT QTextStream & operator<<(
842 QTextStream & strm,
const NoteCountOptions options);
844 friend QUENTIER_EXPORT QDebug & operator<<(
845 QDebug & strm,
const NoteCountOptions options);
861 const NoteCountOptions options =
862 NoteCountOption::IncludeNonDeletedNotes)
const;
880 int noteCountPerNotebook(
882 const NoteCountOptions options =
883 NoteCountOption::IncludeNonDeletedNotes)
const;
903 const NoteCountOptions options =
904 NoteCountOption::IncludeNonDeletedNotes)
const;
923 bool noteCountsPerAllTags(
924 QHash<QString, int> & noteCountsPerTagLocalUid,
926 const NoteCountOptions options =
927 NoteCountOption::IncludeNonDeletedNotes)
const;
947 int noteCountPerNotebooksAndTags(
948 const QStringList & notebookLocalUids,
const QStringList & tagLocalUids,
950 const NoteCountOptions options =
951 NoteCountOption::IncludeNonDeletedNotes)
const;
988 UpdateResourceMetadata = 1,
995 UpdateResourceBinaryData = 2,
1003 friend QUENTIER_EXPORT QTextStream & operator<<(
1006 friend QUENTIER_EXPORT QDebug & operator<<(
1009 friend QUENTIER_EXPORT QTextStream & operator<<(
1010 QTextStream & strm,
const UpdateNoteOptions options);
1012 friend QUENTIER_EXPORT QDebug & operator<<(
1013 QDebug & strm,
const UpdateNoteOptions options);
1057 Note & note,
const UpdateNoteOptions options,
1078 WithResourceMetadata = 1,
1085 WithResourceBinaryData = 2
1089 friend QUENTIER_EXPORT QTextStream & operator<<(
1092 friend QUENTIER_EXPORT QDebug & operator<<(
1095 friend QUENTIER_EXPORT QTextStream & operator<<(
1096 QTextStream & strm,
const GetNoteOptions options);
1098 friend QUENTIER_EXPORT QDebug & operator<<(
1099 QDebug & strm,
const GetNoteOptions options);
1111 Note & note,
const GetNoteOptions options,
1120 ByUpdateSequenceNumber = 0,
1122 ByCreationTimestamp,
1123 ByModificationTimestamp,
1124 ByDeletionTimestamp,
1127 BySourceApplication,
1133 friend QUENTIER_EXPORT QTextStream & operator<<(
1136 friend QUENTIER_EXPORT QDebug & operator<<(
1167 QList<Note> listNotesPerNotebook(
1168 const Notebook & notebook,
const GetNoteOptions options,
1170 const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1171 const size_t limit = 0,
const size_t offset = 0,
1174 OrderDirection::Ascending)
const;
1203 QList<Note> listNotesPerTag(
1204 const Tag & tag,
const GetNoteOptions options,
1206 const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1207 const size_t limit = 0,
const size_t offset = 0,
1210 OrderDirection::Ascending)
const;
1242 QList<Note> listNotesPerNotebooksAndTags(
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,
1249 OrderDirection::Ascending)
const;
1282 QList<Note> listNotesByLocalUids(
1283 const QStringList & noteLocalUids,
const GetNoteOptions options,
1285 const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1286 const size_t limit = 0,
const size_t offset = 0,
1289 OrderDirection::Ascending)
const;
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,
1331 const QString & linkedNotebookGuid = QString())
const;
1344 QStringList findNoteLocalUidsWithSearchQuery(
1363 NoteList findNotesWithSearchQuery(
1364 const NoteSearchQuery & noteSearchQuery,
const GetNoteOptions options,
1395 int tagCount(
ErrorString & errorDescription)
const;
1463 ByUpdateSequenceNumber,
1468 friend QUENTIER_EXPORT QTextStream & operator<<(
1471 friend QUENTIER_EXPORT QDebug & operator<<(
1502 QList<Tag> listAllTagsPerNote(
1504 const ListObjectsOptions & flag = ListObjectsOption::ListAll,
1505 const size_t limit = 0,
const size_t offset = 0,
1508 OrderDirection::Ascending)
const;
1540 QList<Tag> listAllTags(
1541 ErrorString & errorDescription,
const size_t limit = 0,
1542 const size_t offset = 0,
1545 const QString & linkedNotebookGuid = QString())
const;
1579 QList<Tag> listTags(
1580 const ListObjectsOptions flag,
ErrorString & errorDescription,
1581 const size_t limit = 0,
const size_t offset = 0,
1584 const QString & linkedNotebookGuid = QString())
const;
1624 QList<std::pair<Tag, QStringList>> listTagsWithNoteLocalUids(
1625 const ListObjectsOptions flag,
ErrorString & errorDescription,
1626 const size_t limit = 0,
const size_t offset = 0,
1629 const QString & linkedNotebookGuid = QString())
const;
1656 Tag & tag, QStringList & expungedChildTagLocalUids,
1669 bool expungeNotelessTagsFromLinkedNotebooks(
ErrorString & errorDescription);
1682 int enResourceCount(
ErrorString & errorDescription)
const;
1744 friend QUENTIER_EXPORT QTextStream & operator<<(
1747 friend QUENTIER_EXPORT QDebug & operator<<(
1750 friend QUENTIER_EXPORT QTextStream & operator<<(
1751 QTextStream & strm,
const GetResourceOptions options);
1753 friend QUENTIER_EXPORT QDebug & operator<<(
1754 QDebug & strm,
const GetResourceOptions options);
1774 bool findEnResource(
1775 Resource & resource,
const GetResourceOptions options,
1803 int savedSearchCount(
ErrorString & errorDescription)
const;
1841 bool updateSavedSearch(
1861 bool findSavedSearch(
1870 ByUpdateSequenceNumber = 0,
1876 friend QUENTIER_EXPORT QTextStream & operator<<(
1879 friend QUENTIER_EXPORT QDebug & operator<<(
1904 QList<SavedSearch> listAllSavedSearches(
1905 ErrorString & errorDescription,
const size_t limit = 0,
1906 const size_t offset = 0,
1908 const OrderDirection orderDirection = OrderDirection::Ascending)
const;
1939 QList<SavedSearch> listSavedSearches(
1940 const ListObjectsOptions flag,
ErrorString & errorDescription,
1941 const size_t limit = 0,
const size_t offset = 0,
1943 const OrderDirection orderDirection = OrderDirection::Ascending)
const;
1958 bool expungeSavedSearch(
1978 qint32 accountHighUsn(
1979 const QString & linkedNotebookGuid,
ErrorString & errorDescription);
1984 LocalStorageManagerPrivate *
const d_ptr;
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)
1995 #endif // LIB_QUENTIER_LOCAL_STORAGE_LOCAL_STORAGE_MANAGER_H ListLinkedNotebooksOrder
The ListLinkedNotebooksOrder enum allows to specify the results ordering for methods listing linked n...
Definition: LocalStorageManager.h:726
ListNotebooksOrder
The ListNotebooksOrder allows to specify the results ordering for methods listing notebooks from the ...
Definition: LocalStorageManager.h:508
GetNoteOption
The GetNoteOption enum is a QFlags enum which allows to specify which note fields should be included ...
Definition: LocalStorageManager.h:1071
ListObjectsOption
The ListObjectsOption enum is a QFlags enum which allows to specify the desired local storage element...
Definition: LocalStorageManager.h:143
Definition: LinkedNotebook.h:32
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43
UpdateNoteOption
The UpdateNoteOption enum is a QFlags enum which allows to specify which note fields should be update...
Definition: LocalStorageManager.h:981
Definition: Resource.h:29
ListTagsOrder
The ListTagsOrder enum allows to specify the results ordering for methods listing tags from the local...
Definition: LocalStorageManager.h:1461
Definition: DecryptedTextManager.h:26
NoteCountOption
The NoteCountOption enum is a QFlags enum which allows to specify some options for methods returning ...
Definition: LocalStorageManager.h:828
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:38
Definition: Notebook.h:34
ListNotesOrder
The ListNotesOrder enum allows to specify the results ordering for methods listing notes from the loc...
Definition: LocalStorageManager.h:1118
Definition: NoteSearchQuery.h:30
Definition: LocalStorageManager.h:36
OrderDirection
The OrderDirection enum specifies the direction of ordering of the results for methods listing the ob...
Definition: LocalStorageManager.h:492
Definition: LocalStorageManager.h:54
ListSavedSearchesOrder
The ListSavedSearchesOrder enum allows to specify the results ordering for methods listing saved sear...
Definition: LocalStorageManager.h:1868
Definition: SavedSearch.h:32
StartupOption
The StartupOption enum is a QFlags enum which allows to specify some options to be applied to the loc...
Definition: LocalStorageManager.h:63
GetResourceOption
The GetResourceOption enum is a QFlags enum which allows to specify which resource fields should be i...
Definition: LocalStorageManager.h:1734