зеркало из https://github.com/mozilla/pjs.git
Expunge EqualsResource() and EqualsLiteral().
This commit is contained in:
Родитель
c13d69e55e
Коммит
30f5f63b74
|
@ -80,17 +80,6 @@ DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, NewCard);
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
|
||||
static PRBool
|
||||
peq(nsIRDFResource* r1, nsIRDFResource* r2)
|
||||
{
|
||||
PRBool result;
|
||||
if (NS_SUCCEEDED(r1->EqualsResource(r2, &result)) && result) {
|
||||
return PR_TRUE;
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static PRBool
|
||||
peqSort(nsIRDFResource* r1, nsIRDFResource* r2, PRBool *isSort)
|
||||
|
@ -129,7 +118,7 @@ peqSort(nsIRDFResource* r1, nsIRDFResource* r2, PRBool *isSort)
|
|||
//In case the resources are equal but the values are different. I'm not sure if this
|
||||
//could happen but it is feasible given interface.
|
||||
*isSort = PR_FALSE;
|
||||
return(peq(r1, r2));
|
||||
return(r1 == r2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -305,10 +294,10 @@ NS_IMETHODIMP nsABCardDataSource::GetTargets(nsIRDFResource* source,
|
|||
nsCOMPtr<nsIAbCard> card(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv) && card)
|
||||
{
|
||||
if(peq(kNC_PersonName, property) || peq(kNC_ListName, property) ||
|
||||
peq(kNC_Email, property) || peq(kNC_City, property) ||
|
||||
peq(kNC_Organization, property) || peq(kNC_WorkPhone, property) ||
|
||||
peq(kNC_Nickname, property))
|
||||
if((kNC_PersonName == property) || (kNC_ListName == property) ||
|
||||
(kNC_Email == property) || (kNC_City == property) ||
|
||||
(kNC_Organization == property) || (kNC_WorkPhone == property) ||
|
||||
(kNC_Nickname == property))
|
||||
{
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(property);
|
||||
|
@ -530,8 +519,8 @@ nsABCardDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSour
|
|||
card = do_QueryInterface(source, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// we don't care about the arguments -- card commands are always enabled
|
||||
if (!(peq(aCommand, kNC_Delete) ||
|
||||
peq(aCommand, kNC_NewCard))) {
|
||||
if (!((aCommand == kNC_Delete) ||
|
||||
(aCommand == kNC_NewCard))) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -556,10 +545,10 @@ nsABCardDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
|||
nsCOMPtr<nsISupports> supports = getter_AddRefs(aSources->ElementAt(i));
|
||||
nsCOMPtr<nsIAbCard> card = do_QueryInterface(supports, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (peq(aCommand, kNC_Delete)) {
|
||||
if ((aCommand == kNC_Delete)) {
|
||||
rv = DoDeleteFromCard(card, aArguments);
|
||||
}
|
||||
else if(peq(aCommand, kNC_NewCard)) {
|
||||
else if((aCommand == kNC_NewCard)) {
|
||||
rv = DoNewCard(card, aArguments);
|
||||
}
|
||||
|
||||
|
@ -655,19 +644,19 @@ nsresult nsABCardDataSource::createCardNode(nsIAbCard* card,
|
|||
char *name;
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
if (peq(kNC_PersonName, property))
|
||||
if ((kNC_PersonName == property))
|
||||
rv = card->GetPersonName(&name);
|
||||
else if (peq(kNC_ListName, property))
|
||||
else if ((kNC_ListName == property))
|
||||
rv = card->GetListName(&name);
|
||||
else if (peq(kNC_Email, property))
|
||||
else if ((kNC_Email == property))
|
||||
rv = card->GetEmail(&name);
|
||||
else if (peq(kNC_City, property))
|
||||
else if ((kNC_City == property))
|
||||
rv = card->GetCity(&name);
|
||||
else if (peq(kNC_Organization, property))
|
||||
else if ((kNC_Organization == property))
|
||||
rv = card->GetOrganization(&name);
|
||||
else if (peq(kNC_WorkPhone, property))
|
||||
else if ((kNC_WorkPhone == property))
|
||||
rv = card->GetWorkPhone(&name);
|
||||
else if (peq(kNC_Nickname, property))
|
||||
else if ((kNC_Nickname == property))
|
||||
rv = card->GetNickName(&name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsString nameString(name);
|
||||
|
|
|
@ -74,16 +74,6 @@ DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, NewDirectory);
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
|
||||
static PRBool
|
||||
peq(nsIRDFResource* r1, nsIRDFResource* r2)
|
||||
{
|
||||
PRBool result;
|
||||
if (NS_SUCCEEDED(r1->EqualsResource(r2, &result)) && result)
|
||||
return PR_TRUE;
|
||||
else
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static PRBool
|
||||
peqSort(nsIRDFResource* r1, nsIRDFResource* r2, PRBool *isSort)
|
||||
|
@ -122,7 +112,7 @@ peqSort(nsIRDFResource* r1, nsIRDFResource* r2, PRBool *isSort)
|
|||
//In case the resources are equal but the values are different. I'm not sure if this
|
||||
//could happen but it is feasible given interface.
|
||||
*isSort = PR_FALSE;
|
||||
return(peq(r1, r2));
|
||||
return((r1 == r2));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -303,7 +293,7 @@ NS_IMETHODIMP nsABDirectoryDataSource::GetTargets(nsIRDFResource* source,
|
|||
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv) && directory)
|
||||
{
|
||||
if (peq(kNC_Child, property))
|
||||
if ((kNC_Child == property))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subDirectories;
|
||||
|
||||
|
@ -317,7 +307,7 @@ NS_IMETHODIMP nsABDirectoryDataSource::GetTargets(nsIRDFResource* source,
|
|||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if(peq(kNC_DirName, property))
|
||||
else if((kNC_DirName == property))
|
||||
{
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(property);
|
||||
|
@ -327,7 +317,7 @@ NS_IMETHODIMP nsABDirectoryDataSource::GetTargets(nsIRDFResource* source,
|
|||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if(peq(kNC_CardChild, property))
|
||||
else if((kNC_CardChild == property))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> cardChild;
|
||||
|
||||
|
@ -341,7 +331,7 @@ NS_IMETHODIMP nsABDirectoryDataSource::GetTargets(nsIRDFResource* source,
|
|||
*targets = cursor;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else if(peq(kNC_DirChild, property))
|
||||
else if((kNC_DirChild == property))
|
||||
{
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
@ -556,8 +546,8 @@ nsABDirectoryDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/*
|
|||
directory = do_QueryInterface(source, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// we don't care about the arguments -- directory commands are always enabled
|
||||
if (!(peq(aCommand, kNC_Delete) ||
|
||||
peq(aCommand, kNC_NewDirectory))) {
|
||||
if (!((aCommand == kNC_Delete) ||
|
||||
(aCommand == kNC_NewDirectory))) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -582,10 +572,10 @@ nsABDirectoryDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSource
|
|||
nsCOMPtr<nsISupports> supports = getter_AddRefs(aSources->ElementAt(i));
|
||||
nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(supports, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (peq(aCommand, kNC_Delete)) {
|
||||
if ((aCommand == kNC_Delete)) {
|
||||
rv = DoDeleteFromDirectory(directory, aArguments);
|
||||
}
|
||||
else if(peq(aCommand, kNC_NewDirectory)) {
|
||||
else if((aCommand == kNC_NewDirectory)) {
|
||||
rv = DoNewDirectory(directory, aArguments);
|
||||
}
|
||||
|
||||
|
@ -679,11 +669,11 @@ nsresult nsABDirectoryDataSource::createDirectoryNode(nsIAbDirectory* directory,
|
|||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
if (peq(kNC_DirName, property))
|
||||
if ((kNC_DirName == property))
|
||||
rv = createDirectoryNameNode(directory, target);
|
||||
else if (peq(kNC_Child, property))
|
||||
else if ((kNC_Child == property))
|
||||
rv = createDirectoryChildNode(directory,target);
|
||||
else if (peq(kNC_CardChild, property))
|
||||
else if ((kNC_CardChild == property))
|
||||
rv = createCardChildNode(directory,target);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -208,12 +208,11 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
|||
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
nsCOMPtr<nsIMessage> message;
|
||||
PRBool equal;
|
||||
|
||||
folder = do_QueryInterface(source, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (NS_SUCCEEDED(property->EqualsResource(kNC_MessageChild, &equal)) && equal)
|
||||
if (property == kNC_MessageChild)
|
||||
{
|
||||
|
||||
if(mShowThreads)
|
||||
|
@ -256,7 +255,7 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
|||
}
|
||||
else if (mShowThreads && NS_SUCCEEDED(source->QueryInterface(nsIMessage::GetIID(), getter_AddRefs(message))))
|
||||
{
|
||||
if(NS_SUCCEEDED(property->EqualsResource(kNC_MessageChild, &equal)) && equal)
|
||||
if(property == kNC_MessageChild)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> msgfolder;
|
||||
rv = message->GetMsgFolder(getter_AddRefs(msgfolder));
|
||||
|
|
|
@ -262,7 +262,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (peq(kNC_Child, property))
|
||||
if ((kNC_Child == property))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
|
||||
|
@ -278,7 +278,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
else if (peq(kNC_MessageChild, property))
|
||||
else if ((kNC_MessageChild == property))
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> messages;
|
||||
|
||||
|
@ -294,7 +294,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
|||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
else if(peq(kNC_Name, property) || peq(kNC_SpecialFolder, property))
|
||||
else if((kNC_Name == property) || (kNC_SpecialFolder == property))
|
||||
{
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(property);
|
||||
|
@ -469,11 +469,11 @@ nsMsgFolderDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aS
|
|||
folder = do_QueryInterface(source, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// we don't care about the arguments -- folder commands are always enabled
|
||||
if (!(peq(aCommand, kNC_Delete) ||
|
||||
peq(aCommand, kNC_NewFolder) ||
|
||||
peq(aCommand, kNC_Copy) ||
|
||||
peq(aCommand, kNC_Move) ||
|
||||
peq(aCommand, kNC_GetNewMessages))) {
|
||||
if (!((aCommand == kNC_Delete) ||
|
||||
(aCommand == kNC_NewFolder) ||
|
||||
(aCommand == kNC_Copy) ||
|
||||
(aCommand == kNC_Move) ||
|
||||
(aCommand == kNC_GetNewMessages))) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -514,23 +514,23 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
|||
supports = getter_AddRefs(aSources->ElementAt(i));
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(supports, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (peq(aCommand, kNC_Delete))
|
||||
if ((aCommand == kNC_Delete))
|
||||
{
|
||||
rv = DoDeleteFromFolder(folder, aArguments, transactionManager);
|
||||
}
|
||||
else if(peq(aCommand, kNC_NewFolder))
|
||||
else if((aCommand == kNC_NewFolder))
|
||||
{
|
||||
rv = DoNewFolder(folder, aArguments);
|
||||
}
|
||||
else if(peq(aCommand, kNC_GetNewMessages))
|
||||
else if((aCommand == kNC_GetNewMessages))
|
||||
{
|
||||
rv = folder->GetNewMessages();
|
||||
}
|
||||
else if(peq(aCommand, kNC_Copy))
|
||||
else if((aCommand == kNC_Copy))
|
||||
{
|
||||
rv = DoCopyToFolder(folder, aArguments, transactionManager, PR_FALSE);
|
||||
}
|
||||
else if(peq(aCommand, kNC_Move))
|
||||
else if((aCommand == kNC_Move))
|
||||
{
|
||||
rv = DoCopyToFolder(folder, aArguments, transactionManager, PR_TRUE);
|
||||
}
|
||||
|
@ -678,21 +678,21 @@ nsresult nsMsgFolderDataSource::createFolderNode(nsIMsgFolder* folder,
|
|||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
if (peq(kNC_Name, property))
|
||||
if ((kNC_Name == property))
|
||||
rv = createFolderNameNode(folder, target);
|
||||
else if (peq(kNC_SpecialFolder, property))
|
||||
else if ((kNC_SpecialFolder == property))
|
||||
rv = createFolderSpecialNode(folder,target);
|
||||
else if (peq(kNC_TotalMessages, property))
|
||||
else if ((kNC_TotalMessages == property))
|
||||
rv = createTotalMessagesNode(folder, target);
|
||||
else if (peq(kNC_TotalUnreadMessages, property))
|
||||
else if ((kNC_TotalUnreadMessages == property))
|
||||
rv = createUnreadMessagesNode(folder, target);
|
||||
else if (peq(kNC_Charset, property))
|
||||
else if ((kNC_Charset == property))
|
||||
rv = createCharsetNode(folder, target);
|
||||
else if (peq(kNC_BiffState, property))
|
||||
else if ((kNC_BiffState == property))
|
||||
rv = createBiffStateNode(folder, target);
|
||||
else if (peq(kNC_Child, property))
|
||||
else if ((kNC_Child == property))
|
||||
rv = createFolderChildNode(folder, target);
|
||||
else if (peq(kNC_MessageChild, property))
|
||||
else if ((kNC_MessageChild == property))
|
||||
rv = createFolderMessageNode(folder, target);
|
||||
|
||||
return rv;
|
||||
|
@ -979,7 +979,7 @@ nsresult nsMsgFolderDataSource::DoFolderAssert(nsIMsgFolder *folder, nsIRDFResou
|
|||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if(peq(kNC_Charset, property))
|
||||
if((kNC_Charset == property))
|
||||
{
|
||||
nsCOMPtr<nsIRDFLiteral> literal(do_QueryInterface(target));
|
||||
if(literal)
|
||||
|
@ -1015,7 +1015,7 @@ nsresult nsMsgFolderDataSource::DoFolderHasAssertion(nsIMsgFolder *folder, nsIRD
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if(peq(kNC_Child, property))
|
||||
if((kNC_Child == property))
|
||||
{
|
||||
nsCOMPtr<nsIFolder> childFolder(do_QueryInterface(target, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
|
@ -1027,14 +1027,14 @@ nsresult nsMsgFolderDataSource::DoFolderHasAssertion(nsIMsgFolder *folder, nsIRD
|
|||
&& (childsParent.get() == folderasFolder.get()));
|
||||
}
|
||||
}
|
||||
else if(peq(kNC_MessageChild, property))
|
||||
else if((kNC_MessageChild == property))
|
||||
{
|
||||
nsCOMPtr<nsIMessage> message(do_QueryInterface(target, &rv));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
rv = folder->HasMessage(message, hasAssertion);
|
||||
}
|
||||
else if (peq(kNC_Name, property) || peq(kNC_SpecialFolder, property) || peq(kNC_TotalMessages, property)
|
||||
|| peq(kNC_TotalUnreadMessages, property) || peq(kNC_Charset, property) || peq(kNC_BiffState, property))
|
||||
else if ((kNC_Name == property) || (kNC_SpecialFolder == property) || (kNC_TotalMessages == property)
|
||||
|| (kNC_TotalUnreadMessages == property) || (kNC_Charset == property) || (kNC_BiffState == property))
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> folderResource(do_QueryInterface(folder, &rv));
|
||||
|
||||
|
|
|
@ -248,8 +248,8 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
|
|||
*targets = nsnull;
|
||||
nsCOMPtr<nsIMessage> message(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if(peq(kNC_Subject, property) || peq(kNC_Date, property) ||
|
||||
peq(kNC_Status, property))
|
||||
if((kNC_Subject == property) || (kNC_Date == property) ||
|
||||
(kNC_Status == property))
|
||||
{
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(source);
|
||||
|
@ -429,9 +429,9 @@ nsMsgMessageDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources
|
|||
nsCOMPtr<nsIMessage> message = do_QueryInterface(source, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if(peq(aCommand, kNC_MarkRead))
|
||||
if((aCommand == kNC_MarkRead))
|
||||
rv = DoMarkMessageRead(message, PR_TRUE);
|
||||
else if(peq(aCommand, kNC_MarkUnread))
|
||||
else if((aCommand == kNC_MarkUnread))
|
||||
rv = DoMarkMessageRead(message, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -491,9 +491,9 @@ nsMsgMessageDataSource::createMessageNode(nsIMessage *message,
|
|||
return createMessageNameNode(message, sort, target);
|
||||
else if (peqCollationSort(kNC_Sender, property, &sort))
|
||||
return createMessageSenderNode(message, sort, target);
|
||||
else if (peq(kNC_Date, property))
|
||||
else if ((kNC_Date == property))
|
||||
return createMessageDateNode(message, target);
|
||||
else if (peq(kNC_Status, property))
|
||||
else if ((kNC_Status == property))
|
||||
return createMessageStatusNode(message, target);
|
||||
else
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
|
|
@ -26,17 +26,6 @@
|
|||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
PRBool
|
||||
peq(nsIRDFResource* r1, nsIRDFResource* r2)
|
||||
{
|
||||
PRBool result;
|
||||
if (NS_SUCCEEDED(r1->EqualsResource(r2, &result)) && result) {
|
||||
return PR_TRUE;
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
peqWithParameter(nsIRDFResource *r1, nsIRDFResource *r2, PRBool *isParameter, const char *parameter)
|
||||
{
|
||||
|
@ -141,7 +130,7 @@ nsresult GetTargetHasAssertion(nsIRDFDataSource *dataSource, nsIRDFResource* fol
|
|||
nsCOMPtr<nsIRDFLiteral> value2(do_QueryInterface(currentTarget));
|
||||
if(value1 && value2)
|
||||
//If the two values are equal then it has this assertion
|
||||
rv = value1->EqualsLiteral(value2, hasAssertion);
|
||||
*hasAssertion = (value1 == value2);
|
||||
}
|
||||
else
|
||||
rv = NS_NOINTERFACE;
|
||||
|
|
|
@ -61,10 +61,6 @@ typedef struct _nsMsgRDFNotification {
|
|||
#define NC_RDF_TOGGLEREAD "http://home.netscape.com/NC-rdf#ToggleRead"
|
||||
|
||||
|
||||
//Returns PR_TRUE if r1 is equal to r2
|
||||
PRBool
|
||||
peq(nsIRDFResource* r1, nsIRDFResource* r2);
|
||||
|
||||
//Returns PR_TRUE if r1 is equal to r2 and r2 is the sort property.
|
||||
PRBool
|
||||
peqSort(nsIRDFResource* r1, nsIRDFResource* r2, PRBool *isSort);
|
||||
|
|
|
@ -22,37 +22,42 @@
|
|||
#include "nscore.h" // for PRUnichar
|
||||
%}
|
||||
|
||||
// A literal node in the graph, whose value is a string.
|
||||
/**
|
||||
* A literal node in the graph, whose value is a string.
|
||||
*/
|
||||
[scriptable, uuid(E0C493D2-9542-11d2-8EB8-00805F29F370)]
|
||||
interface nsIRDFLiteral : nsIRDFNode {
|
||||
// The Unicode string value of the literal.
|
||||
/**
|
||||
* The Unicode string value of the literal.
|
||||
*/
|
||||
readonly attribute wstring Value;
|
||||
|
||||
// Determine if two literals are identical.
|
||||
boolean EqualsLiteral(in nsIRDFLiteral aLiteral);
|
||||
/**
|
||||
* An unscriptable version used to avoid a string copy. Meant
|
||||
* for use as a performance optimization.
|
||||
*/
|
||||
[noscript] void GetValueConst([shared] out wstring aConstValue);
|
||||
};
|
||||
|
||||
// A literal node in the graph, whose value is a date
|
||||
/**
|
||||
* A literal node in the graph, whose value is a date
|
||||
*/
|
||||
[scriptable, uuid(E13A24E1-C77A-11d2-80BE-006097B76B8E)]
|
||||
interface nsIRDFDate : nsIRDFNode {
|
||||
// The date value of the literal
|
||||
/**
|
||||
* The date value of the literal
|
||||
*/
|
||||
readonly attribute long long Value;
|
||||
|
||||
// Determine if the date is equal to another
|
||||
//
|
||||
// XXX Is this really necessary?
|
||||
boolean EqualsDate(in nsIRDFDate aDate);
|
||||
};
|
||||
|
||||
// A literal node in the graph, whose value is an integer
|
||||
/**
|
||||
* A literal node in the graph, whose value is an integer
|
||||
*/
|
||||
[scriptable, uuid(E13A24E3-C77A-11d2-80BE-006097B76B8E)]
|
||||
interface nsIRDFInt : nsIRDFNode {
|
||||
// The integer value of the literal
|
||||
/**
|
||||
* The integer value of the literal
|
||||
*/
|
||||
readonly attribute long Value;
|
||||
|
||||
// Determine if the integer is equal to another
|
||||
//
|
||||
// XXX Is this really necessary?
|
||||
boolean EqualsInt(in nsIRDFInt aInt);
|
||||
};
|
||||
|
||||
|
|
|
@ -19,22 +19,33 @@
|
|||
#include "nsIRDFNode.idl"
|
||||
|
||||
|
||||
// An nsIRDFResource is an object that has unique identity in the
|
||||
// RDF data model. The object's identity is determined by its URI.
|
||||
/**
|
||||
* An nsIRDFResource is an object that has unique identity in the
|
||||
* RDF data model. The object's identity is determined by its URI.
|
||||
*/
|
||||
[scriptable, uuid(E0C493D1-9542-11d2-8EB8-00805F29F370)]
|
||||
interface nsIRDFResource : nsIRDFNode {
|
||||
// The single-byte string value of the resource
|
||||
/**
|
||||
* The single-byte string value of the resource
|
||||
*/
|
||||
readonly attribute string Value;
|
||||
|
||||
// This method is called by the nsIRDFService after constructing
|
||||
// a resource object to initialize it's URI. You would not normally
|
||||
// call this method directly
|
||||
/**
|
||||
* An unscriptable version used to avoid a string copy. Meant
|
||||
* for use as a performance optimization.
|
||||
*/
|
||||
[noscript] void GetValueConst([shared] out string aConstValue);
|
||||
|
||||
/**
|
||||
* This method is called by the nsIRDFService after constructing
|
||||
* a resource object to initialize it's URI. You would not normally
|
||||
* call this method directly
|
||||
*/
|
||||
void Init(in string uri);
|
||||
|
||||
// Determine if two resources are identical.
|
||||
boolean EqualsResource(in nsIRDFResource aResource);
|
||||
|
||||
// Determine if the resource has the given URI.
|
||||
/**
|
||||
* Determine if the resource has the given URI.
|
||||
*/
|
||||
boolean EqualsString(in string aURI);
|
||||
};
|
||||
|
||||
|
|
|
@ -120,11 +120,11 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFNode
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* node, PRBool* result);
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* aNode, PRBool* aResult);
|
||||
|
||||
// nsIRDFLiteral
|
||||
NS_IMETHOD GetValue(PRUnichar* *value);
|
||||
NS_IMETHOD EqualsLiteral(nsIRDFLiteral* literal, PRBool* result);
|
||||
NS_IMETHOD GetValue(PRUnichar* *aValue);
|
||||
NS_IMETHOD GetValueConst(const PRUnichar** aValue);
|
||||
|
||||
private:
|
||||
nsAutoString mValue;
|
||||
|
@ -164,19 +164,23 @@ LiteralImpl::QueryInterface(REFNSIID iid, void** result)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LiteralImpl::EqualsNode(nsIRDFNode* node, PRBool* result)
|
||||
LiteralImpl::EqualsNode(nsIRDFNode* aNode, PRBool* aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIRDFLiteral* literal;
|
||||
if (NS_SUCCEEDED(node->QueryInterface(kIRDFLiteralIID, (void**) &literal))) {
|
||||
rv = EqualsLiteral(literal, result);
|
||||
rv = aNode->QueryInterface(kIRDFLiteralIID, (void**) &literal);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aResult = (NS_STATIC_CAST(nsIRDFLiteral*, this) == literal);
|
||||
NS_RELEASE(literal);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (rv == NS_NOINTERFACE) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*result = PR_FALSE;
|
||||
rv = NS_OK;
|
||||
return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -192,24 +196,12 @@ LiteralImpl::GetValue(PRUnichar* *value)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
LiteralImpl::EqualsLiteral(nsIRDFLiteral* literal, PRBool* result)
|
||||
LiteralImpl::GetValueConst(const PRUnichar** aValue)
|
||||
{
|
||||
NS_ASSERTION(literal && result, "null ptr");
|
||||
if (!literal || !result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
nsXPIDLString p;
|
||||
if (NS_FAILED(rv = literal->GetValue(getter_Copies(p))))
|
||||
return rv;
|
||||
|
||||
nsAutoString s((const PRUnichar*) p);
|
||||
|
||||
*result = s.Equals(mValue);
|
||||
*aValue = mValue.GetUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// DateImpl
|
||||
//
|
||||
|
@ -227,9 +219,9 @@ public:
|
|||
|
||||
// nsIRDFDate
|
||||
NS_IMETHOD GetValue(PRTime *value);
|
||||
NS_IMETHOD EqualsDate(nsIRDFDate* date, PRBool* result);
|
||||
|
||||
private:
|
||||
nsresult EqualsDate(nsIRDFDate* date, PRBool* result);
|
||||
PRTime mValue;
|
||||
};
|
||||
|
||||
|
@ -292,7 +284,7 @@ DateImpl::GetValue(PRTime *value)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
DateImpl::EqualsDate(nsIRDFDate* date, PRBool* result)
|
||||
{
|
||||
NS_ASSERTION(date && result, "null ptr");
|
||||
|
@ -325,9 +317,9 @@ public:
|
|||
|
||||
// nsIRDFInt
|
||||
NS_IMETHOD GetValue(PRInt32 *value);
|
||||
NS_IMETHOD EqualsInt(nsIRDFInt* value, PRBool* result);
|
||||
|
||||
private:
|
||||
nsresult EqualsInt(nsIRDFInt* value, PRBool* result);
|
||||
PRInt32 mValue;
|
||||
};
|
||||
|
||||
|
@ -390,7 +382,7 @@ IntImpl::GetValue(PRInt32 *value)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
IntImpl::EqualsInt(nsIRDFInt* intValue, PRBool* result)
|
||||
{
|
||||
NS_ASSERTION(intValue && result, "null ptr");
|
||||
|
|
|
@ -35,13 +35,13 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFNode methods:
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* node, PRBool* result);
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* aNode, PRBool* aResult);
|
||||
|
||||
// nsIRDFResource methods:
|
||||
NS_IMETHOD Init(const char* uri);
|
||||
NS_IMETHOD GetValue(char* *uri);
|
||||
NS_IMETHOD EqualsResource(nsIRDFResource* resource, PRBool* result);
|
||||
NS_IMETHOD EqualsString(const char* uri, PRBool* result);
|
||||
NS_IMETHOD Init(const char* aURI);
|
||||
NS_IMETHOD GetValue(char* *aURI);
|
||||
NS_IMETHOD GetValueConst(const char** aURI);
|
||||
NS_IMETHOD EqualsString(const char* aURI, PRBool* aResult);
|
||||
|
||||
// nsRDFResource methods:
|
||||
nsRDFResource(void);
|
||||
|
|
|
@ -60,16 +60,17 @@ NS_IMPL_ADDREF(nsRDFResource)
|
|||
NS_IMPL_RELEASE(nsRDFResource)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::QueryInterface(REFNSIID iid, void** result)
|
||||
nsRDFResource::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
if (! result)
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIRDFResource::GetIID()) ||
|
||||
iid.Equals(nsIRDFNode::GetIID()) ||
|
||||
iid.Equals(kISupportsIID)) {
|
||||
*result = NS_STATIC_CAST(nsIRDFResource*, this);
|
||||
*aResult = nsnull;
|
||||
if (aIID.Equals(nsIRDFResource::GetIID()) ||
|
||||
aIID.Equals(nsIRDFNode::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFResource*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -81,19 +82,27 @@ nsRDFResource::QueryInterface(REFNSIID iid, void** result)
|
|||
// nsIRDFNode methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::EqualsNode(nsIRDFNode* node, PRBool* result)
|
||||
nsRDFResource::EqualsNode(nsIRDFNode* aNode, PRBool* aResult)
|
||||
{
|
||||
NS_PRECONDITION(aNode != nsnull, "null ptr");
|
||||
if (! aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
nsIRDFResource* resource;
|
||||
if (NS_SUCCEEDED(node->QueryInterface(nsIRDFResource::GetIID(), (void**)&resource))) {
|
||||
rv = EqualsResource(resource, result);
|
||||
rv = aNode->QueryInterface(nsIRDFResource::GetIID(), (void**)&resource);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aResult = (NS_STATIC_CAST(nsIRDFResource*, this) == resource);
|
||||
NS_RELEASE(resource);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (rv == NS_NOINTERFACE) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*result = PR_FALSE;
|
||||
rv = NS_OK;
|
||||
return rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -132,41 +141,36 @@ nsRDFResource::Init(const char* aURI)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::GetValue(char* *uri)
|
||||
nsRDFResource::GetValue(char* *aURI)
|
||||
{
|
||||
if (!uri)
|
||||
if (!aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if ((*uri = nsXPIDLCString::Copy(mURI)) == nsnull)
|
||||
if ((*aURI = nsXPIDLCString::Copy(mURI)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::EqualsResource(nsIRDFResource* resource, PRBool* result)
|
||||
nsRDFResource::GetValueConst(const char** aURI)
|
||||
{
|
||||
NS_PRECONDITION(resource != nsnull, "null ptr");
|
||||
NS_PRECONDITION(result != nsnull, "null ptr");
|
||||
|
||||
if (!resource || !result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// nsIRDFResource interfaces are unique
|
||||
*result = ((nsIRDFResource*) this) == resource;
|
||||
*aURI = mURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::EqualsString(const char* uri, PRBool* result)
|
||||
nsRDFResource::EqualsString(const char* aURI, PRBool* aResult)
|
||||
{
|
||||
NS_PRECONDITION(uri != nsnull, "null ptr");
|
||||
NS_PRECONDITION(result != nsnull, "null ptr");
|
||||
|
||||
if (!uri || !result)
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (! aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsCRT::strcmp(uri, mURI) == 0;
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = (nsCRT::strcmp(aURI, mURI) == 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1455,7 +1455,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileSt
|
|||
if (!child) break;
|
||||
|
||||
PRBool isIERoot = PR_FALSE, isContainer = PR_FALSE;
|
||||
if (NS_SUCCEEDED(child->EqualsResource(kNC_IEFavoritesRoot, &isIERoot)))
|
||||
if (child == kNC_IEFavoritesRoot)
|
||||
{
|
||||
if (isIERoot == PR_FALSE)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче