libquentier  0.5.0
The library for rich desktop clients of Evernote service
INoteStoreDataElement.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_I_NOTE_STORE_DATA_ELEMENT_H
20 #define LIB_QUENTIER_TYPES_I_NOTE_STORE_DATA_ELEMENT_H
21 
22 #include "ILocalStorageDataElement.h"
23 
24 #include <quentier/types/ErrorString.h>
25 #include <quentier/utility/Printable.h>
26 
27 #include <QUuid>
28 #include <QtGlobal>
29 
30 namespace quentier {
31 
32 class QUENTIER_EXPORT INoteStoreDataElement :
34  public Printable
35 {
36 public:
37  virtual void clear() = 0;
38 
39  virtual bool hasGuid() const = 0;
40  virtual const QString & guid() const = 0;
41  virtual void setGuid(const QString & guid) = 0;
42 
43  virtual bool hasUpdateSequenceNumber() const = 0;
44  virtual qint32 updateSequenceNumber() const = 0;
45  virtual void setUpdateSequenceNumber(const qint32 usn) = 0;
46 
47  virtual bool checkParameters(ErrorString & errorDescription) const = 0;
48 
49  virtual bool isDirty() const = 0;
50  virtual void setDirty(const bool dirty) = 0;
51 
52  virtual bool isLocal() const = 0;
53  virtual void setLocal(const bool local) = 0;
54 
55  virtual ~INoteStoreDataElement() {}
56 };
57 
58 #define DECLARE_IS_DIRTY \
59  virtual bool isDirty() const override; \
60  // DECLARE_IS_DIRTY
61 
62 #define DECLARE_SET_DIRTY \
63  virtual void setDirty(const bool isDirty) override; \
64  // DECLARE_SET_DIRTY
65 
66 #define QN_DECLARE_DIRTY \
67  DECLARE_IS_DIRTY \
68  DECLARE_SET_DIRTY \
69  // QN_DECLARE_DIRTY
70 
71 #define DEFINE_IS_DIRTY(type) \
72  bool type::isDirty() const \
73  { \
74  return d->m_isDirty; \
75  } \
76  // DEFINE_IS_DIRTY
77 
78 #define DEFINE_SET_DIRTY(type) \
79  void type::setDirty(const bool dirty) \
80  { \
81  d->m_isDirty = dirty; \
82  } \
83  // DEFINE_SET_DIRTY
84 
85 #define QN_DEFINE_DIRTY(type) \
86  DEFINE_IS_DIRTY(type) \
87  DEFINE_SET_DIRTY(type) \
88  // QN_DEFINE_DIRTY
89 
90 #define DECLARE_IS_LOCAL \
91  virtual bool isLocal() const override; \
92  // DECLARE_IS_LOCAL
93 
94 #define DECLARE_SET_LOCAL \
95  virtual void setLocal(const bool isLocal) override; \
96  // DECLARE_SET_LOCAL
97 
98 #define QN_DECLARE_LOCAL \
99  DECLARE_IS_LOCAL \
100  DECLARE_SET_LOCAL \
101  // QN_DECLARE_LOCAL
102 
103 #define DEFINE_IS_LOCAL(type) \
104  bool type::isLocal() const \
105  { \
106  return d->m_isLocal; \
107  } \
108  // DEFINE_IS_LOCAL
109 
110 #define DEFINE_SET_LOCAL(type) \
111  void type::setLocal(const bool local) \
112  { \
113  d->m_isLocal = local; \
114  } \
115  // DEFINE_SET_LOCAL
116 
117 #define QN_DEFINE_LOCAL(type) \
118  DEFINE_IS_LOCAL(type) \
119  DEFINE_SET_LOCAL(type) \
120  // QN_DEFINE_LOCAL
121 
122 } // namespace quentier
123 
124 #endif // LIB_QUENTIER_TYPES_I_NOTE_STORE_DATA_ELEMENT_H
Definition: INoteStoreDataElement.h:32
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43
Definition: DecryptedTextManager.h:26
The Printable class is the interface for Quentier&#39;s internal classes which should be able to write th...
Definition: Printable.h:37
Definition: ILocalStorageDataElement.h:30