The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
notifiee.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2010 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#pragma once
17
18namespace gui2
19{
20
21template <class T>
22class notifier;
23
24/**
25 * Helper class to implement callbacks with lifetime management.
26 *
27 * This part manages the lifetime off the callback.
28 */
29template <class FUNCTOR>
31{
32public:
33 typedef FUNCTOR functor_t;
34 friend class notifier<functor_t>;
35
36 notifiee() : notifier_(nullptr)
37 {
38 }
39
41 {
42 if(notifier_) {
44 }
45 }
46
47private:
48 /** Pointer the the notifier that's linked to us. */
50};
51
52} // namespace gui2
Helper class to implement callbacks with lifetime management.
Definition notifiee.hpp:31
notifier< functor_t > * notifier_
Pointer the the notifier that's linked to us.
Definition notifiee.hpp:49
FUNCTOR functor_t
Definition notifiee.hpp:33
Helper class to implement callbacks with lifetime management.
Definition notifier.hpp:35
void disconnect_notifiee(notifiee< functor_t > &target)
Disconnects a callback.
Definition notifier.hpp:77
Generic file dialog.