28typedef struct _object PyObject;
65 std::string captureError()
const;
69 PyObject* globals_{
nullptr};
70 mutable std::string lastError_;
Python API — 与 Python C API 接口一致的动态加载包装
定义 PythonAPI.hpp:49
Python 脚本执行器
定义 PythonExecutor.hpp:38
脚本执行器,用于执行外部脚本
定义 ScriptExecutor.hpp:80
virtual std::string getLastError() const =0
获取最近一次执行脚本时的错误信息
virtual errc_t execute(StringView script, ScriptResult *resultOut=nullptr)=0
执行脚本语句
virtual errc_t initialize()=0
初始化脚本执行器
virtual errc_t setVariable(StringView name, StringView value)=0
设置脚本执行器的变量
virtual errc_t evaluate(StringView expression, ScriptResult *resultOut=nullptr)
对脚本表达式进行求值
定义 ScriptExecutor.cpp:111
virtual errc_t getVariable(StringView name, std::string &value) const =0
获取脚本执行器的字符串变量值
virtual void finalize()=0
结束脚本执行器
脚本执行结果
定义 ScriptExecutor.hpp:64