Debian Codegraph @

src/Scripting/NasalCondition.hxx

raw symbols SCIP
1 // SPDX-FileComment: expose SGCondition and SGBinding to Nasal
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 // Copyright (C) 2012 James Turner <[email protected]>
4
5 #pragma once
6
7 // std
8 #include <functional>
9
10 #include <simgear/nasal/nasal.h>
11 #include <simgear/structure/SGBinding.hxx>
12
13 naRef initNasalCondition(naRef globals, naContext c);
14
15 /**
16 * @brief implementation of SGAbstractBinding which
17 * invokes a Nasal callback. (without it being registered
18 * as a command).
19 *
20 * The binding argument properties are converted to a wrapped
21 * Nasal Props.Node before the binding is fired
22 *
23 */
24 class NasalBinding : public SGAbstractBinding
25 {
26 public:
27 using NasalCallback = std::function<void(naRef)>;
28
29 NasalBinding(NasalCallback cb) : m_callback(cb){};
30
31 private:
32 void innerFire() const override;
33
34 NasalCallback m_callback;
35 };