swift
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::from(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::from(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:446
void push_back(const T &value)
Appends an element at the end of the sequence.
Definition: sequence.h:305
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
bool isValid() const
True if this variant is valid.
Definition: variant.h:252
bool matches(const CVariant &event) const
If this is an event subscription, return true if it matches the given event.
static CVariant from(T &&value)
Synonym for fromValue().
Definition: variant.h:147
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.
Definition: listjournal.cpp:12
Utilities for sharing state between multiple objects.
Definition: application.h:48