Skip to content

kdbindings/property_updater.h

Namespaces

Name
KDBindings
The main namespace of the KDBindings library.

Classes

Name
class KDBindings::PropertyUpdater
A PropertyUpdater defines the interface used to update a Property, e.g. from a binding expression.

Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
  This file is part of KDBindings.

  SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
  Author: Sean Harmer <sean.harmer@kdab.com>

  SPDX-License-Identifier: MIT

  Contact KDAB at <info@kdab.com> for commercial licensing options.
*/

#pragma once

#include <functional>

namespace KDBindings {

template<typename T>
class PropertyUpdater
{
public:
    PropertyUpdater() = default;

    virtual ~PropertyUpdater() = default;

    PropertyUpdater(PropertyUpdater const &other) = default;
    PropertyUpdater &operator=(PropertyUpdater const &other) = default;

    PropertyUpdater(PropertyUpdater &&other) = default;
    PropertyUpdater &operator=(PropertyUpdater &&other) = default;

    virtual void setUpdateFunction(std::function<void(T &&)> const &updateFunction) = 0;

    virtual T get() const = 0;
};

} // namespace KDBindings

Updated on 2024-04-14 at 00:00:43 +0000