TorqueScript  0.2
nativefunction.hpp
1 
15 #pragma once
16 
17 #include <string>
18 #include <vector>
19 #include <memory>
20 
21 #include <torquescript/function.hpp>
22 
23 namespace TorqueScript
24 {
25  typedef void (*NativeFunctionPointer)(std::shared_ptr<ConsoleObject> thisObject, std::shared_ptr<ExecutionState> state, const std::size_t argumentCount);
26 
31  class NativeFunction : public Function
32  {
33  public:
34  NativeFunction(NativeFunctionPointer native, const std::string& package, const std::string& space, const std::string& name);
35 
39  virtual void execute(std::shared_ptr<ConsoleObject> thisObject, std::shared_ptr<ExecutionState> state, const std::size_t argumentCount) override;
40 
41  private:
43  NativeFunctionPointer mNativeFunction;
44  };
45 }
A function is callable subroutine from anywhere in the language, defined by a script....
Definition: function.hpp:40
A NativeFunction is a specialization of Function that allows native C++ programming to be called from...
Definition: nativefunction.hpp:32
virtual void execute(std::shared_ptr< ConsoleObject > thisObject, std::shared_ptr< ExecutionState > state, const std::size_t argumentCount) override
Executes the native function provided to the interpreter.
Definition: ast.hpp:28