Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
PyIClassInfo.cpp File Reference
#include "PyXPCOM_std.h"
#include "nsIClassInfo.h"

Go to the source code of this file.

Defines

#define GETATTR_CHECK_RESULT(nr)   if (NS_FAILED(nr)) return PyXPCOM_BuildPyException(nr)

Functions

static nsIClassInfo_GetI (PyObject *self)
static PyObject * PyGetInterfaces (PyObject *self, PyObject *args)
static PyObject * PyGetHelperForLanguage (PyObject *self, PyObject *args)
static PyObject * MakeStringOrNone (char *v)

Define Documentation

Definition at line 114 of file PyIClassInfo.cpp.


Function Documentation

static nsIClassInfo* _GetI ( PyObject *  self) [static]

Definition at line 51 of file PyIClassInfo.cpp.

                                           {
       nsIID iid = NS_GET_IID(nsIClassInfo);

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

Here is the call graph for this function:

Here is the caller graph for this function:

static PyObject* MakeStringOrNone ( char *  v) [static]

Definition at line 106 of file PyIClassInfo.cpp.

{
       if (v)
              return PyString_FromString(v);
       Py_INCREF(Py_None);
       return Py_None;
}
static PyObject* PyGetHelperForLanguage ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 86 of file PyIClassInfo.cpp.

{
       PRUint32 language = nsIProgrammingLanguage::PYTHON;
       if (!PyArg_ParseTuple(args, "|i", &language))
              return NULL;
       nsIClassInfo *pI = _GetI(self);
       if (pI==NULL)
              return NULL;

       nsresult r;
       nsISupports *pi;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetHelperForLanguage(language, &pi);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);

       return Py_nsISupports::PyObjectFromInterface(pi, NS_GET_IID(nsISupports), PR_FALSE);
}

Here is the call graph for this function:

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

Definition at line 61 of file PyIClassInfo.cpp.

{
       if (!PyArg_ParseTuple(args, ""))
              return NULL;
       nsIClassInfo *pI = _GetI(self);
       if (pI==NULL)
              return NULL;

       nsIID** iidArray = nsnull;
       PRUint32 iidCount = 0;
       nsresult r;
       Py_BEGIN_ALLOW_THREADS;
       r = pI->GetInterfaces(&iidCount, &iidArray);
       Py_END_ALLOW_THREADS;
       if ( NS_FAILED(r) )
              return PyXPCOM_BuildPyException(r);

       PyObject *ret = PyTuple_New(iidCount);
       if (ret==NULL)
              return NULL;
       for (PRUint32 i=0;i<iidCount;i++)
              PyTuple_SET_ITEM( ret, i, Py_nsIID::PyObjectFromIID(*(iidArray[i])) );
       return ret;
}

Here is the call graph for this function: