swift
Loading...
Searching...
No Matches
listjournal.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
7
9
11{
13 {
14 dataLink->publish(m_mutator.data());
15 dataLink->subscribe(m_observer.data());
16 m_observer->setEventSubscription(CVariant::fromValue(CAnyMatch()));
17 }
18
19 CVariant CGenericListJournal::handleRequest(const CVariant &filter)
20 {
21 CVariantList copy = m_value;
22 if (filter.isValid())
23 {
24 copy.removeIf([&filter](const CVariant &v) { return !filter.matches(v); });
25 }
26 return CVariant::fromValue(copy);
27 }
28
29 void CGenericListJournal::handleEvent(const CVariant &param) { m_value.push_back(param); }
30} // namespace swift::misc::shared_state
int removeIf(Predicate p)
Remove elements for which a given predicate returns true.
Definition sequence.h:458
void push_back(const T &value)
Appends an element at the end of the sequence.
Definition sequence.h:308
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition variant.h:69
static CVariant fromValue(T &&value)
Construct a variant from a value.
Definition variant.h:139
Value object encapsulating a list of variants.
Definition variantlist.h:29
Dummy value class that matches any event.
void initialize(IDataLink *)
Publish using the given transport mechanism.
Utilities for sharing state between multiple objects.
Definition application.h:48