зеркало из https://github.com/mozilla/pjs.git
use nsCOMTypeInfo
This commit is contained in:
Родитель
e367a4a5d7
Коммит
7cb02f4f98
|
@ -100,7 +100,7 @@ nsresult nsAbFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
|||
// we support two interfaces....nsISupports and nsFactory.....
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
else if (aIID.Equals(nsIFactory::GetIID()))
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIFactory>::GetIID()))
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
|
||||
if (*aResult == NULL)
|
||||
|
@ -215,7 +215,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
|
|||
*aFactory = new nsAbFactory(aClass, aClassName, aProgID);
|
||||
|
||||
if (aFactory)
|
||||
return (*aFactory)->QueryInterface(nsIFactory::GetIID(), (void**)aFactory); // they want a Factory Interface so give it to them
|
||||
return (*aFactory)->QueryInterface(nsCOMTypeInfo<nsIFactory>::GetIID(), (void**)aFactory); // they want a Factory Interface so give it to them
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -33,12 +33,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
|||
static NS_DEFINE_CID(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsABCard::nsABCard(void)
|
||||
: nsRDFResource(), mListeners(nsnull),
|
||||
mInitialized(PR_FALSE),
|
||||
|
@ -710,7 +704,7 @@ NS_IMETHODIMP nsABCard::AddCardToDatabase()
|
|||
dbPath += "abook.mab";
|
||||
|
||||
nsCOMPtr<nsIAddrDatabase> addrDBFactory;
|
||||
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsIAddrDatabase::GetIID(),
|
||||
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsCOMTypeInfo<nsIAddrDatabase>::GetIID(),
|
||||
(void **) getter_AddRefs(addrDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && addrDBFactory)
|
||||
openAddrDB = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(mDatabase), PR_TRUE);
|
||||
|
|
|
@ -87,9 +87,9 @@ NS_IMETHODIMP nsAbCardProperty::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIAbCard::GetIID()) ||
|
||||
aIID.Equals(nsIAddrDBListener::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIAbCard>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsIAddrDBListener>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIAbCard*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -38,11 +38,6 @@ static NS_DEFINE_CID(kAbCardCID, NS_ABCARDRESOURCE_CID);
|
|||
static NS_DEFINE_CID(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
nsABDirectory::nsABDirectory(void)
|
||||
: nsRDFResource(), mListeners(nsnull),
|
||||
mInitialized(PR_FALSE), mCardInitialized(PR_FALSE),
|
||||
|
@ -250,7 +245,7 @@ nsresult nsABDirectory::GetAbDatabase()
|
|||
dbPath += "abook.mab";
|
||||
|
||||
nsCOMPtr<nsIAddrDatabase> addrDBFactory;
|
||||
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsIAddrDatabase::GetIID(),
|
||||
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsCOMTypeInfo<nsIAddrDatabase>::GetIID(),
|
||||
(void **) getter_AddRefs(addrDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && addrDBFactory)
|
||||
openAddrDB = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(mDatabase), PR_TRUE);
|
||||
|
@ -327,7 +322,7 @@ nsresult nsABDirectory::AddChildCards(nsAutoString name, nsIAbCard **childCard)
|
|||
nsCOMPtr<nsIAbCard> personCard(do_QueryInterface(res, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
rv = nsComponentManager::CreateInstance(kAbCardCID, nsnull, nsIAbCard::GetIID(), getter_AddRefs(personCard));
|
||||
rv = nsComponentManager::CreateInstance(kAbCardCID, nsnull, nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(personCard));
|
||||
if (NS_FAILED(rv) || !personCard)
|
||||
{
|
||||
delete[] uriStr;
|
||||
|
|
|
@ -139,8 +139,8 @@ NS_IMETHODIMP nsAddrDatabase::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIAddrDatabase::GetIID()) ||
|
||||
aIID.Equals(nsIAddrDBAnnouncer::GetIID()) ||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIAddrDatabase>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsIAddrDBAnnouncer>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIAddrDatabase*, this);
|
||||
NS_ADDREF_THIS();
|
||||
|
@ -896,7 +896,7 @@ nsAddrDBEnumerator::~nsAddrDBEnumerator()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAddrDBEnumerator, nsIEnumerator::GetIID())
|
||||
NS_IMPL_ISUPPORTS(nsAddrDBEnumerator, nsCOMTypeInfo<nsIEnumerator>::GetIID())
|
||||
|
||||
NS_IMETHODIMP nsAddrDBEnumerator::First(void)
|
||||
{
|
||||
|
|
|
@ -32,11 +32,7 @@
|
|||
#include "nsIFileLocator.h"
|
||||
#include "nsFileLocations.h"
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
|
@ -63,9 +59,9 @@ NS_IMETHODIMP nsAddressBook::QueryInterface(REFNSIID aIID, void** aResult)
|
|||
if (aResult == NULL)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIAddressBook::GetIID()) ||
|
||||
aIID.Equals(nsIAbCard::GetIID()) ||
|
||||
aIID.Equals(::nsISupports::GetIID())) {
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIAddressBook>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsIAbCard>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIAddressBook*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
|
|
|
@ -185,7 +185,7 @@ nsresult nsABCardDataSource::Init()
|
|||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
nsCOMTypeInfo<nsIRDFService>::GetIID(),
|
||||
(nsISupports**) &mRDFService); // XXX probably need shutdown listener here
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -220,14 +220,14 @@ nsABCardDataSource::QueryInterface(REFNSIID iid, void** result)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIRDFDataSource::GetIID()) ||
|
||||
iid.Equals(kISupportsIID))
|
||||
if (iid.Equals(nsCOMTypeInfo<nsIRDFDataSource>::GetIID()) ||
|
||||
iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIRDFDataSource*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if(iid.Equals(nsIAbListener::GetIID()))
|
||||
else if(iid.Equals(nsCOMTypeInfo<nsIAbListener>::GetIID()))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIAbListener*, this);
|
||||
AddRef();
|
||||
|
@ -571,10 +571,10 @@ NS_IMETHODIMP nsABCardDataSource::OnItemAdded(nsIAbBase *parentDirectory, nsISup
|
|||
nsCOMPtr<nsIAbCard> card;
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsIRDFResource::GetIID(), getter_AddRefs(parentResource))))
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsCOMTypeInfo<nsIRDFResource>::GetIID(), getter_AddRefs(parentResource))))
|
||||
{
|
||||
//If we are adding a card
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsIAbCard::GetIID(), getter_AddRefs(card))))
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(card))))
|
||||
{
|
||||
nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
|
@ -594,10 +594,10 @@ NS_IMETHODIMP nsABCardDataSource::OnItemRemoved(nsIAbBase *parentDirectory, nsIS
|
|||
nsCOMPtr<nsIAbCard> card;
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsIRDFResource::GetIID(), getter_AddRefs(parentResource))))
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsCOMTypeInfo<nsIRDFResource>::GetIID(), getter_AddRefs(parentResource))))
|
||||
{
|
||||
//If we are adding a card
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsIAbCard::GetIID(), getter_AddRefs(card))))
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(card))))
|
||||
{
|
||||
nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -46,11 +46,6 @@ typedef struct _nsAbRDFNotification {
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_CID(kAbDirectoryDataSourceCID, NS_ABDIRECTORYDATASOURCE_CID);
|
||||
|
||||
nsIRDFResource* nsABDirectoryDataSource::kNC_Child;
|
||||
|
@ -182,7 +177,7 @@ nsABDirectoryDataSource::Init()
|
|||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
nsCOMTypeInfo<nsIRDFService>::GetIID(),
|
||||
(nsISupports**) &mRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -219,14 +214,14 @@ nsABDirectoryDataSource::QueryInterface(REFNSIID iid, void** result)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIRDFDataSource::GetIID()) ||
|
||||
iid.Equals(kISupportsIID))
|
||||
if (iid.Equals(nsCOMTypeInfo<nsIRDFDataSource>::GetIID()) ||
|
||||
iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIRDFDataSource*, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
else if(iid.Equals(nsIAbListener::GetIID()))
|
||||
else if(iid.Equals(nsCOMTypeInfo<nsIAbListener>::GetIID()))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIAbListener*, this);
|
||||
AddRef();
|
||||
|
@ -598,10 +593,10 @@ NS_IMETHODIMP nsABDirectoryDataSource::OnItemAdded(nsIAbBase *parentDirectory, n
|
|||
nsCOMPtr<nsIAbDirectory> directory;
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsIRDFResource::GetIID(), getter_AddRefs(parentResource))))
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsCOMTypeInfo<nsIRDFResource>::GetIID(), getter_AddRefs(parentResource))))
|
||||
{
|
||||
//If we are adding a directory
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsIAbDirectory::GetIID(), getter_AddRefs(directory))))
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsCOMTypeInfo<nsIAbDirectory>::GetIID(), getter_AddRefs(directory))))
|
||||
{
|
||||
nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
|
@ -621,10 +616,10 @@ NS_IMETHODIMP nsABDirectoryDataSource::OnItemRemoved(nsIAbBase *parentDirectory,
|
|||
nsCOMPtr<nsIAbCard> card;
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsIRDFResource::GetIID(), getter_AddRefs(parentResource))))
|
||||
if(NS_SUCCEEDED(parentDirectory->QueryInterface(nsCOMTypeInfo<nsIRDFResource>::GetIID(), getter_AddRefs(parentResource))))
|
||||
{
|
||||
//If we are adding a card
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsIAbCard::GetIID(), getter_AddRefs(card))))
|
||||
if(NS_SUCCEEDED(item->QueryInterface(nsCOMTypeInfo<nsIAbCard>::GetIID(), getter_AddRefs(card))))
|
||||
{
|
||||
nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
|
|
Загрузка…
Ссылка в новой задаче