libquentier  0.5.0
The library for rich desktop clients of Evernote service
SavedSearch.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_TYPES_SAVED_SEARCH_H
20 #define LIB_QUENTIER_TYPES_SAVED_SEARCH_H
21 
22 #include "IFavoritableDataElement.h"
23 
24 #include <qt5qevercloud/QEverCloud.h>
25 
26 #include <QSharedDataPointer>
27 
28 namespace quentier {
29 
30 QT_FORWARD_DECLARE_CLASS(SavedSearchData)
31 
32 class QUENTIER_EXPORT SavedSearch: public IFavoritableDataElement
33 {
34 public:
35  QN_DECLARE_LOCAL_UID
36  QN_DECLARE_DIRTY
37  QN_DECLARE_LOCAL
38  QN_DECLARE_FAVORITED
39 
40 public:
41  using QueryFormat = qevercloud::QueryFormat;
42  using SavedSearchScope = qevercloud::SavedSearchScope;
43 
44 public:
45  explicit SavedSearch();
46  SavedSearch(const SavedSearch & other);
47  SavedSearch(SavedSearch && other);
48  SavedSearch & operator=(const SavedSearch & other);
49  SavedSearch & operator=(SavedSearch && other);
50 
51  explicit SavedSearch(const qevercloud::SavedSearch & search);
52  explicit SavedSearch(qevercloud::SavedSearch && search);
53 
54  virtual ~SavedSearch() override;
55 
56  const qevercloud::SavedSearch & qevercloudSavedSearch() const;
57  qevercloud::SavedSearch & qevercloudSavedSearch();
58 
59  bool operator==(const SavedSearch & other) const;
60  bool operator!=(const SavedSearch & other) const;
61 
62  virtual void clear() override;
63 
64  static bool validateName(
65  const QString & name, ErrorString * pErrorDescription = nullptr);
66 
67  virtual bool hasGuid() const override;
68  virtual const QString & guid() const override;
69  virtual void setGuid(const QString & guid) override;
70 
71  virtual bool hasUpdateSequenceNumber() const override;
72  virtual qint32 updateSequenceNumber() const override;
73  virtual void setUpdateSequenceNumber(const qint32 usn) override;
74 
75  virtual bool checkParameters(ErrorString & errorDescription) const override;
76 
77  bool hasName() const;
78  const QString & name() const;
79  void setName(const QString & name);
80 
81  bool hasQuery() const;
82  const QString & query() const;
83  void setQuery(const QString & query);
84 
85  bool hasQueryFormat() const;
86  QueryFormat queryFormat() const;
87  void setQueryFormat(const qint8 queryFormat);
88 
89  bool hasIncludeAccount() const;
90  bool includeAccount() const;
91  void setIncludeAccount(const bool includeAccount);
92 
93  bool hasIncludePersonalLinkedNotebooks() const;
94  bool includePersonalLinkedNotebooks() const;
95 
96  void setIncludePersonalLinkedNotebooks(
97  const bool includePersonalLinkedNotebooks);
98 
99  bool hasIncludeBusinessLinkedNotebooks() const;
100  bool includeBusinessLinkedNotebooks() const;
101 
102  void setIncludeBusinessLinkedNotebooks(
103  const bool includeBusinessLinkedNotebooks);
104 
105  virtual QTextStream & print(QTextStream & strm) const override;
106 
107 private:
108  QSharedDataPointer<SavedSearchData> d;
109 };
110 
111 } // namespace quentier
112 
113 Q_DECLARE_METATYPE(quentier::SavedSearch)
114 
115 #endif // LIB_QUENTIER_TYPES_SAVED_SEARCH_H
quentier::SavedSearch
Definition: SavedSearch.h:32
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43
quentier::IFavoritableDataElement
Definition: IFavoritableDataElement.h:31