swift
passivemutator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_SHAREDSTATE_PASSIVEMUTATOR_H
7 #define SWIFT_MISC_SHAREDSTATE_PASSIVEMUTATOR_H
8 
9 #include <QObject>
10 #include <QSharedPointer>
11 
12 #include "misc/swiftmiscexport.h"
13 #include "misc/variant.h"
14 
16 {
17  class CActiveMutator;
18 
23  class SWIFT_MISC_EXPORT CPassiveMutator : public QObject, public QEnableSharedFromThis<CPassiveMutator>
24  {
25  Q_OBJECT
26  friend CActiveMutator;
27  friend QSharedPointer<CPassiveMutator>;
28 
29  CPassiveMutator(QObject *parent) : QObject(parent) {}
30 
31  public:
33  static auto create(QObject *parent) { return QSharedPointer<CPassiveMutator>::create(parent); }
34 
36  void postEvent(const CVariant &param);
37 
39  QWeakPointer<const CPassiveMutator> weakRef() const { return sharedFromThis(); }
40 
41  signals:
43  void eventPosted(const swift::misc::CVariant &param);
44  };
45 } // namespace swift::misc::shared_state
46 
47 #endif // SWIFT_MISC_SHAREDSTATE_PASSIVEMUTATOR_H
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
Extends CPassiveMutator with the ability to respond to requests.
Definition: activemutator.h:25
Endpoint which can emit events to subscribers.
QWeakPointer< const CPassiveMutator > weakRef() const
Get a QWeakPointer pointing to this object.
static auto create(QObject *parent)
Factory method.
void eventPosted(const swift::misc::CVariant &param)
Emitted by postEvent.
Utilities for sharing state between multiple objects.
Definition: application.h:48
#define SWIFT_MISC_EXPORT
Export a class or function from the library.