This commit is contained in:
putterman%netscape.com 1999-07-01 00:15:20 +00:00
Родитель e367a4a5d7
Коммит 7cb02f4f98
8 изменённых файлов: 30 добавлений и 50 удалений

Просмотреть файл

@ -100,7 +100,7 @@ nsresult nsAbFactory::QueryInterface(const nsIID &aIID, void **aResult)
// we support two interfaces....nsISupports and nsFactory..... // we support two interfaces....nsISupports and nsFactory.....
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
*aResult = (void *)(nsISupports*)this; *aResult = (void *)(nsISupports*)this;
else if (aIID.Equals(nsIFactory::GetIID())) else if (aIID.Equals(nsCOMTypeInfo<nsIFactory>::GetIID()))
*aResult = (void *)(nsIFactory*)this; *aResult = (void *)(nsIFactory*)this;
if (*aResult == NULL) if (*aResult == NULL)
@ -215,7 +215,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* aServMgr,
*aFactory = new nsAbFactory(aClass, aClassName, aProgID); *aFactory = new nsAbFactory(aClass, aClassName, aProgID);
if (aFactory) 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 else
return NS_ERROR_OUT_OF_MEMORY; 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(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_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) nsABCard::nsABCard(void)
: nsRDFResource(), mListeners(nsnull), : nsRDFResource(), mListeners(nsnull),
mInitialized(PR_FALSE), mInitialized(PR_FALSE),
@ -710,7 +704,7 @@ NS_IMETHODIMP nsABCard::AddCardToDatabase()
dbPath += "abook.mab"; dbPath += "abook.mab";
nsCOMPtr<nsIAddrDatabase> addrDBFactory; nsCOMPtr<nsIAddrDatabase> addrDBFactory;
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsIAddrDatabase::GetIID(), rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsCOMTypeInfo<nsIAddrDatabase>::GetIID(),
(void **) getter_AddRefs(addrDBFactory)); (void **) getter_AddRefs(addrDBFactory));
if (NS_SUCCEEDED(rv) && addrDBFactory) if (NS_SUCCEEDED(rv) && addrDBFactory)
openAddrDB = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(mDatabase), PR_TRUE); 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) if (aResult == NULL)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
if (aIID.Equals(nsIAbCard::GetIID()) || if (aIID.Equals(nsCOMTypeInfo<nsIAbCard>::GetIID()) ||
aIID.Equals(nsIAddrDBListener::GetIID()) || aIID.Equals(nsCOMTypeInfo<nsIAddrDBListener>::GetIID()) ||
aIID.Equals(::nsISupports::GetIID())) { aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
*aResult = NS_STATIC_CAST(nsIAbCard*, this); *aResult = NS_STATIC_CAST(nsIAbCard*, this);
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; 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(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_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) nsABDirectory::nsABDirectory(void)
: nsRDFResource(), mListeners(nsnull), : nsRDFResource(), mListeners(nsnull),
mInitialized(PR_FALSE), mCardInitialized(PR_FALSE), mInitialized(PR_FALSE), mCardInitialized(PR_FALSE),
@ -250,7 +245,7 @@ nsresult nsABDirectory::GetAbDatabase()
dbPath += "abook.mab"; dbPath += "abook.mab";
nsCOMPtr<nsIAddrDatabase> addrDBFactory; nsCOMPtr<nsIAddrDatabase> addrDBFactory;
rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsIAddrDatabase::GetIID(), rv = nsComponentManager::CreateInstance(kAddressBookDB, nsnull, nsCOMTypeInfo<nsIAddrDatabase>::GetIID(),
(void **) getter_AddRefs(addrDBFactory)); (void **) getter_AddRefs(addrDBFactory));
if (NS_SUCCEEDED(rv) && addrDBFactory) if (NS_SUCCEEDED(rv) && addrDBFactory)
openAddrDB = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(mDatabase), PR_TRUE); 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)); nsCOMPtr<nsIAbCard> personCard(do_QueryInterface(res, &rv));
if (NS_FAILED(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) if (NS_FAILED(rv) || !personCard)
{ {
delete[] uriStr; delete[] uriStr;

Просмотреть файл

@ -139,8 +139,8 @@ NS_IMETHODIMP nsAddrDatabase::QueryInterface(REFNSIID aIID, void** aResult)
if (aResult == NULL) if (aResult == NULL)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
if (aIID.Equals(nsIAddrDatabase::GetIID()) || if (aIID.Equals(nsCOMTypeInfo<nsIAddrDatabase>::GetIID()) ||
aIID.Equals(nsIAddrDBAnnouncer::GetIID()) || aIID.Equals(nsCOMTypeInfo<nsIAddrDBAnnouncer>::GetIID()) ||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) { aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
*aResult = NS_STATIC_CAST(nsIAddrDatabase*, this); *aResult = NS_STATIC_CAST(nsIAddrDatabase*, this);
NS_ADDREF_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) NS_IMETHODIMP nsAddrDBEnumerator::First(void)
{ {

Просмотреть файл

@ -32,11 +32,7 @@
#include "nsIFileLocator.h" #include "nsIFileLocator.h"
#include "nsFileLocations.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_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(kAddressBookDB, NS_ADDRESSBOOKDB_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
@ -63,9 +59,9 @@ NS_IMETHODIMP nsAddressBook::QueryInterface(REFNSIID aIID, void** aResult)
if (aResult == NULL) if (aResult == NULL)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
if (aIID.Equals(nsIAddressBook::GetIID()) || if (aIID.Equals(nsCOMTypeInfo<nsIAddressBook>::GetIID()) ||
aIID.Equals(nsIAbCard::GetIID()) || aIID.Equals(nsCOMTypeInfo<nsIAbCard>::GetIID()) ||
aIID.Equals(::nsISupports::GetIID())) { aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
*aResult = NS_STATIC_CAST(nsIAddressBook*, this); *aResult = NS_STATIC_CAST(nsIAddressBook*, this);
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;

Просмотреть файл

@ -185,7 +185,7 @@ nsresult nsABCardDataSource::Init()
return NS_ERROR_ALREADY_INITIALIZED; return NS_ERROR_ALREADY_INITIALIZED;
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
nsIRDFService::GetIID(), nsCOMTypeInfo<nsIRDFService>::GetIID(),
(nsISupports**) &mRDFService); // XXX probably need shutdown listener here (nsISupports**) &mRDFService); // XXX probably need shutdown listener here
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -220,14 +220,14 @@ nsABCardDataSource::QueryInterface(REFNSIID iid, void** result)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
*result = nsnull; *result = nsnull;
if (iid.Equals(nsIRDFDataSource::GetIID()) || if (iid.Equals(nsCOMTypeInfo<nsIRDFDataSource>::GetIID()) ||
iid.Equals(kISupportsIID)) iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
{ {
*result = NS_STATIC_CAST(nsIRDFDataSource*, this); *result = NS_STATIC_CAST(nsIRDFDataSource*, this);
AddRef(); AddRef();
return NS_OK; return NS_OK;
} }
else if(iid.Equals(nsIAbListener::GetIID())) else if(iid.Equals(nsCOMTypeInfo<nsIAbListener>::GetIID()))
{ {
*result = NS_STATIC_CAST(nsIAbListener*, this); *result = NS_STATIC_CAST(nsIAbListener*, this);
AddRef(); AddRef();
@ -571,10 +571,10 @@ NS_IMETHODIMP nsABCardDataSource::OnItemAdded(nsIAbBase *parentDirectory, nsISup
nsCOMPtr<nsIAbCard> card; nsCOMPtr<nsIAbCard> card;
nsCOMPtr<nsIRDFResource> parentResource; 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 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)); nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))
@ -594,10 +594,10 @@ NS_IMETHODIMP nsABCardDataSource::OnItemRemoved(nsIAbBase *parentDirectory, nsIS
nsCOMPtr<nsIAbCard> card; nsCOMPtr<nsIAbCard> card;
nsCOMPtr<nsIRDFResource> parentResource; 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 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)); nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))

Просмотреть файл

@ -46,11 +46,6 @@ typedef struct _nsAbRDFNotification {
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); 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); static NS_DEFINE_CID(kAbDirectoryDataSourceCID, NS_ABDIRECTORYDATASOURCE_CID);
nsIRDFResource* nsABDirectoryDataSource::kNC_Child; nsIRDFResource* nsABDirectoryDataSource::kNC_Child;
@ -182,7 +177,7 @@ nsABDirectoryDataSource::Init()
return NS_ERROR_ALREADY_INITIALIZED; return NS_ERROR_ALREADY_INITIALIZED;
nsresult rv = nsServiceManager::GetService(kRDFServiceCID, nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
nsIRDFService::GetIID(), nsCOMTypeInfo<nsIRDFService>::GetIID(),
(nsISupports**) &mRDFService); (nsISupports**) &mRDFService);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -219,14 +214,14 @@ nsABDirectoryDataSource::QueryInterface(REFNSIID iid, void** result)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
*result = nsnull; *result = nsnull;
if (iid.Equals(nsIRDFDataSource::GetIID()) || if (iid.Equals(nsCOMTypeInfo<nsIRDFDataSource>::GetIID()) ||
iid.Equals(kISupportsIID)) iid.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
{ {
*result = NS_STATIC_CAST(nsIRDFDataSource*, this); *result = NS_STATIC_CAST(nsIRDFDataSource*, this);
AddRef(); AddRef();
return NS_OK; return NS_OK;
} }
else if(iid.Equals(nsIAbListener::GetIID())) else if(iid.Equals(nsCOMTypeInfo<nsIAbListener>::GetIID()))
{ {
*result = NS_STATIC_CAST(nsIAbListener*, this); *result = NS_STATIC_CAST(nsIAbListener*, this);
AddRef(); AddRef();
@ -598,10 +593,10 @@ NS_IMETHODIMP nsABDirectoryDataSource::OnItemAdded(nsIAbBase *parentDirectory, n
nsCOMPtr<nsIAbDirectory> directory; nsCOMPtr<nsIAbDirectory> directory;
nsCOMPtr<nsIRDFResource> parentResource; 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 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)); nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))
@ -621,10 +616,10 @@ NS_IMETHODIMP nsABDirectoryDataSource::OnItemRemoved(nsIAbBase *parentDirectory,
nsCOMPtr<nsIAbCard> card; nsCOMPtr<nsIAbCard> card;
nsCOMPtr<nsIRDFResource> parentResource; 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 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)); nsCOMPtr<nsIRDFNode> itemNode(do_QueryInterface(item, &rv));
if(NS_SUCCEEDED(rv)) if(NS_SUCCEEDED(rv))