libquentier
0.5.0
The library for rich desktop clients of Evernote service
headers
quentier
types
ILocalStorageDataElement.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_LOCAL_STORAGE_DATA_ELEMENT_H
20
#define LIB_QUENTIER_TYPES_I_LOCAL_STORAGE_DATA_ELEMENT_H
21
22
#include <quentier/utility/Linkage.h>
23
#include <quentier/utility/Macros.h>
24
#include <quentier/utility/UidGenerator.h>
25
26
#include <QString>
27
#include <QUuid>
28
29
namespace
quentier {
30
31
class
QUENTIER_EXPORT
ILocalStorageDataElement
32
{
33
public
:
34
virtual
const
QString localUid()
const
= 0;
35
virtual
void
setLocalUid(
const
QString & guid) = 0;
36
virtual
void
unsetLocalUid() = 0;
37
38
virtual
~
ILocalStorageDataElement
() {}
39
};
40
41
#define DEFINE_LOCAL_UID_GETTER(type) \
42
const QString type::localUid() const { \
43
return UidGenerator::UidToString(d->m_localUid); \
44
} \
45
// DEFINE_LOCAL_UID_GETTER
46
47
#define DEFINE_LOCAL_UID_SETTER(type) \
48
void type::setLocalUid(const QString & uid) { \
49
d->m_localUid = uid; \
50
} \
51
// DEFINE_LOCAL_UID_SETTER
52
53
#define DEFINE_LOCAL_UID_UNSETTER(type) \
54
void type::unsetLocalUid() { \
55
d->m_localUid = QUuid(); \
56
} \
57
// DEFINE_LOCAL_UID_UNSETTER
58
59
#define QN_DECLARE_LOCAL_UID \
60
virtual const QString localUid() const override; \
61
virtual void setLocalUid(const QString & guid) override; \
62
virtual void unsetLocalUid() override; \
63
// QN_DECLARE_LOCAL_UID
64
65
#define QN_DEFINE_LOCAL_UID(type) \
66
DEFINE_LOCAL_UID_GETTER(type) \
67
DEFINE_LOCAL_UID_SETTER(type) \
68
DEFINE_LOCAL_UID_UNSETTER(type) \
69
// QN_DEFINE_LOCAL_UID
70
71
}
// namespace quentier
72
73
#endif // LIB_QUENTIER_TYPES_I_LOCAL_STORAGE_DATA_ELEMENT_H
quentier::ILocalStorageDataElement
Definition:
ILocalStorageDataElement.h:31
Generated on Wed Jun 17 2020 18:33:52 for libquentier by
1.8.17