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 <QtGlobal>
28 #include <QUuid>
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  return d->m_isDirty; \
74  } \
75 // DEFINE_IS_DIRTY
76 
77 #define DEFINE_SET_DIRTY(type) \
78  void type::setDirty(const bool dirty) { \
79  d->m_isDirty = dirty; \
80  } \
81 // DEFINE_SET_DIRTY
82 
83 #define QN_DEFINE_DIRTY(type) \
84  DEFINE_IS_DIRTY(type) \
85  DEFINE_SET_DIRTY(type) \
86 // QN_DEFINE_DIRTY
87 
88 #define DECLARE_IS_LOCAL \
89  virtual bool isLocal() const override; \
90 // DECLARE_IS_LOCAL
91 
92 #define DECLARE_SET_LOCAL \
93  virtual void setLocal(const bool isLocal) override; \
94 // DECLARE_SET_LOCAL
95 
96 #define QN_DECLARE_LOCAL \
97  DECLARE_IS_LOCAL \
98  DECLARE_SET_LOCAL \
99 // QN_DECLARE_LOCAL
100 
101 #define DEFINE_IS_LOCAL(type) \
102  bool type::isLocal() const { \
103  return d->m_isLocal; \
104  } \
105 // DEFINE_IS_LOCAL
106 
107 #define DEFINE_SET_LOCAL(type) \
108  void type::setLocal(const bool local) { \
109  d->m_isLocal = local; \
110  } \
111 // DEFINE_SET_LOCAL
112 
113 #define QN_DEFINE_LOCAL(type) \
114  DEFINE_IS_LOCAL(type) \
115  DEFINE_SET_LOCAL(type) \
116 // QN_DEFINE_LOCAL
117 
118 } // namespace quentier
119 
120 #endif // LIB_QUENTIER_TYPES_I_NOTE_STORE_DATA_ELEMENT_H
quentier::ILocalStorageDataElement
Definition: ILocalStorageDataElement.h:31
quentier::Printable
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:38
quentier::INoteStoreDataElement
Definition: INoteStoreDataElement.h:32
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43