Debian Codegraph @

plugins/script/interfaces/CommandSystemInterface.cpp

raw
1 #include "CommandSystemInterface.h"
2
3 #include "icommandsystem.h"
4 #include <pybind11/pybind11.h>
5
6 namespace script
7 {
8
9 void CommandSystemInterface::execute(const std::string& buffer)
10 {
11 // Just wrap the call
12 GlobalCommandSystem().execute(buffer);
13 }
14
15 void CommandSystemInterface::addStatement(const std::string& statementName, const std::string& str)
16 {
17 GlobalCommandSystem().addStatement(statementName, str);
18 }
19
20 void CommandSystemInterface::removeCommand(const std::string& name)
21 {
22 GlobalCommandSystem().removeCommand(name);
23 }
24
25 void CommandSystemInterface::registerInterface(py::module& scope, py::dict& globals)
26 {
27 pybind11::class_<CommandSystemInterface> commandSys(scope, "CommandSystem");
28
29 commandSys.def("execute", &CommandSystemInterface::execute);
30 commandSys.def("addStatement", &CommandSystemInterface::addStatement);
31 commandSys.def("removeCommand", &CommandSystemInterface::removeCommand);
32
33 // Now point the Python variable "GlobalCommandSystem" to this instance
34 globals["GlobalCommandSystem"] = this;
35 }
36
37 } // namespace script