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