📄 ambulantinterface.cpp
字号:
} if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::get_last_child() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::locate_node(const char* path){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_path = Py_BuildValue("s", path); PyObject *py_rv = PyObject_CallMethod(py_node, "locate_node", "(O)", py_path); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::locate_node() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::locate_node() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_path); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::get_first_child(const char* name){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_name = Py_BuildValue("s", name); PyObject *py_rv = PyObject_CallMethod(py_node, "get_first_child", "(O)", py_name); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_first_child() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::get_first_child() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); PyGILState_Release(_GILState); return _rv;}const ambulant::lib::node* node::get_first_child(const char* name) const{ PyGILState_STATE _GILState = PyGILState_Ensure(); const ambulant::lib::node* _rv; PyObject *py_name = Py_BuildValue("s", name); PyObject *py_rv = PyObject_CallMethod(py_node, "get_first_child", "(O)", py_name); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_first_child() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::get_first_child() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::get_root(){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_rv = PyObject_CallMethod(py_node, "get_root", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_root() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::get_root() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); PyGILState_Release(_GILState); return _rv;}const char * node::get_container_attribute(const char* name) const{ PyGILState_STATE _GILState = PyGILState_Ensure(); const char * _rv; PyObject *py_name = Py_BuildValue("s", name); PyObject *py_rv = PyObject_CallMethod(py_node, "get_container_attribute", "(O)", py_name); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_container_attribute() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "z", &_rv)) { PySys_WriteStderr("Python exception during node::get_container_attribute() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::append_child(ambulant::lib::node* child){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_child = Py_BuildValue("O&", nodeObj_New, child); PyObject *py_rv = PyObject_CallMethod(py_node, "append_child", "(O)", py_child); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::append_child() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::append_child() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_child); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::append_child(const char* name){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_name = Py_BuildValue("s", name); PyObject *py_rv = PyObject_CallMethod(py_node, "append_child", "(O)", py_name); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::append_child() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::append_child() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::detach(){ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_rv = PyObject_CallMethod(py_node, "detach", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::detach() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::detach() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); PyGILState_Release(_GILState); return _rv;}ambulant::lib::node* node::clone() const{ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::node* _rv; PyObject *py_rv = PyObject_CallMethod(py_node, "clone", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::clone() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "O&", nodeObj_Convert, &_rv)) { PySys_WriteStderr("Python exception during node::clone() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); PyGILState_Release(_GILState); return _rv;}void node::append_data(const char *data__in__, size_t data__len__){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_data = Py_BuildValue("s#", data__in__, (int)data__len__); PyObject *py_rv = PyObject_CallMethod(py_node, "append_data", "(O)", py_data); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::append_data() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_data); PyGILState_Release(_GILState);}void node::append_data(const char* c_str){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_c_str = Py_BuildValue("s", c_str); PyObject *py_rv = PyObject_CallMethod(py_node, "append_data", "(O)", py_c_str); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::append_data() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_c_str); PyGILState_Release(_GILState);}void node::append_data(const ambulant::lib::xml_string& str){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_str = Py_BuildValue("s", str.c_str()); PyObject *py_rv = PyObject_CallMethod(py_node, "append_data", "(O)", py_str); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::append_data() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_str); PyGILState_Release(_GILState);}void node::set_attribute(const char* name, const char* value){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_name = Py_BuildValue("s", name); PyObject *py_value = Py_BuildValue("s", value); PyObject *py_rv = PyObject_CallMethod(py_node, "set_attribute", "(OO)", py_name, py_value); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::set_attribute() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); Py_XDECREF(py_value); PyGILState_Release(_GILState);}void node::set_attribute(const char* name, const ambulant::lib::xml_string& value){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_name = Py_BuildValue("s", name); PyObject *py_value = Py_BuildValue("s", value.c_str()); PyObject *py_rv = PyObject_CallMethod(py_node, "set_attribute", "(OO)", py_name, py_value); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::set_attribute() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_name); Py_XDECREF(py_value); PyGILState_Release(_GILState);}void node::set_namespace(const ambulant::lib::xml_string& ns){ PyGILState_STATE _GILState = PyGILState_Ensure(); PyObject *py_ns = Py_BuildValue("s", ns.c_str()); PyObject *py_rv = PyObject_CallMethod(py_node, "set_namespace", "(O)", py_ns); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::set_namespace() callback:\n"); PyErr_Print(); } Py_XDECREF(py_rv); Py_XDECREF(py_ns); PyGILState_Release(_GILState);}const ambulant::lib::xml_string& node::get_namespace() const{ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::xml_string get_namespace; PyObject *py_rv = PyObject_CallMethod(py_node, "get_namespace", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_namespace() callback:\n"); PyErr_Print(); } char *get_namespace_cstr; if (py_rv && !PyArg_Parse(py_rv, "s", &get_namespace_cstr)) { PySys_WriteStderr("Python exception during node::get_namespace() return:\n"); PyErr_Print(); } get_namespace = get_namespace_cstr; Py_XDECREF(py_rv); PyGILState_Release(_GILState); const_cast<node *>(this)->get_namespace_rvkeepref = get_namespace; return get_namespace_rvkeepref;}const ambulant::lib::xml_string& node::get_local_name() const{ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::xml_string get_local_name; PyObject *py_rv = PyObject_CallMethod(py_node, "get_local_name", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_local_name() callback:\n"); PyErr_Print(); } char *get_local_name_cstr; if (py_rv && !PyArg_Parse(py_rv, "s", &get_local_name_cstr)) { PySys_WriteStderr("Python exception during node::get_local_name() return:\n"); PyErr_Print(); } get_local_name = get_local_name_cstr; Py_XDECREF(py_rv); PyGILState_Release(_GILState); const_cast<node *>(this)->get_local_name_rvkeepref = get_local_name; return get_local_name_rvkeepref;}const ambulant::lib::q_name_pair& node::get_qname() const{ PyGILState_STATE _GILState = PyGILState_Ensure(); ambulant::lib::q_name_pair get_qname; PyObject *py_rv = PyObject_CallMethod(py_node, "get_qname", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_qname() callback:\n"); PyErr_Print(); } ambulant::lib::xml_string get_qname_first; ambulant::lib::xml_string get_qname_second; char *get_qname_first_cstr; char *get_qname_second_cstr; if (py_rv && !PyArg_Parse(py_rv, "(ss)", &get_qname_first_cstr, &get_qname_second_cstr)) { PySys_WriteStderr("Python exception during node::get_qname() return:\n"); PyErr_Print(); } get_qname_first = get_qname_first_cstr; get_qname_second = get_qname_second_cstr; get_qname = ambulant::lib::q_name_pair(get_qname_first, get_qname_second); Py_XDECREF(py_rv); PyGILState_Release(_GILState); const_cast<node *>(this)->get_qname_rvkeepref = get_qname; return get_qname_rvkeepref;}int node::get_numid() const{ PyGILState_STATE _GILState = PyGILState_Ensure(); int _rv; PyObject *py_rv = PyObject_CallMethod(py_node, "get_numid", "()"); if (PyErr_Occurred()) { PySys_WriteStderr("Python exception during node::get_numid() callback:\n"); PyErr_Print(); } if (py_rv && !PyArg_Parse(py_rv, "i", &_rv)) { PySys_WriteStderr("Python exception during node::get_numid() return:\n"); PyErr_Print(); } Py_XDECREF(py_rv); PyGILState_Release(_GILState);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -