本文整理汇总了C++中Proxy::streamFileToClient方法的典型用法代码示例。如果您正苦于以下问题:C++ Proxy::streamFileToClient方法的具体用法?C++ Proxy::streamFileToClient怎么用?C++ Proxy::streamFileToClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::streamFileToClient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PyTuple_Size
//-------------------------------------------------------------------------------------
PyObject* Proxy::__py_pyStreamFileToClient(PyObject* self, PyObject* args)
{
uint16 currargsSize = PyTuple_Size(args);
Proxy* pobj = static_cast<Proxy*>(self);
if(pobj->clientMailbox() == NULL)
{
PyErr_Format(PyExc_AssertionError,
"Proxy::streamStringToClient: has no client.");
PyErr_PrintEx(0);
return NULL;
}
if(currargsSize > 3 || currargsSize == 0)
{
PyErr_Format(PyExc_AssertionError,
"Proxy::streamFileToClient: args max require 3, gived %d! is script[%s].\n",
currargsSize, pobj->scriptName());
PyErr_PrintEx(0);
return NULL;
}
PyObject* pyResourceName = NULL;
PyObject* pyDesc = NULL;
int16 id = -1;
if(currargsSize == 1)
{
if(PyArg_ParseTuple(args, "O", &pyResourceName) == -1)
{
PyErr_Format(PyExc_TypeError, "Proxy::streamFileToClient: args is error!");
PyErr_PrintEx(0);
return NULL;
}
}
else if(currargsSize == 2)
{
if(PyArg_ParseTuple(args, "O|O", &pyResourceName, &pyDesc) == -1)
{
PyErr_Format(PyExc_TypeError, "Proxy::streamFileToClient: args is error!");
PyErr_PrintEx(0);
return NULL;
}
}
else if(currargsSize == 3)
{
if(PyArg_ParseTuple(args, "O|O|H", &pyResourceName, &pyDesc, &id) == -1)
{
PyErr_Format(PyExc_TypeError, "Proxy::streamFileToClient: args is error!");
PyErr_PrintEx(0);
return NULL;
}
}
char* pDescr = NULL;
if(pDescr != NULL)
{
wchar_t* PyUnicode_AsWideCharStringRet1 = PyUnicode_AsWideCharString(pyDesc, NULL);
pDescr = strutil::wchar2char(PyUnicode_AsWideCharStringRet1);
PyMem_Free(PyUnicode_AsWideCharStringRet1);
}
if(pDescr && strlen(pDescr) > 255)
{
PyErr_Format(PyExc_TypeError, "Proxy::streamFileToClient: the descr-size(%d > 255)!",
strlen(pDescr));
PyErr_PrintEx(0);
free(pDescr);
return NULL;
}
int16 rid = pobj->streamFileToClient(pyResourceName,
(pDescr == NULL ? "" : pDescr),
id);
if(pDescr)
free(pDescr);
return PyLong_FromLong(rid);
}