⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ambulantmodule.cpp

📁 彩信浏览器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		return NULL;	PyThreadState *_save = PyEval_SaveThread();	const char * _rv = _self->ob_itself->get_attribute(name);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("z",	                     _rv);	return _res;}static PyObject *nodeObj_get_attribute_2(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	std::string name;	char *name_cstr;	if (!PyArg_ParseTuple(_args, "s",	                      &name_cstr))		return NULL;	name = name_cstr;	PyThreadState *_save = PyEval_SaveThread();	const char * _rv = _self->ob_itself->get_attribute(name);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("z",	                     _rv);	return _res;}static PyObject *nodeObj_del_attribute(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	char* name;	if (!PyArg_ParseTuple(_args, "s",	                      &name))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->del_attribute(name);	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyObject *nodeObj_get_url(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	char* attrname;	if (!PyArg_ParseTuple(_args, "s",	                      &attrname))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	ambulant::net::url _rv = _self->ob_itself->get_url(attrname);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O",	                     ambulant_url_New(_rv));	return _res;}static PyObject *nodeObj_size(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	unsigned int _rv = _self->ob_itself->size();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("l",	                     _rv);	return _res;}static PyObject *nodeObj_get_path_display_desc(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	std::string _rv = _self->ob_itself->get_path_display_desc();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("s",	                     _rv.c_str());	return _res;}static PyObject *nodeObj_get_sig(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	std::string _rv = _self->ob_itself->get_sig();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("s",	                     _rv.c_str());	return _res;}static PyObject *nodeObj_xmlrepr(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	ambulant::lib::xml_string _rv = _self->ob_itself->xmlrepr();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("s",	                     _rv.c_str());	return _res;}static PyObject *nodeObj_get_context(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	if (!PyArg_ParseTuple(_args, ""))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	const ambulant::lib::node_context* _rv = _self->ob_itself->get_context();	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O&",	                     node_contextObj_New, _rv);	return _res;}static PyObject *nodeObj_set_context(nodeObject *_self, PyObject *_args){	PyObject *_res = NULL;	ambulant::lib::node_context* c;	if (!PyArg_ParseTuple(_args, "O&",	                      node_contextObj_Convert, &c))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	_self->ob_itself->set_context(c);	PyEval_RestoreThread(_save);	Py_INCREF(Py_None);	_res = Py_None;	return _res;}static PyMethodDef nodeObj_methods[] = {	{"down_1", (PyCFunction)nodeObj_down_1, 1,	 PyDoc_STR("() -> (const ambulant::lib::node* _rv)")},	{"up_1", (PyCFunction)nodeObj_up_1, 1,	 PyDoc_STR("() -> (const ambulant::lib::node* _rv)")},	{"next_1", (PyCFunction)nodeObj_next_1, 1,	 PyDoc_STR("() -> (const ambulant::lib::node* _rv)")},	{"down_2", (PyCFunction)nodeObj_down_2, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"up_2", (PyCFunction)nodeObj_up_2, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"next_2", (PyCFunction)nodeObj_next_2, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"down_3", (PyCFunction)nodeObj_down_3, 1,	 PyDoc_STR("(ambulant::lib::node* n) -> None")},	{"up_3", (PyCFunction)nodeObj_up_3, 1,	 PyDoc_STR("(ambulant::lib::node* n) -> None")},	{"next_3", (PyCFunction)nodeObj_next_3, 1,	 PyDoc_STR("(ambulant::lib::node* n) -> None")},	{"previous", (PyCFunction)nodeObj_previous, 1,	 PyDoc_STR("() -> (const ambulant::lib::node* _rv)")},	{"get_last_child", (PyCFunction)nodeObj_get_last_child, 1,	 PyDoc_STR("() -> (const ambulant::lib::node* _rv)")},	{"locate_node", (PyCFunction)nodeObj_locate_node, 1,	 PyDoc_STR("(char* path) -> (ambulant::lib::node* _rv)")},	{"get_first_child_1", (PyCFunction)nodeObj_get_first_child_1, 1,	 PyDoc_STR("(char* name) -> (ambulant::lib::node* _rv)")},	{"get_first_child_2", (PyCFunction)nodeObj_get_first_child_2, 1,	 PyDoc_STR("(char* name) -> (const ambulant::lib::node* _rv)")},	{"get_root", (PyCFunction)nodeObj_get_root, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"get_container_attribute", (PyCFunction)nodeObj_get_container_attribute, 1,	 PyDoc_STR("(char* name) -> (const char * _rv)")},	{"append_child_1", (PyCFunction)nodeObj_append_child_1, 1,	 PyDoc_STR("(ambulant::lib::node* child) -> (ambulant::lib::node* _rv)")},	{"append_child_2", (PyCFunction)nodeObj_append_child_2, 1,	 PyDoc_STR("(char* name) -> (ambulant::lib::node* _rv)")},	{"detach", (PyCFunction)nodeObj_detach, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"clone", (PyCFunction)nodeObj_clone, 1,	 PyDoc_STR("() -> (ambulant::lib::node* _rv)")},	{"append_data_1", (PyCFunction)nodeObj_append_data_1, 1,	 PyDoc_STR("(Buffer data) -> None")},	{"append_data_2", (PyCFunction)nodeObj_append_data_2, 1,	 PyDoc_STR("(char* c_str) -> None")},	{"append_data_3", (PyCFunction)nodeObj_append_data_3, 1,	 PyDoc_STR("(ambulant::lib::xml_string str) -> None")},	{"set_attribute_1", (PyCFunction)nodeObj_set_attribute_1, 1,	 PyDoc_STR("(char* name, char* value) -> None")},	{"set_attribute_2", (PyCFunction)nodeObj_set_attribute_2, 1,	 PyDoc_STR("(char* name, ambulant::lib::xml_string value) -> None")},	{"set_namespace", (PyCFunction)nodeObj_set_namespace, 1,	 PyDoc_STR("(ambulant::lib::xml_string ns) -> None")},	{"get_namespace", (PyCFunction)nodeObj_get_namespace, 1,	 PyDoc_STR("() -> (const ambulant::lib::xml_string& _rv)")},	{"get_local_name", (PyCFunction)nodeObj_get_local_name, 1,	 PyDoc_STR("() -> (const ambulant::lib::xml_string& _rv)")},	{"get_qname", (PyCFunction)nodeObj_get_qname, 1,	 PyDoc_STR("() -> (const ambulant::lib::q_name_pair& _rv)")},	{"get_numid", (PyCFunction)nodeObj_get_numid, 1,	 PyDoc_STR("() -> (int _rv)")},	{"get_data", (PyCFunction)nodeObj_get_data, 1,	 PyDoc_STR("() -> (const ambulant::lib::xml_string& _rv)")},	{"get_trimmed_data", (PyCFunction)nodeObj_get_trimmed_data, 1,	 PyDoc_STR("() -> (ambulant::lib::xml_string _rv)")},	{"get_attribute_1", (PyCFunction)nodeObj_get_attribute_1, 1,	 PyDoc_STR("(char* name) -> (const char * _rv)")},	{"get_attribute_2", (PyCFunction)nodeObj_get_attribute_2, 1,	 PyDoc_STR("(std::string name) -> (const char * _rv)")},	{"del_attribute", (PyCFunction)nodeObj_del_attribute, 1,	 PyDoc_STR("(char* name) -> None")},	{"get_url", (PyCFunction)nodeObj_get_url, 1,	 PyDoc_STR("(char* attrname) -> (ambulant::net::url _rv)")},	{"size", (PyCFunction)nodeObj_size, 1,	 PyDoc_STR("() -> (unsigned int _rv)")},	{"get_path_display_desc", (PyCFunction)nodeObj_get_path_display_desc, 1,	 PyDoc_STR("() -> (std::string _rv)")},	{"get_sig", (PyCFunction)nodeObj_get_sig, 1,	 PyDoc_STR("() -> (std::string _rv)")},	{"xmlrepr", (PyCFunction)nodeObj_xmlrepr, 1,	 PyDoc_STR("() -> (ambulant::lib::xml_string _rv)")},	{"get_context", (PyCFunction)nodeObj_get_context, 1,	 PyDoc_STR("() -> (const ambulant::lib::node_context* _rv)")},	{"set_context", (PyCFunction)nodeObj_set_context, 1,	 PyDoc_STR("(ambulant::lib::node_context* c) -> None")},	{NULL, NULL, 0}};#define nodeObj_getsetlist NULLstatic int nodeObj_compare(nodeObject *self, nodeObject *other){	if ( self->ob_itself > other->ob_itself ) return 1;	if ( self->ob_itself < other->ob_itself ) return -1;	return 0;}#define nodeObj_repr NULLstatic int nodeObj_hash(nodeObject *self){	return (int)self->ob_itself;}static int nodeObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds){	ambulant::lib::node* itself;	Py_KEYWORDS_STRING_TYPE *kw[] = {"itself", 0};	if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, nodeObj_Convert, &itself))	{		((nodeObject *)_self)->ob_itself = itself;		return 0;	}	return -1;}#define nodeObj_tp_alloc PyType_GenericAllocstatic PyObject *nodeObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds){	PyObject *_self;	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;	((nodeObject *)_self)->ob_itself = NULL;	return _self;}#define nodeObj_tp_free PyObject_DelPyTypeObject node_Type = {	PyObject_HEAD_INIT(NULL)	0, /*ob_size*/	"ambulant.node", /*tp_name*/	sizeof(nodeObject), /*tp_basicsize*/	0, /*tp_itemsize*/	/* methods */	(destructor) nodeObj_dealloc, /*tp_dealloc*/	0, /*tp_print*/	(getattrfunc)0, /*tp_getattr*/	(setattrfunc)0, /*tp_setattr*/	(cmpfunc) nodeObj_compare, /*tp_compare*/	(reprfunc) nodeObj_repr, /*tp_repr*/	(PyNumberMethods *)0, /* tp_as_number */	(PySequenceMethods *)0, /* tp_as_sequence */	(PyMappingMethods *)0, /* tp_as_mapping */	(hashfunc) nodeObj_hash, /*tp_hash*/	0, /*tp_call*/	0, /*tp_str*/	PyObject_GenericGetAttr, /*tp_getattro*/	PyObject_GenericSetAttr, /*tp_setattro */	0, /*tp_as_buffer*/	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */	0, /*tp_doc*/	0, /*tp_traverse*/	0, /*tp_clear*/	0, /*tp_richcompare*/	0, /*tp_weaklistoffset*/	0, /*tp_iter*/	0, /*tp_iternext*/	nodeObj_methods, /* tp_methods */	0, /*tp_members*/	nodeObj_getsetlist, /*tp_getset*/	0, /*tp_base*/	0, /*tp_dict*/	0, /*tp_descr_get*/	0, /*tp_descr_set*/	0, /*tp_dictoffset*/	nodeObj_tp_init, /* tp_init */	nodeObj_tp_alloc, /* tp_alloc */	nodeObj_tp_new, /* tp_new */	nodeObj_tp_free, /* tp_free */};/* ---------------------- End object type node ---------------------- *//* -------------------- Object type node_factory -------------------- */extern PyTypeObject node_factory_Type;inline bool node_factoryObj_Check(PyObject *x){	return ((x)->ob_type == &node_factory_Type);}typedef struct node_factoryObject {	PyObject_HEAD	void *ob_dummy_wrapper; // Overlays bridge object storage	ambulant::lib::node_factory* ob_itself;} node_factoryObject;PyObject *node_factoryObj_New(ambulant::lib::node_factory* itself){	node_factoryObject *it;	if (itself == NULL)	{		Py_INCREF(Py_None);		return Py_None;	}#ifdef BGEN_BACK_SUPPORT_node_factory	node_factory *encaps_itself = dynamic_cast<node_factory *>(itself);	if (encaps_itself && encaps_itself->py_node_factory)	{		Py_INCREF(encaps_itself->py_node_factory);		return encaps_itself->py_node_factory;	}#endif	it = PyObject_NEW(node_factoryObject, &node_factory_Type);	if (it == NULL) return NULL;	/* XXXX Should we tp_init or tp_new our basetype? */	it->ob_dummy_wrapper = NULL; // XXXX Should be done in base class	it->ob_itself = itself;	return (PyObject *)it;}int node_factoryObj_Convert(PyObject *v, ambulant::lib::node_factory* *p_itself){	if (v == Py_None)	{		*p_itself = NULL;		return 1;	}#ifdef BGEN_BACK_SUPPORT_node_factory	if (!node_factoryObj_Check(v))	{		*p_itself = Py_WrapAs_node_factory(v);		if (*p_itself) return 1;	}#endif	if (!node_factoryObj_Check(v))	{		PyErr_SetString(PyExc_TypeError, "node_factory required");		return 0;	}	*p_itself = ((node_factoryObject *)v)->ob_itself;	return 1;}static void node_factoryObj_dealloc(node_factoryObject *self){	pycppbridge_Type.tp_dealloc((PyObject *)self);}static PyObject *node_factoryObj_new_node_1(node_factoryObject *_self, PyObject *_args){	PyObject *_res = NULL;	ambulant::lib::q_name_pair qn;	ambulant::lib::q_attributes_list qattrs;	ambulant::lib::node_context* ctx;	ambulant::lib::xml_string qn_first;	ambulant::lib::xml_string qn_second;	char *qn_first_cstr;	char *qn_second_cstr;	if (!PyArg_ParseTuple(_args, "(ss)O&O&",	                      &qn_first_cstr, &qn_second_cstr,	                      ambulant_attributes_list_Convert, &qattrs,	                      node_contextObj_Convert, &ctx))		return NULL;	qn_first = qn_first_cstr;	qn_second = qn_second_cstr;	qn = ambulant::lib::q_name_pair(qn_first, qn_second);	PyThreadState *_save = PyEval_SaveThread();	ambulant::lib::node* _rv = _self->ob_itself->new_node(qn,	                                                      qattrs,	                                                      ctx);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O&",	                     nodeObj_New, _rv);	return _res;}static PyObject *node_factoryObj_new_node_2(node_factoryObject *_self, PyObject *_args){	PyObject *_res = NULL;	ambulant::lib::node* other;	if (!PyArg_ParseTuple(_args, "O&",	                      nodeObj_Convert, &other))		return NULL;	PyThreadState *_save = PyEval_SaveThread();	ambulant::lib::node* _rv = _self->ob_itself->new_node(other);	PyEval_RestoreThread(_save);	_res = Py_BuildValue("O&",	                     nodeObj_New, _rv);	return _res;}static PyMethodDef node_factoryObj_methods[] = {	{"new_node_1", (PyCFunction)node_factoryObj_new_node_1, 1,	 PyDoc_STR("(ambulant::lib::q_name_pair qn, ambulant::lib::q_attributes_list qattrs, ambulant::lib::node_context* ctx) -> (ambulant::lib::node* _rv)")},	{"new_node_2", (PyCFunction)node_factoryObj_new_node_2, 1,	 PyDoc_STR("(ambulant::lib::node* other) -> (ambulant::lib::node* _rv)")},	{NULL, NULL, 0}};#define node_factoryObj_getsetlist NULLstatic int node_factoryObj_compare(node_factoryObject *self, node_factoryObject *other){	if ( self->ob_itself > other->ob_itself ) return 1;	if ( self->ob_itself < other->ob_itself ) return -1;	return 0;}#define node_factoryObj_repr NULLstatic int node_factoryObj_hash(node_factoryObject *self){	return (int)self->ob_itself;}static int node_factoryObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds){	ambulant::lib::node_factory* itself;	Py_KEYWORDS_STRING_TYPE *kw[] = {"itself", 0};	if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, node_factoryObj_Convert, &itself))	{		((node_factoryObject *)_self)->ob_itself = itself;		return 0;	}	return -1;}#define node_factoryObj_tp_alloc PyType_GenericAlloc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -