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