summaryrefslogtreecommitdiffstats
path: root/common/domain/contact.cpp
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2017-01-11 13:06:55 +0100
committerSandro Knauß <sknauss@kde.org>2017-01-30 10:58:20 +0100
commitbb624c5ec2ab2e13dedcba67fd60e3d2f03216d7 (patch)
treeee27923e8bf1fa51a75599beaff7e005368180e0 /common/domain/contact.cpp
parent17d8b00ae32e2b1522c5dce6719566e4fbe3357e (diff)
downloadsink-bb624c5ec2ab2e13dedcba67fd60e3d2f03216d7.tar.gz
sink-bb624c5ec2ab2e13dedcba67fd60e3d2f03216d7.zip
Add Contact as new domain type
Diffstat (limited to 'common/domain/contact.cpp')
-rw-r--r--common/domain/contact.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/common/domain/contact.cpp b/common/domain/contact.cpp
new file mode 100644
index 0000000..ea7cac2
--- /dev/null
+++ b/common/domain/contact.cpp
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2017 Sandro Knauß <knauss@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19#include "contact.h"
20
21#include <QVector>
22#include <QByteArray>
23#include <QString>
24
25#include "../propertymapper.h"
26#include "../typeindex.h"
27#include "entity_generated.h"
28
29#include "contact_generated.h"
30
31using namespace Sink::ApplicationDomain;
32
33void TypeImplementation<Contact>::configure(TypeIndex &index)
34{
35 index.addProperty<QByteArray>(Contact::Uid::name);
36}
37
38void TypeImplementation<Contact>::configure(ReadPropertyMapper<Buffer> &propertyMapper)
39{
40 propertyMapper.addMapping<Contact::Uid, Buffer>(&Buffer::uid);
41 propertyMapper.addMapping<Contact::Fn, Buffer>(&Buffer::fn);
42 propertyMapper.addMapping<Contact::Emails, Buffer>(&Buffer::emails);
43 propertyMapper.addMapping<Contact::Vcard, Buffer>(&Buffer::vcard);
44}
45
46void TypeImplementation<Contact>::configure(WritePropertyMapper<BufferBuilder> &propertyMapper)
47{
48 propertyMapper.addMapping<Contact::Uid>(&BufferBuilder::add_uid);
49 propertyMapper.addMapping<Contact::Fn>(&BufferBuilder::add_fn);
50 propertyMapper.addMapping<Contact::Emails>(&BufferBuilder::add_emails);
51 propertyMapper.addMapping<Contact::Vcard>(&BufferBuilder::add_vcard);
52}
53
54void TypeImplementation<Contact>::configure(IndexPropertyMapper &)
55{
56
57}