diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-17 12:13:14 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-17 12:13:14 +0100 |
commit | f70e973ddb9b9d6e32d40436b55a20463e78b196 (patch) | |
tree | bc24801a7ecb8d0e9bb2233ff008dd16eba3ece3 /examples/dummyresource | |
parent | d3db7afcc31d850c3e3249ee188c18d2293de164 (diff) | |
download | sink-f70e973ddb9b9d6e32d40436b55a20463e78b196.tar.gz sink-f70e973ddb9b9d6e32d40436b55a20463e78b196.zip |
Use the terser version to express the same thing
Diffstat (limited to 'examples/dummyresource')
-rw-r--r-- | examples/dummyresource/domainadaptor.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/examples/dummyresource/domainadaptor.cpp b/examples/dummyresource/domainadaptor.cpp index 74b170d..839c4a7 100644 --- a/examples/dummyresource/domainadaptor.cpp +++ b/examples/dummyresource/domainadaptor.cpp | |||
@@ -28,21 +28,10 @@ DummyEventAdaptorFactory::DummyEventAdaptorFactory() | |||
28 | : DomainTypeAdaptorFactory() | 28 | : DomainTypeAdaptorFactory() |
29 | { | 29 | { |
30 | //TODO turn this into initializeReadPropertyMapper as well? | 30 | //TODO turn this into initializeReadPropertyMapper as well? |
31 | mResourceMapper->addMapping("summary", [](DummyEvent const *buffer) -> QVariant { | 31 | mResourceMapper->addMapping<QString, DummyEvent>("summary", &DummyEvent::summary); |
32 | return propertyToVariant<QString>(buffer->summary()); | 32 | mResourceMapper->addMapping<QString, DummyEvent>("remoteId", &DummyEvent::remoteId); |
33 | }); | 33 | mResourceWriteMapper->addMapping<QString>("summary", &DummyEventBuilder::add_summary); |
34 | mResourceMapper->addMapping("remoteId", [](DummyEvent const *buffer) -> QVariant { | 34 | mResourceWriteMapper->addMapping<QString>("remoteId", &DummyEventBuilder::add_remoteId); |
35 | return propertyToVariant<QString>(buffer->remoteId()); | ||
36 | }); | ||
37 | |||
38 | mResourceWriteMapper->addMapping("summary", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(DummyEventBuilder &)> { | ||
39 | auto offset = variantToProperty<QString>(value, fbb); | ||
40 | return [offset](DummyEventBuilder &builder) { builder.add_summary(offset); }; | ||
41 | }); | ||
42 | mResourceWriteMapper->addMapping("remoteId", [](const QVariant &value, flatbuffers::FlatBufferBuilder &fbb) -> std::function<void(DummyEventBuilder &)> { | ||
43 | auto offset = variantToProperty<QString>(value, fbb); | ||
44 | return [offset](DummyEventBuilder &builder) { builder.add_remoteId(offset); }; | ||
45 | }); | ||
46 | } | 35 | } |
47 | 36 | ||
48 | DummyMailAdaptorFactory::DummyMailAdaptorFactory() | 37 | DummyMailAdaptorFactory::DummyMailAdaptorFactory() |