PyGModule.cpp revision 16a8d09569a2ebd598cef72fa605be6fb4563607
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Python XPCOM language bindings.
*
* The Initial Developer of the Original Code is
* ActiveState Tool Corp.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Hammond <mhammond@skippinet.com.au> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//
// This code is part of the XPCOM extensions for Python.
//
// Written May 2000 by Mark Hammond.
//
// Based heavily on the Python COM support, which is
// (c) Mark Hammond and Greg Stein.
//
// (c) 2000, ActiveState corp.
// Unfortunately, we can not use an XPConnect object for
// the nsiModule and nsiComponentLoader interfaces.
// As XPCOM shuts down, it shuts down the interface manager before
// it releases all the modules. This is a bit of a problem for
// us, as it means we can't get runtime info on the interface at shutdown time.
#include "PyXPCOM_std.h"
#include <nsIModule.h>
#include <nsIComponentLoader.h>
{
public:
};
{
return new PyG_nsIModule(instance);
}
// Create a factory object for creating instances of aClass.
void** r_classObj)
{
*r_classObj = nsnull;
const char *methodName = "getClassObject";
Py_XDECREF(cm);
if (NS_SUCCEEDED(nr)) {
if (PyErr_Occurred())
}
}
return nr;
}
const char* registryLocation,
const char* componentType)
{
const char *methodName = "registerSelf";
nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "OOzz", cm, path, registryLocation, componentType);
Py_XDECREF(cm);
return nr;
}
const char* registryLocation)
{
const char *methodName = "unregisterSelf";
Py_XDECREF(cm);
return nr;
}
{
// we are shutting down - don't ask for a nice wrapped object.
const char *methodName = "canUnload";
Py_XDECREF(cm);
if (NS_SUCCEEDED(nr)) {
if (PyErr_Occurred())
}
return nr;
}
///////////////////////////////////////////////////////////////////////////////////
{
public:
};
{
return new PyG_nsIComponentLoader(instance);
}
/* nsIFactory getFactory (in nsIIDRef aCID, in string aLocation, in string aType); */
NS_IMETHODIMP PyG_nsIComponentLoader::GetFactory(const nsIID & aCID, const char *aLocation, const char *aType, nsIFactory **_retval)
{
const char *methodName = "getFactory";
iid,
aType);
if (NS_SUCCEEDED(nr)) {
Py_nsISupports::InterfaceFromPyObject(ret, NS_GET_IID(nsIFactory), (nsISupports **)_retval, PR_FALSE);
if (PyErr_Occurred())
}
return nr;
}
/* void init (in nsIComponentManager aCompMgr, in nsISupports aRegistry); */
{
const char *methodName = "init";
Py_XDECREF(c);
Py_XDECREF(r);
return nr;
}
/* void onRegister (in nsIIDRef aCID, in string aType, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist); */
NS_IMETHODIMP PyG_nsIComponentLoader::OnRegister(const nsIID & aCID, const char *aType, const char *aClassName, const char *aContractID, const char *aLocation, PRBool aReplace, PRBool aPersist)
{
const char *methodName = "onRegister";
iid,
aPersist);
return nr;
}
/* void autoRegisterComponents (in long aWhen, in nsIFile aDirectory); */
{
const char *methodName = "autoRegisterComponents";
Py_XDECREF(c);
return nr;
}
/* boolean autoRegisterComponent (in long aWhen, in nsIFile aComponent); */
NS_IMETHODIMP PyG_nsIComponentLoader::AutoRegisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
{
const char *methodName = "autoRegisterComponent";
Py_XDECREF(c);
if (NS_SUCCEEDED(nr)) {
if (PyErr_Occurred())
}
return nr;
}
/* boolean autoUnregisterComponent (in long aWhen, in nsIFile aComponent); */
NS_IMETHODIMP PyG_nsIComponentLoader::AutoUnregisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
{
const char *methodName = "autoUnregisterComponent";
Py_XDECREF(c);
if (NS_SUCCEEDED(nr)) {
if (PyErr_Occurred())
}
return nr;
}
/* boolean registerDeferredComponents (in long aWhen); */
{
const char *methodName = "registerDeferredComponents";
if (NS_SUCCEEDED(nr)) {
if (PyErr_Occurred())
}
return nr;
}
/* void unloadAll (in long aWhen); */
{
const char *methodName = "unloadAll";
}