зеркало из https://github.com/mozilla/gecko-dev.git
Bad idea.
This commit is contained in:
Родитель
42379a0c66
Коммит
2fc4664954
|
@ -1,47 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsRDFBaseCID_h__
|
||||
#define nsRDFBaseCID_h__
|
||||
|
||||
// {0F78DA56-8321-11d2-8EAC-00805F29F370}
|
||||
#define NS_RDFNODE_CID \
|
||||
{ 0xf78da56, 0x8321, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {BFD05264-834C-11d2-8EAC-00805F29F370}
|
||||
#define NS_RDFRESOURCEMANAGER_CID \
|
||||
{ 0xbfd05264, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {BFD0526D-834C-11d2-8EAC-00805F29F370}
|
||||
#define NS_RDFMEMORYDATASOURCE_CID \
|
||||
{ 0xbfd0526d, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {E638D761-8687-11d2-B530-000000000000}
|
||||
#define NS_RDFSIMPLEDATABASE_CID \
|
||||
{ 0xe638d761, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {7BAF62E0-8E61-11d2-8EB1-00805F29F370}
|
||||
#define NS_RDFSTREAMDATASOURCE_CID \
|
||||
{ 0x7baf62e0, 0x8e61, 0x11d2, { 0x8e, 0xb1, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {0958B100-9ADA-11d2-8EBC-00805F29F370}
|
||||
#define NS_RDFCONTENTSINK_CID \
|
||||
{ 0x958b100, 0x9ada, 0x11d2, { 0x8e, 0xbc, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
|
||||
#endif // nsRDFBaseCID_h__
|
|
@ -1,161 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIRDFResourceManager.h"
|
||||
#include "nsRDFBaseDataSources.h"
|
||||
#include "nsRDFBaseCID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
static NS_DEFINE_CID(kRDFMemoryDataSourceCID, NS_RDFMEMORYDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kRDFResourceManagerCID, NS_RDFRESOURCEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFSimpleDataBaseCID, NS_RDFSIMPLEDATABASE_CID);
|
||||
|
||||
class RDFFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
RDFFactoryImpl(const nsCID &aClass);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~RDFFactoryImpl();
|
||||
|
||||
private:
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RDFFactoryImpl::RDFFactoryImpl(const nsCID &aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
RDFFactoryImpl::~RDFFactoryImpl()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(RDFFactoryImpl);
|
||||
NS_IMPL_RELEASE(RDFFactoryImpl);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
PRBool wasRefCounted = PR_TRUE;
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kRDFResourceManagerCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFResourceManager((nsIRDFResourceManager**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFMemoryDataSourceCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFMemoryDataSource((nsIRDFDataSource**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFSimpleDataBaseCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFSimpleDataBase((nsIRDFDataBase**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
|
||||
if (wasRefCounted)
|
||||
NS_IF_RELEASE(inst);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult RDFFactoryImpl::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new RDFFactoryImpl(aClass);
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsRDFCID_h__
|
||||
#define nsRDFCID_h__
|
||||
|
||||
// {954F0813-81DC-11d2-B52A-000000000000}
|
||||
#define NS_RDFHTMLDOCUMENT_CID \
|
||||
{ 0x954f0813, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
// {3D262D00-8B5A-11d2-8EB0-00805F29F370}
|
||||
#define NS_RDFTREEDOCUMENT_CID \
|
||||
{ 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {0958B101-9ADA-11d2-8EBC-00805F29F370}
|
||||
#define NS_RDFDOCUMENTCONTENTSINK_CID \
|
||||
{ 0x958b101, 0x9ada, 0x11d2, { 0x8e, 0xbc, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
|
||||
#endif // nsRDFCID_h__
|
|
@ -1,156 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIRDFResourceManager.h"
|
||||
#include "nsRDFDocument.h"
|
||||
#include "nsRDFContentCID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
static NS_DEFINE_CID(kRDFHTMLDocumentCID, NS_RDFHTMLDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kRDFTreeDocumentCID, NS_RDFTREEDOCUMENT_CID);
|
||||
|
||||
class RDFFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
RDFFactoryImpl(const nsCID &aClass);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~RDFFactoryImpl();
|
||||
|
||||
private:
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RDFFactoryImpl::RDFFactoryImpl(const nsCID &aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
RDFFactoryImpl::~RDFFactoryImpl()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(RDFFactoryImpl);
|
||||
NS_IMPL_RELEASE(RDFFactoryImpl);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
PRBool wasRefCounted = PR_TRUE;
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kRDFHTMLDocumentCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFHTMLDocument((nsIRDFDocument**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFTreeDocumentCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFTreeDocument((nsIRDFDocument**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
|
||||
if (wasRefCounted)
|
||||
NS_IF_RELEASE(inst);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult RDFFactoryImpl::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new RDFFactoryImpl(aClass);
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsRDFCID_h__
|
||||
#define nsRDFCID_h__
|
||||
|
||||
// {E638D760-8687-11d2-B530-000000000000}
|
||||
#define NS_RDFBOOKMARKDATASOURCE_CID \
|
||||
{ 0xe638d760, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
#endif // nsRDFCID_h__
|
|
@ -1,151 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIRDFResourceManager.h"
|
||||
#include "nsRDFBuiltInDataSources.h"
|
||||
#include "nsRDFDataSourceCID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
static NS_DEFINE_CID(kRDFBookmarkDataSourceCID, NS_RDFBOOKMARKDATASOURCE_CID);
|
||||
|
||||
class RDFFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
RDFFactoryImpl(const nsCID &aClass);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
protected:
|
||||
virtual ~RDFFactoryImpl();
|
||||
|
||||
private:
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RDFFactoryImpl::RDFFactoryImpl(const nsCID &aClass)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
RDFFactoryImpl::~RDFFactoryImpl()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = nsnull;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIFactory*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(RDFFactoryImpl);
|
||||
NS_IMPL_RELEASE(RDFFactoryImpl);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
PRBool wasRefCounted = PR_TRUE;
|
||||
nsISupports *inst = nsnull;
|
||||
if (mClassID.Equals(kRDFBookmarkDataSourceCID)) {
|
||||
if (NS_FAILED(rv = NS_NewRDFBookmarkDataSource((nsIRDFDataSource**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
if (! inst)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
|
||||
if (wasRefCounted)
|
||||
NS_IF_RELEASE(inst);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult RDFFactoryImpl::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aFactory = new RDFFactoryImpl(aClass);
|
||||
if (aFactory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче