Added GetTargetHasAssertion, GetNewMessages and use string instead of ints for

property names.
This commit is contained in:
putterman%netscape.com 1999-05-07 00:32:10 +00:00
Родитель 596ceb9c57
Коммит 0c6c872206
5 изменённых файлов: 58 добавлений и 25 удалений

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

@ -118,11 +118,11 @@ NS_IMETHODIMP nsMessageViewDataSource::Init(const char* uri)
mRDFService->RegisterDataSource(this, PR_FALSE);
if (! kNC_MessageChild) {
mRDFService->GetResource(kURINC_MessageChild, &kNC_MessageChild);
mRDFService->GetResource(kURINC_Subject, &kNC_Subject);
mRDFService->GetResource(kURINC_Date, &kNC_Date);
mRDFService->GetResource(kURINC_Sender, &kNC_Sender);
mRDFService->GetResource(kURINC_Status , &kNC_Status);
mRDFService->GetResource(NC_RDF_MESSAGECHILD, &kNC_MessageChild);
mRDFService->GetResource(NC_RDF_SUBJECT, &kNC_Subject);
mRDFService->GetResource(NC_RDF_DATE, &kNC_Date);
mRDFService->GetResource(NC_RDF_SENDER, &kNC_Sender);
mRDFService->GetResource(NC_RDF_STATUS , &kNC_Status);
}
mInitialized = PR_TRUE;

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

@ -143,8 +143,8 @@ nsMsgAccountManagerDataSource::Init(const char *uri)
}
if (! kNC_Child) {
getRDFService()->GetResource(kURINC_child, &kNC_Child);
getRDFService()->GetResource(kURINC_Name, &kNC_Name);
getRDFService()->GetResource(NC_RDF_CHILD, &kNC_Child);
getRDFService()->GetResource(NC_RDF_NAME, &kNC_Name);
getRDFService()->GetResource(kURINC_Account, &kNC_Account);
getRDFService()->GetResource(kURINC_Server, &kNC_Server);
getRDFService()->GetResource(kURINC_Identity, &kNC_Identity);

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

@ -122,10 +122,10 @@ NS_IMETHODIMP nsMsgMessageDataSource::Init(const char* uri)
if (! kNC_Subject) {
mRDFService->GetResource(kURINC_Subject, &kNC_Subject);
mRDFService->GetResource(kURINC_Sender, &kNC_Sender);
mRDFService->GetResource(kURINC_Date, &kNC_Date);
mRDFService->GetResource(kURINC_Status, &kNC_Status);
mRDFService->GetResource(NC_RDF_SUBJECT, &kNC_Subject);
mRDFService->GetResource(NC_RDF_SENDER, &kNC_Sender);
mRDFService->GetResource(NC_RDF_DATE, &kNC_Date);
mRDFService->GetResource(NC_RDF_STATUS, &kNC_Status);
}
mInitialized = PR_TRUE;

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

@ -101,3 +101,28 @@ nsresult createNode(PRUint32 value, nsIRDFNode **node)
rv = createNode(str, node);
return rv;
}
nsresult GetTargetHasAssertion(nsIRDFDataSource *dataSource, nsIRDFResource* folderResource,
nsIRDFResource *property,PRBool tv, nsIRDFNode *target,PRBool* hasAssertion)
{
nsresult rv;
if(!hasAssertion)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIRDFNode> currentTarget;
rv = dataSource->GetTarget(folderResource, property,tv, getter_AddRefs(currentTarget));
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIRDFLiteral> value1(do_QueryInterface(target));
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);
}
else
rv = NS_NOINTERFACE;
return rv;
}

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

@ -21,6 +21,7 @@
#include "rdf.h"
#include "nsIRDFResource.h"
#include "nsIRDFNode.h"
#include "nsIRDFDataSource.h"
#include "nsString.h"
// this is used for notification of observers using nsVoidArray
@ -31,23 +32,23 @@ typedef struct _nsMsgRDFNotification {
} nsMsgRDFNotification;
//Some property declarations
#define NC_NAMESPACE_URI "http://home.netscape.com/NC-rdf#"
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Subject);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Sender);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Date);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Status);
#define NC_RDF_SUBJECT "http://home.netscape.com/NC-rdf#Subject"
#define NC_RDF_SENDER "http://home.netscape.com/NC-rdf#Sender"
#define NC_RDF_DATE "http://home.netscape.com/NC-rdf#Date"
#define NC_RDF_STATUS "http://home.netscape.com/NC-rdf#Status"
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, MessageChild);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Folder);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, SpecialFolder);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, TotalMessages);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, TotalUnreadMessages);
#define NC_RDF_CHILD "http://home.netscape.com/NC-rdf#child"
#define NC_RDF_MESSAGECHILD "http://home.netscape.com/NC-rdf#MessageChild"
#define NC_RDF_NAME "http://home.netscape.com/NC-rdf#Name"
#define NC_RDF_FOLDER "http://home.netscape.com/NC-rdf#Folder"
#define NC_RDF_SPECIALFOLDER "http://home.netscape.com/NC-rdf#SpecialFolder"
#define NC_RDF_TOTALMESSAGES "http://home.netscape.com/NC-rdf#TotalMessages"
#define NC_RDF_TOTALUNREADMESSAGES "http://home.netscape.com/NC-rdf#TotalUnreadMessages"
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Delete);
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, NewFolder);
#define NC_RDF_DELETE "http://home.netscape.com/NC-rdf#Delete"
#define NC_RDF_NEWFOLDER "http://home.netscape.com/NC-rdf#NewFolder"
#define NC_RDF_GETNEWMESSAGES "http://home.netscape.com/NC-rdf#GetNewMessages"
//Returns PR_TRUE if r1 is equal to r2
@ -64,3 +65,10 @@ nsresult createNode(nsString& str, nsIRDFNode **node);
//Given a PRUint32, create an nsiIRDFNode.
nsresult createNode(PRUint32 value, nsIRDFNode **node);
//Has Assertion for a datasource that will just call GetTarget on property. When all of our
//datasource derive from our datasource baseclass, this should be moved there and the first
//parameter will no longer be needed.
nsresult GetTargetHasAssertion(nsIRDFDataSource *dataSource, nsIRDFResource* folderResource,
nsIRDFResource *property,PRBool tv, nsIRDFNode *target,PRBool* hasAssertion);