Back to index

lightning-sunbird  0.9+nobinonly
Functions
PyIInterfaceInfo.cpp File Reference
#include "PyXPCOM_std.h"

Go to the source code of this file.

Functions

static nsIInterfaceInfoGetI (PyObject *self)
static PyObject * PyGetName (PyObject *self, PyObject *args)
static PyObject * PyGetIID (PyObject *self, PyObject *args)
static PyObject * PyIsScriptable (PyObject *self, PyObject *args)
static PyObject * PyGetParent (PyObject *self, PyObject *args)
static PyObject * PyGetMethodCount (PyObject *self, PyObject *args)
static PyObject * PyGetConstantCount (PyObject *self, PyObject *args)
static PyObject * PyGetMethodInfo (PyObject *self, PyObject *args)
static PyObject * PyGetMethodInfoForName (PyObject *self, PyObject *args)
static PyObject * PyGetConstant (PyObject *self, PyObject *args)
static PRBool __GetMethodInfoHelper (nsIInterfaceInfo *pii, int mi, int pi, const nsXPTMethodInfo **ppmi)
static PyObject * PyGetInfoForParam (PyObject *self, PyObject *args)
static PyObject * PyGetIIDForParam (PyObject *self, PyObject *args)
static PyObject * PyGetTypeForParam (PyObject *self, PyObject *args)
static PyObject * PyGetSizeIsArgNumberForParam (PyObject *self, PyObject *args)
static PyObject * PyGetLengthIsArgNumberForParam (PyObject *self, PyObject *args)
static PyObject * PyGetInterfaceIsArgNumberForParam (PyObject *self, PyObject *args)

Function Documentation

static PRBool __GetMethodInfoHelper ( nsIInterfaceInfo pii,
int  mi,
int  pi,
const nsXPTMethodInfo **  ppmi 
) [static]

Definition at line 254 of file PyIInterfaceInfo.cpp.

{
       PRUint16 nmethods=0;
       pii->GetMethodCount(&nmethods);
       if (mi<0 || mi>=nmethods) {
              PyErr_SetString(PyExc_ValueError, "The method index is out of range");
              return PR_FALSE;
       }
       const nsXPTMethodInfo *pmi;
       nsresult r = pii->GetMethodInfo(mi, &pmi);
       if ( NS_FAILED(r) ) {
              PyXPCOM_BuildPyException(r);
              return PR_FALSE;
       }

       int nparams=0;
       nparams = pmi->GetParamCount();
       if (pi<0 || pi>=nparams) {
              PyErr_SetString(PyExc_ValueError, "The param index is out of range");
              return PR_FALSE;
       }
       *ppmi = pmi;
       return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIInterfaceInfo* GetI ( PyObject *  self) [static]

Definition at line 51 of file PyIInterfaceInfo.cpp.

                                              {
       nsIID iid = NS_GET_IID(nsIInterfaceInfo);

       if (!Py_nsISupports::Check(self, iid)) {
              PyErr_SetString(PyExc_TypeError, "This object is not the correct interface");
              return NULL;
       }
       return (nsIInterfaceInfo *)Py_nsISupports::GetI(self);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* PyGetConstant ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 234 of file PyIInterfaceInfo.cpp.

{
       PRUint16 index;
       if (!PyArg_ParseTuple(args, "h:GetConstant", &index))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       const nsXPTConstant *pRet;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetConstant(index, &pRet);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return PyObject_FromXPTConstant(pRet);
}

Here is the call graph for this function:

static PyObject* PyGetConstantCount ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 161 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":GetConstantCount"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       PRUint16 ret;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetConstantCount(&ret);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return PyInt_FromLong(ret);
}

Here is the call graph for this function:

static PyObject* PyGetIID ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 82 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":GetIID"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       nsIID *iid_ret;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetInterfaceIID(&iid_ret);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       PyObject *ret = Py_nsIID::PyObjectFromIID(*iid_ret);
       nsMemory::Free(iid_ret);
       return ret;
}

Here is the call graph for this function:

static PyObject* PyGetIIDForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 298 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi;
       if (!PyArg_ParseTuple(args, "hh:GetIIDForParam", &mi, &pi))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsIID *piid;
       nsresult n = pii->GetIIDForParam(mi, &param_info, &piid);
       if (NS_FAILED(n) || piid==nsnull)
              return PyXPCOM_BuildPyException(n);
       PyObject *rc = Py_nsIID::PyObjectFromIID(*piid);
       nsMemory::Free((void*)piid);
       return rc;
}

Here is the call graph for this function:

static PyObject* PyGetInfoForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 279 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi;
       if (!PyArg_ParseTuple(args, "hh:GetInfoForParam", &mi, &pi))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsIInterfaceInfo *pnewii = nsnull;
       nsresult n = pii->GetInfoForParam(mi, &param_info, &pnewii);
       if (NS_FAILED(n))
              return PyXPCOM_BuildPyException(n);
       return Py_nsISupports::PyObjectFromInterface(pnewii, NS_GET_IID(nsIInterfaceInfo), PR_FALSE);
}

Here is the call graph for this function:

static PyObject* PyGetInterfaceIsArgNumberForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 376 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi;
       if (!PyArg_ParseTuple(args, "hhh:GetInterfaceIsArgNumberForParam", &mi, &pi))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
        PRUint8 ret;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsresult n = pii->GetInterfaceIsArgNumberForParam(mi, &param_info, &ret);
       if (NS_FAILED(n))
              return PyXPCOM_BuildPyException(n);
       return PyInt_FromLong(ret);
}

Here is the call graph for this function:

static PyObject* PyGetLengthIsArgNumberForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 357 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi, dim;
       if (!PyArg_ParseTuple(args, "hhh:GetLengthIsArgNumberForParam", &mi, &pi, &dim))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
        PRUint8 ret;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsresult n = pii->GetLengthIsArgNumberForParam(mi, &param_info, dim, &ret);
       if (NS_FAILED(n))
              return PyXPCOM_BuildPyException(n);
       return PyInt_FromLong(ret);
}

Here is the call graph for this function:

static PyObject* PyGetMethodCount ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 141 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":GetMethodCount"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       PRUint16 ret;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetMethodCount(&ret);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return PyInt_FromLong(ret);
}

Here is the call graph for this function:

static PyObject* PyGetMethodInfo ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 180 of file PyIInterfaceInfo.cpp.

{
       PRUint16 index;
       if (!PyArg_ParseTuple(args, "h:GetMethodInfo", &index))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       PRUint16 nmethods;
       pI->GetMethodCount(&nmethods);
       if (index>=nmethods) {
              PyErr_SetString(PyExc_ValueError, "The method index is out of range");
              return NULL;
       }

       const nsXPTMethodInfo *pRet;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetMethodInfo(index, &pRet);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return PyObject_FromXPTMethodDescriptor(pRet);
}

Here is the call graph for this function:

static PyObject* PyGetMethodInfoForName ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 207 of file PyIInterfaceInfo.cpp.

{
       char *name;
       if (!PyArg_ParseTuple(args, "s:GetMethodInfoForName", &name))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       const nsXPTMethodInfo *pRet;
       PRUint16 index;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetMethodInfoForName(name, &index, &pRet);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       PyObject *ret_i = PyObject_FromXPTMethodDescriptor(pRet);
       if (ret_i==NULL)
              return NULL;
       PyObject *real_ret = Py_BuildValue("iO", (int)index, ret_i);
       Py_DECREF(ret_i);
       return real_ret;
}

Here is the call graph for this function:

static PyObject* PyGetName ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 61 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":GetName"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       char *name;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetName(&name);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       PyObject *ret = PyString_FromString(name);
       nsMemory::Free(name);
       return ret;
}

Here is the call graph for this function:

static PyObject* PyGetParent ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 122 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":GetParent"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       nsIInterfaceInfo *pRet;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetParent(&pRet);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return Py_nsISupports::PyObjectFromInterface(pRet, NS_GET_IID(nsIInterfaceInfo), PR_FALSE, PR_FALSE);
}

Here is the call graph for this function:

static PyObject* PyGetSizeIsArgNumberForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 338 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi, dim;
       if (!PyArg_ParseTuple(args, "hhh:GetSizeIsArgNumberForParam", &mi, &pi, &dim))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
        PRUint8 ret;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsresult n = pii->GetSizeIsArgNumberForParam(mi, &param_info, dim, &ret);
       if (NS_FAILED(n))
              return PyXPCOM_BuildPyException(n);
       return PyInt_FromLong(ret);
}

Here is the call graph for this function:

static PyObject* PyGetTypeForParam ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 319 of file PyIInterfaceInfo.cpp.

{
       nsIInterfaceInfo *pii = GetI(self);
       if (pii==NULL)
              return NULL;
       PRUint16 mi, pi, dim;
       if (!PyArg_ParseTuple(args, "hhh:GetTypeForParam", &mi, &pi, &dim))
              return NULL;
       const nsXPTMethodInfo *pmi;
       if (!__GetMethodInfoHelper(pii, mi, pi, &pmi))
              return NULL;
       nsXPTType datumType;
       const nsXPTParamInfo& param_info = pmi->GetParam((PRUint8)pi);
       nsresult n = pii->GetTypeForParam(mi, &param_info, dim, &datumType);
       if (NS_FAILED(n))
              return PyXPCOM_BuildPyException(n);
       return PyObject_FromXPTType(&datumType);
}

Here is the call graph for this function:

static PyObject* PyIsScriptable ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 103 of file PyIInterfaceInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ":IsScriptable"))
              return NULL;

       nsIInterfaceInfo *pI = GetI(self);
       if (pI==NULL)
              return NULL;

       PRBool b_ret;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->IsScriptable(&b_ret);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);
       return PyInt_FromLong(b_ret);
}

Here is the call graph for this function: