libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
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/UidGenerator.h>
24
25#include <QString>
26#include <QUuid>
27
28namespace quentier {
29
30class QUENTIER_EXPORT ILocalStorageDataElement
31{
32public:
33 virtual const QString localUid() const = 0;
34 virtual void setLocalUid(const QString & guid) = 0;
35 virtual void unsetLocalUid() = 0;
36
37 virtual ~ILocalStorageDataElement() {}
38};
39
40#define DEFINE_LOCAL_UID_GETTER(type) \
41 const QString type::localUid() const \
42 { \
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 { \
50 d->m_localUid = uid; \
51 } \
52 // DEFINE_LOCAL_UID_SETTER
53
54#define DEFINE_LOCAL_UID_UNSETTER(type) \
55 void type::unsetLocalUid() \
56 { \
57 d->m_localUid = QUuid(); \
58 } \
59 // DEFINE_LOCAL_UID_UNSETTER
60
61#define QN_DECLARE_LOCAL_UID \
62 virtual const QString localUid() const override; \
63 virtual void setLocalUid(const QString & guid) override; \
64 virtual void unsetLocalUid() override; \
65 // QN_DECLARE_LOCAL_UID
66
67#define QN_DEFINE_LOCAL_UID(type) \
68 DEFINE_LOCAL_UID_GETTER(type) \
69 DEFINE_LOCAL_UID_SETTER(type) \
70 DEFINE_LOCAL_UID_UNSETTER(type) \
71 // QN_DEFINE_LOCAL_UID
72
73} // namespace quentier
74
75#endif // LIB_QUENTIER_TYPES_I_LOCAL_STORAGE_DATA_ELEMENT_H
Definition ILocalStorageDataElement.h:31