Changed to use nsIRDFEnumerator instead of nsIRDFCursor.
git-svn-id: svn://10.0.0.236/branches/RDF_19990422_BRANCH@28790 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@@ -75,7 +74,7 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources /* out */) ;
|
||||
nsIRDFEnumerator** sources /* out */) ;
|
||||
NS_IMETHOD GetTarget(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
@@ -83,7 +82,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets /* out */) ;
|
||||
nsIRDFEnumerator** targets /* out */) ;
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
@@ -99,10 +98,10 @@ public:
|
||||
NS_IMETHOD AddObserver(nsIRDFObserver* n) ;
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n) ;
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels /* out */) ;
|
||||
nsIRDFEnumerator** labels /* out */) ;
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels /* out */) ;
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) ;
|
||||
nsIRDFEnumerator** labels /* out */) ;
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) ;
|
||||
NS_IMETHOD Flush(void) ;
|
||||
NS_IMETHOD GetAllCommands(nsIRDFResource* source,
|
||||
nsIEnumerator/*<nsIRDFResource>*/** commands) ;
|
||||
@@ -493,7 +492,7 @@ NS_IMETHODIMP
|
||||
nsChromeRegistry::GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources /* out */)
|
||||
nsIRDFEnumerator** sources /* out */)
|
||||
{
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
@@ -512,7 +511,7 @@ NS_IMETHODIMP
|
||||
nsChromeRegistry::GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets /* out */)
|
||||
nsIRDFEnumerator** targets /* out */)
|
||||
{
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
@@ -555,18 +554,18 @@ NS_IMETHODIMP nsChromeRegistry::RemoveObserver(nsIRDFObserver* n)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels /* out */)
|
||||
nsIRDFEnumerator** labels /* out */)
|
||||
{
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels /* out */)
|
||||
nsIRDFEnumerator** labels /* out */)
|
||||
{
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
NS_IMETHODIMP nsChromeRegistry::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
return mInner->GetAllResources(aCursor);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "nsMessageViewDataSource.h"
|
||||
#include "nsRDFCursorUtils.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@@ -166,7 +166,7 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTarget(nsIRDFResource* source,
|
||||
NS_IMETHODIMP nsMessageViewDataSource::GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources)
|
||||
nsIRDFEnumerator** sources)
|
||||
{
|
||||
if(mDataSource)
|
||||
return mDataSource->GetSources(property, target, tv, sources);
|
||||
@@ -177,7 +177,7 @@ NS_IMETHODIMP nsMessageViewDataSource::GetSources(nsIRDFResource* property,
|
||||
NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets)
|
||||
nsIRDFEnumerator** targets)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
@@ -198,8 +198,8 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
||||
new nsMessageViewThreadEnumerator(threads);
|
||||
if(!threadEnumerator)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(this, source, kNC_MessageChild, threadEnumerator);
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(threadEnumerator);
|
||||
NS_IF_RELEASE(threads);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -216,8 +216,8 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
||||
new nsMessageViewMessageEnumerator(messages, mShowStatus);
|
||||
if(!messageEnumerator)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(this, source, kNC_MessageChild, messageEnumerator);
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(messageEnumerator);
|
||||
NS_IF_RELEASE(messages);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -250,8 +250,8 @@ NS_IMETHODIMP nsMessageViewDataSource::GetTargets(nsIRDFResource* source,
|
||||
new nsMessageViewMessageEnumerator(messages, mShowStatus);
|
||||
if(!messageEnumerator)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(this, source, kNC_MessageChild, messageEnumerator);
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(messageEnumerator);
|
||||
NS_IF_RELEASE(messages);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -328,7 +328,7 @@ NS_IMETHODIMP nsMessageViewDataSource::RemoveObserver(nsIRDFObserver* n)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessageViewDataSource::ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
if(mDataSource)
|
||||
return mDataSource->ArcLabelsIn(node, labels);
|
||||
@@ -337,7 +337,7 @@ NS_IMETHODIMP nsMessageViewDataSource::ArcLabelsIn(nsIRDFNode* node,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessageViewDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
|
||||
nsIMessage *message;
|
||||
@@ -377,8 +377,8 @@ NS_IMETHODIMP nsMessageViewDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
NS_IF_RELEASE(folder);
|
||||
}
|
||||
NS_IF_RELEASE(message);
|
||||
nsRDFArrayArcsOutCursor* cursor =
|
||||
new nsRDFArrayArcsOutCursor(this, source, arcs);
|
||||
nsArrayEnumerator* cursor =
|
||||
new nsArrayEnumerator(arcs);
|
||||
NS_RELEASE(arcs);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -392,7 +392,7 @@ NS_IMETHODIMP nsMessageViewDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessageViewDataSource::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
NS_IMETHODIMP nsMessageViewDataSource::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
if(mDataSource)
|
||||
return mDataSource->GetAllResources(aCursor);
|
||||
|
||||
@@ -67,12 +67,12 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources);
|
||||
nsIRDFEnumerator** sources);
|
||||
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets);
|
||||
nsIRDFEnumerator** targets);
|
||||
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
@@ -94,12 +94,12 @@ public:
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n);
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult);
|
||||
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *aProperty,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFArcsOutCursor **_retval);
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFEnumerator **_retval);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -169,12 +169,12 @@ nsMsgAccountDataSource::GetTarget(nsIRDFResource *source,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
@@ -191,10 +191,10 @@ nsMsgAccountDataSource::GetTargets(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
nsIRDFArcsOutCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
|
||||
@@ -64,11 +64,11 @@ public:
|
||||
PRBool aTruthValue,
|
||||
nsIRDFResource **_retval);
|
||||
|
||||
/* nsIRDFAssertionCursor GetSources (in nsIRDFResource property, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetSources (in nsIRDFResource property, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
NS_IMETHOD GetSources(nsIRDFResource *property,
|
||||
nsIRDFNode *aTarget,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
NS_IMETHOD GetTarget(nsIRDFResource *source,
|
||||
@@ -76,11 +76,11 @@ public:
|
||||
PRBool aTruthValue,
|
||||
nsIRDFNode **_retval);
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* void Assert (in nsIRDFResource aSource, in nsIRDFResource property, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
NS_IMETHOD Assert(nsIRDFResource *source,
|
||||
@@ -106,14 +106,14 @@ public:
|
||||
/* void RemoveObserver (in nsIRDFObserver aObserver); */
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver *aObserver);
|
||||
|
||||
/* nsIRDFArcsInCursor ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode *aNode, nsIRDFArcsInCursor **_retval);
|
||||
/* nsIRDFEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode *aNode, nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFArcsOutCursor **_retval);
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFResourceCursor GetAllResources (); */
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor **_retval);
|
||||
/* nsIRDFEnumerator GetAllResources (); */
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator **_retval);
|
||||
|
||||
/* void Flush (); */
|
||||
NS_IMETHOD Flush();
|
||||
@@ -263,12 +263,12 @@ nsMsgAccountManagerDataSource::GetSource(nsIRDFResource *property,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIRDFAssertionCursor GetSources (in nsIRDFResource property, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetSources (in nsIRDFResource property, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManagerDataSource::GetSources(nsIRDFResource *property,
|
||||
nsIRDFNode *aTarget,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -292,12 +292,12 @@ nsMsgAccountManagerDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManagerDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
@@ -370,27 +370,27 @@ nsMsgAccountManagerDataSource::RemoveObserver(nsIRDFObserver *aObserver)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIRDFArcsInCursor ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
/* nsIRDFEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManagerDataSource::ArcLabelsIn(nsIRDFNode *aNode,
|
||||
nsIRDFArcsInCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManagerDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
nsIRDFArcsOutCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIRDFResourceCursor GetAllResources (); */
|
||||
/* nsIRDFEnumerator GetAllResources (); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccountManagerDataSource::GetAllResources(nsIRDFResourceCursor **_retval)
|
||||
nsMsgAccountManagerDataSource::GetAllResources(nsIRDFEnumerator **_retval)
|
||||
{
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsRDFCursorUtils.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@@ -41,7 +41,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
// 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_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
||||
|
||||
nsIRDFResource* nsMsgFolderDataSource::kNC_Child;
|
||||
nsIRDFResource* nsMsgFolderDataSource::kNC_MessageChild;
|
||||
@@ -198,7 +197,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTarget(nsIRDFResource* source,
|
||||
NS_IMETHODIMP nsMsgFolderDataSource::GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources)
|
||||
nsIRDFEnumerator** sources)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -207,7 +206,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetSources(nsIRDFResource* property,
|
||||
NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets)
|
||||
nsIRDFEnumerator** targets)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
@@ -221,8 +220,8 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
||||
rv = folder->GetSubFolders(&subFolders);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
//folder->GetMessages(&subFolders);
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(this, source, kNC_Child, subFolders);
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(subFolders);
|
||||
NS_IF_RELEASE(subFolders);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -236,8 +235,8 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
||||
|
||||
rv = folder->GetMessages(&messages);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRDFEnumeratorAssertionCursor* cursor =
|
||||
new nsRDFEnumeratorAssertionCursor(this, source, kNC_MessageChild, messages);
|
||||
nsAdapterEnumerator* cursor =
|
||||
new nsAdapterEnumerator(messages);
|
||||
NS_IF_RELEASE(messages);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
@@ -247,8 +246,8 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
||||
}
|
||||
else if(peq(kNC_Name, property) || peq(kNC_SpecialFolder, property))
|
||||
{
|
||||
nsRDFSingletonAssertionCursor* cursor =
|
||||
new nsRDFSingletonAssertionCursor(this, source, property);
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(property);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
@@ -261,10 +260,8 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source,
|
||||
//create empty cursor
|
||||
nsISupportsArray *assertions;
|
||||
NS_NewISupportsArray(&assertions);
|
||||
nsRDFArrayAssertionCursor* cursor =
|
||||
new nsRDFArrayAssertionCursor(this,
|
||||
source, property,
|
||||
assertions);
|
||||
nsArrayEnumerator* cursor =
|
||||
new nsArrayEnumerator(assertions);
|
||||
if(cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
@@ -360,14 +357,14 @@ nsresult nsMsgFolderDataSource::NotifyObservers(nsIRDFResource *subject,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
nsISupportsArray *arcs=nsnull;
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
@@ -388,8 +385,8 @@ NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
NS_NewISupportsArray(&arcs);
|
||||
}
|
||||
|
||||
nsRDFArrayArcsOutCursor* cursor =
|
||||
new nsRDFArrayArcsOutCursor(this, source, arcs);
|
||||
nsArrayEnumerator* cursor =
|
||||
new nsArrayEnumerator(arcs);
|
||||
NS_RELEASE(arcs);
|
||||
|
||||
if (cursor == nsnull)
|
||||
@@ -431,7 +428,7 @@ nsMsgFolderDataSource::getFolderArcLabelsOut(nsIMsgFolder *folder,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
nsMsgFolderDataSource::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("sorry!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -64,12 +64,12 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources);
|
||||
nsIRDFEnumerator** sources);
|
||||
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets);
|
||||
nsIRDFEnumerator** targets);
|
||||
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
@@ -91,12 +91,12 @@ public:
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n);
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult);
|
||||
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ public:
|
||||
PRBool aTruthValue,
|
||||
nsIRDFNode **_retval);
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource source, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource source, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource source); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFArcsOutCursor **_retval);
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource source); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source, nsIRDFEnumerator **_retval);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -128,12 +128,12 @@ nsMsgIdentityDataSource::GetTarget(nsIRDFResource *source,
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource source, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource source, in nsIRDFResource property, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgIdentityDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
@@ -145,10 +145,10 @@ nsMsgIdentityDataSource::GetTargets(nsIRDFResource *source,
|
||||
|
||||
}
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource source); */
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource source); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgIdentityDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
nsIRDFArcsOutCursor **_retval)
|
||||
nsIRDFEnumerator **_retval)
|
||||
{
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "rdf.h"
|
||||
#include "nsRDFCursorUtils.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
#include "nsIMessage.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@@ -36,7 +36,6 @@ static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
// 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_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
||||
|
||||
|
||||
nsIRDFResource* nsMsgMessageDataSource::kNC_Subject;
|
||||
@@ -202,7 +201,7 @@ nsresult nsMsgMessageDataSource::GetSenderName(nsAutoString& sender, nsAutoStrin
|
||||
NS_IMETHODIMP nsMsgMessageDataSource::GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources)
|
||||
nsIRDFEnumerator** sources)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -211,7 +210,7 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetSources(nsIRDFResource* property,
|
||||
NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets)
|
||||
nsIRDFEnumerator** targets)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
|
||||
@@ -220,8 +219,8 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
|
||||
if(peq(kNC_Subject, property) || peq(kNC_Date, property) ||
|
||||
peq(kNC_Status, property))
|
||||
{
|
||||
nsRDFSingletonAssertionCursor* cursor =
|
||||
new nsRDFSingletonAssertionCursor(this, source, property, PR_FALSE);
|
||||
nsSingletonEnumerator* cursor =
|
||||
new nsSingletonEnumerator(source);
|
||||
if (cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
@@ -234,10 +233,8 @@ NS_IMETHODIMP nsMsgMessageDataSource::GetTargets(nsIRDFResource* source,
|
||||
//create empty cursor
|
||||
nsISupportsArray *assertions;
|
||||
NS_NewISupportsArray(&assertions);
|
||||
nsRDFArrayAssertionCursor* cursor =
|
||||
new nsRDFArrayAssertionCursor(this,
|
||||
source, property,
|
||||
assertions);
|
||||
nsArrayEnumerator* cursor =
|
||||
new nsArrayEnumerator(assertions);
|
||||
if(cursor == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(cursor);
|
||||
@@ -293,14 +290,14 @@ NS_IMETHODIMP nsMsgMessageDataSource::RemoveObserver(nsIRDFObserver* n)
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels)
|
||||
nsIRDFEnumerator** labels)
|
||||
{
|
||||
nsISupportsArray *arcs=nsnull;
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
@@ -320,8 +317,8 @@ NS_IMETHODIMP nsMsgMessageDataSource::ArcLabelsOut(nsIRDFResource* source,
|
||||
NS_NewISupportsArray(&arcs);
|
||||
}
|
||||
|
||||
nsRDFArrayArcsOutCursor* cursor =
|
||||
new nsRDFArrayArcsOutCursor(this, source, arcs);
|
||||
nsArrayEnumerator* cursor =
|
||||
new nsArrayEnumerator(arcs);
|
||||
NS_RELEASE(arcs);
|
||||
|
||||
if (cursor == nsnull)
|
||||
@@ -348,7 +345,7 @@ nsMsgMessageDataSource::getMessageArcLabelsOut(nsIMessage *folder,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMessageDataSource::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
nsMsgMessageDataSource::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("sorry!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources);
|
||||
nsIRDFEnumerator** sources);
|
||||
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets);
|
||||
nsIRDFEnumerator** targets);
|
||||
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
@@ -87,12 +87,12 @@ public:
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n);
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels);
|
||||
nsIRDFEnumerator** labels);
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aCursor);
|
||||
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
|
||||
@@ -113,9 +113,9 @@ nsMsgRDFDataSource::GetSource(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PR
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFAssertionCursor GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgRDFDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFAssertionCursor **_retval)
|
||||
nsMsgRDFDataSource::GetSources(nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, nsIRDFEnumerator **_retval)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
@@ -129,9 +129,9 @@ nsMsgRDFDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgRDFDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFAssertionCursor **_retval)
|
||||
nsMsgRDFDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, PRBool aTruthValue, nsIRDFEnumerator **_retval)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
@@ -185,25 +185,25 @@ nsMsgRDFDataSource::RemoveObserver(nsIRDFObserver *aObserver)
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFArcsInCursor ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
/* nsIRDFEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgRDFDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsIRDFArcsInCursor **_retval)
|
||||
nsMsgRDFDataSource::ArcLabelsIn(nsIRDFNode *aNode, nsIRDFEnumerator **_retval)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgRDFDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsIRDFArcsOutCursor **_retval)
|
||||
nsMsgRDFDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsIRDFEnumerator **_retval)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
|
||||
/* nsIRDFResourceCursor GetAllResources (); */
|
||||
/* nsIRDFEnumerator GetAllResources (); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgRDFDataSource::GetAllResources(nsIRDFResourceCursor **_retval)
|
||||
nsMsgRDFDataSource::GetAllResources(nsIRDFEnumerator **_retval)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ class nsMsgRDFDataSource : public nsIRDFDataSource,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFResource **_retval);
|
||||
|
||||
/* nsIRDFAssertionCursor GetSources (in nsIRDFResource aProperty,
|
||||
/* nsIRDFEnumerator GetSources (in nsIRDFResource aProperty,
|
||||
in nsIRDFNode aTarget,
|
||||
in boolean aTruthValue); */
|
||||
NS_IMETHOD GetSources(nsIRDFResource *aProperty,
|
||||
nsIRDFNode *aTarget,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFNode GetTarget (in nsIRDFResource aSource,
|
||||
in nsIRDFResource aProperty,
|
||||
@@ -65,13 +65,13 @@ class nsMsgRDFDataSource : public nsIRDFDataSource,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFNode **_retval);
|
||||
|
||||
/* nsIRDFAssertionCursor GetTargets (in nsIRDFResource aSource,
|
||||
/* nsIRDFEnumerator GetTargets (in nsIRDFResource aSource,
|
||||
in nsIRDFResource aProperty,
|
||||
in boolean aTruthValue); */
|
||||
NS_IMETHOD GetTargets(nsIRDFResource *aSource,
|
||||
nsIRDFResource *aProperty,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* void Assert (in nsIRDFResource aSource,
|
||||
in nsIRDFResource aProperty,
|
||||
@@ -105,16 +105,16 @@ class nsMsgRDFDataSource : public nsIRDFDataSource,
|
||||
/* void RemoveObserver (in nsIRDFObserver aObserver); */
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver *aObserver);
|
||||
|
||||
/* nsIRDFArcsInCursor ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
/* nsIRDFEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode *aNode,
|
||||
nsIRDFArcsInCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFArcsOutCursor ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
/* nsIRDFEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *aSource,
|
||||
nsIRDFArcsOutCursor **_retval);
|
||||
nsIRDFEnumerator **_retval);
|
||||
|
||||
/* nsIRDFResourceCursor GetAllResources (); */
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor **_retval);
|
||||
/* nsIRDFEnumerator GetAllResources (); */
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator **_retval);
|
||||
|
||||
/* void Flush (); */
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@@ -401,37 +400,41 @@ nsBrowsingProfile::CountPageVisit(const char* initialURL)
|
||||
nsIRDFResource* urlRes;
|
||||
rv = gRDFService->GetResource(url, &urlRes);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIRDFAssertionCursor* cursor;
|
||||
rv = gCategoryDB->GetSources(kOPENDIR_narrow, urlRes, PR_TRUE, &cursor);
|
||||
nsIRDFEnumerator* sources;
|
||||
rv = gCategoryDB->GetSources(kOPENDIR_narrow, urlRes, PR_TRUE, &sources);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
while (1) {
|
||||
rv = cursor->Advance();
|
||||
PRBool hasMore;
|
||||
rv = sources->HasMoreElements(&hasMore);
|
||||
if (NS_FAILED(rv)) {
|
||||
done = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rv == NS_RDF_CURSOR_EMPTY)
|
||||
if (! hasMore)
|
||||
break;
|
||||
|
||||
nsIRDFResource* category;
|
||||
rv = cursor->GetSource(&category);
|
||||
nsISupports* isupports;
|
||||
rv = sources->GetNext(&isupports);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// found this page in a category -- count it
|
||||
PRUint16 id;
|
||||
rv = GetCategoryID(category, &id);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsXPIDLCString catURI;
|
||||
rv = category->GetValue( getter_Copies(catURI) );
|
||||
nsCOMPtr<nsIRDFResource> category = do_QueryInterface(isupports);
|
||||
if (category) {
|
||||
// found this page in a category -- count it
|
||||
PRUint16 id;
|
||||
rv = GetCategoryID(category, &id);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = RecordHit(catURI, id);
|
||||
nsXPIDLCString catURI;
|
||||
rv = category->GetValue( getter_Copies(catURI) );
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = RecordHit(catURI, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_RELEASE(category);
|
||||
NS_RELEASE(isupports);
|
||||
done = PR_TRUE;
|
||||
}
|
||||
}
|
||||
NS_RELEASE(cursor);
|
||||
NS_RELEASE(sources);
|
||||
}
|
||||
NS_RELEASE(urlRes);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
@@ -75,7 +74,7 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources /* out */) ;
|
||||
nsIRDFEnumerator** sources /* out */) ;
|
||||
NS_IMETHOD GetTarget(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
@@ -83,7 +82,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets /* out */) ;
|
||||
nsIRDFEnumerator** targets /* out */) ;
|
||||
NS_IMETHOD Assert(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
@@ -99,10 +98,10 @@ public:
|
||||
NS_IMETHOD AddObserver(nsIRDFObserver* n) ;
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver* n) ;
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels /* out */) ;
|
||||
nsIRDFEnumerator** labels /* out */) ;
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels /* out */) ;
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) ;
|
||||
nsIRDFEnumerator** labels /* out */) ;
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) ;
|
||||
NS_IMETHOD Flush(void) ;
|
||||
NS_IMETHOD GetAllCommands(nsIRDFResource* source,
|
||||
nsIEnumerator/*<nsIRDFResource>*/** commands) ;
|
||||
@@ -493,7 +492,7 @@ NS_IMETHODIMP
|
||||
nsChromeRegistry::GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources /* out */)
|
||||
nsIRDFEnumerator** sources /* out */)
|
||||
{
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
@@ -512,7 +511,7 @@ NS_IMETHODIMP
|
||||
nsChromeRegistry::GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets /* out */)
|
||||
nsIRDFEnumerator** targets /* out */)
|
||||
{
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
@@ -555,18 +554,18 @@ NS_IMETHODIMP nsChromeRegistry::RemoveObserver(nsIRDFObserver* n)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels /* out */)
|
||||
nsIRDFEnumerator** labels /* out */)
|
||||
{
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels /* out */)
|
||||
nsIRDFEnumerator** labels /* out */)
|
||||
{
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeRegistry::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
NS_IMETHODIMP nsChromeRegistry::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
return mInner->GetAllResources(aCursor);
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources) {
|
||||
nsIRDFEnumerator** sources) {
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets) {
|
||||
nsIRDFEnumerator** targets) {
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
|
||||
@@ -774,17 +774,17 @@ public:
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) {
|
||||
return mInner->GetAllResources(aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) {
|
||||
return mInner->GetAllResources(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ctype.h> // for toupper()
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsIRDFObserver.h"
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "rdf.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIRDFFileSystem.h"
|
||||
#include "nsFileSystemDataSource.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
|
||||
|
||||
#ifdef XP_WIN
|
||||
@@ -56,28 +56,99 @@
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
||||
static NS_DEFINE_IID(kIRDFDataSourceIID, NS_IRDFDATASOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFFileSystemDataSourceIID, NS_IRDFFILESYSTEMDATAOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFAssertionCursorIID, NS_IRDFASSERTIONCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFArcsOutCursorIID, NS_IRDFARCSOUTCURSOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
|
||||
|
||||
|
||||
|
||||
static const char kURINC_FileSystemRoot[] = "NC:FilesRoot";
|
||||
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, child);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, URL);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, FileSystemObject);
|
||||
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, pulse);
|
||||
DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, instanceOf);
|
||||
DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, type);
|
||||
DEFINE_RDF_VOCAB(RDF_NAMESPACE_URI, RDF, Seq);
|
||||
class FileSystemDataSource : public nsIRDFFileSystemDataSource
|
||||
{
|
||||
private:
|
||||
char *mURI;
|
||||
nsVoidArray *mObservers;
|
||||
|
||||
static PRInt32 gRefCnt;
|
||||
|
||||
// pseudo-constants
|
||||
static nsIRDFResource *kNC_FileSystemRoot;
|
||||
static nsIRDFResource *kNC_Child;
|
||||
static nsIRDFResource *kNC_Name;
|
||||
static nsIRDFResource *kNC_URL;
|
||||
static nsIRDFResource *kNC_FileSystemObject;
|
||||
static nsIRDFResource *kNC_pulse;
|
||||
static nsIRDFResource *kRDF_InstanceOf;
|
||||
static nsIRDFResource *kRDF_type;
|
||||
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
FileSystemDataSource(void);
|
||||
virtual ~FileSystemDataSource(void);
|
||||
|
||||
// nsIRDFDataSource methods
|
||||
|
||||
NS_IMETHOD Init(const char *uri);
|
||||
NS_IMETHOD GetURI(char **uri);
|
||||
NS_IMETHOD GetSource(nsIRDFResource *property,
|
||||
nsIRDFNode *target,
|
||||
PRBool tv,
|
||||
nsIRDFResource **source /* out */);
|
||||
NS_IMETHOD GetSources(nsIRDFResource *property,
|
||||
nsIRDFNode *target,
|
||||
PRBool tv,
|
||||
nsIRDFEnumerator **sources /* out */);
|
||||
NS_IMETHOD GetTarget(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool tv,
|
||||
nsIRDFNode **target /* out */);
|
||||
NS_IMETHOD GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool tv,
|
||||
nsIRDFEnumerator **targets /* out */);
|
||||
NS_IMETHOD Assert(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
nsIRDFNode *target,
|
||||
PRBool tv);
|
||||
NS_IMETHOD Unassert(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
nsIRDFNode *target);
|
||||
NS_IMETHOD HasAssertion(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
nsIRDFNode *target,
|
||||
PRBool tv,
|
||||
PRBool *hasAssertion /* out */);
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode *node,
|
||||
nsIRDFEnumerator **labels /* out */);
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource *source,
|
||||
nsIRDFEnumerator **labels /* out */);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult);
|
||||
NS_IMETHOD AddObserver(nsIRDFObserver *n);
|
||||
NS_IMETHOD RemoveObserver(nsIRDFObserver *n);
|
||||
NS_IMETHOD Flush();
|
||||
NS_IMETHOD GetAllCommands(nsIRDFResource* source,
|
||||
nsIEnumerator/*<nsIRDFResource>*/** commands);
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments,
|
||||
PRBool* aResult);
|
||||
|
||||
NS_IMETHOD DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments);
|
||||
|
||||
|
||||
// helper methods
|
||||
static PRBool isFileURI(nsIRDFResource* aResource);
|
||||
|
||||
static nsresult GetVolumeList(nsIRDFEnumerator **aResult);
|
||||
static nsresult GetFolderList(nsIRDFResource *source, nsIRDFEnumerator **aResult);
|
||||
static nsresult GetName(nsIRDFResource *source, nsIRDFLiteral** aResult);
|
||||
static nsresult GetURL(nsIRDFResource *source, nsIRDFLiteral** aResult);
|
||||
static PRBool isVisible(const nsNativeFileSpec& file);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
static nsIRDFService *gRDFService = nsnull;
|
||||
@@ -96,24 +167,9 @@ nsIRDFResource *FileSystemDataSource::kRDF_type;
|
||||
|
||||
|
||||
|
||||
static PRBool
|
||||
peq(nsIRDFResource* r1, nsIRDFResource* r2)
|
||||
{
|
||||
PRBool retVal=PR_FALSE, result;
|
||||
|
||||
if (NS_SUCCEEDED(r1->EqualsResource(r2, &result)))
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
retVal = PR_TRUE;
|
||||
}
|
||||
}
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
|
||||
static PRBool
|
||||
isFileURI(nsIRDFResource *r)
|
||||
PRBool
|
||||
FileSystemDataSource::isFileURI(nsIRDFResource *r)
|
||||
{
|
||||
PRBool isFileURI = PR_FALSE;
|
||||
nsXPIDLCString uri;
|
||||
@@ -140,20 +196,20 @@ FileSystemDataSource::FileSystemDataSource(void)
|
||||
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
kIRDFServiceIID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
gRDFService->GetResource(kURINC_FileSystemRoot, &kNC_FileSystemRoot);
|
||||
gRDFService->GetResource(kURINC_child, &kNC_Child);
|
||||
gRDFService->GetResource(kURINC_Name, &kNC_Name);
|
||||
gRDFService->GetResource(kURINC_URL, &kNC_URL);
|
||||
gRDFService->GetResource(kURINC_FileSystemObject, &kNC_FileSystemObject);
|
||||
gRDFService->GetResource(kURINC_pulse, &kNC_pulse);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "FileSystemRoot", &kNC_FileSystemRoot);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Child", &kNC_Child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "FileSystemObject", &kNC_FileSystemObject);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "pulse", &kNC_pulse);
|
||||
|
||||
gRDFService->GetResource(kURIRDF_instanceOf, &kRDF_InstanceOf);
|
||||
gRDFService->GetResource(kURIRDF_type, &kRDF_type);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_InstanceOf);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
|
||||
gFileSystemDataSource = this;
|
||||
}
|
||||
@@ -193,12 +249,7 @@ FileSystemDataSource::~FileSystemDataSource (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// NS_IMPL_ISUPPORTS(FileSystemDataSource, kIRDFFileSystemDataSourceIID);
|
||||
NS_IMPL_ISUPPORTS(FileSystemDataSource, kIRDFDataSourceIID);
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(FileSystemDataSource, nsIRDFDataSource::GetIID());
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::Init(const char *uri)
|
||||
@@ -242,7 +293,7 @@ NS_IMETHODIMP
|
||||
FileSystemDataSource::GetSources(nsIRDFResource *property,
|
||||
nsIRDFNode *target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor **sources /* out */)
|
||||
nsIRDFEnumerator **sources /* out */)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -250,177 +301,185 @@ FileSystemDataSource::GetSources(nsIRDFResource *property,
|
||||
|
||||
|
||||
|
||||
nsresult GetVolumeList(nsVoidArray **array);
|
||||
nsresult GetFolderList(nsIRDFResource *source, nsVoidArray **array /* out */);
|
||||
nsresult GetName(nsIRDFResource *source, nsVoidArray **array);
|
||||
nsresult GetURL(nsIRDFResource *source, nsVoidArray **array);
|
||||
PRBool isVisible(nsNativeFileSpec file);
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::GetTarget(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool tv,
|
||||
nsIRDFNode **target /* out */)
|
||||
nsIRDFResource *property,
|
||||
PRBool tv,
|
||||
nsIRDFNode **target /* out */)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
nsVoidArray *array = nsnull;
|
||||
|
||||
// we only have positive assertions in the file system data source.
|
||||
if (! tv)
|
||||
return rv;
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
||||
if (peq(source, kNC_FileSystemRoot))
|
||||
if (source == kNC_FileSystemRoot)
|
||||
{
|
||||
if (peq(property, kNC_pulse))
|
||||
if (property == kNC_pulse)
|
||||
{
|
||||
nsAutoString pulse("12");
|
||||
nsIRDFLiteral *pulseLiteral;
|
||||
gRDFService->GetLiteral(pulse.GetUnicode(), &pulseLiteral);
|
||||
array = new nsVoidArray();
|
||||
if (array)
|
||||
{
|
||||
array->AppendElement(pulseLiteral);
|
||||
rv = NS_OK;
|
||||
}
|
||||
*target = pulseLiteral;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else if (isFileURI(source))
|
||||
{
|
||||
if (peq(property, kNC_Name))
|
||||
if (property == kNC_Name)
|
||||
{
|
||||
rv = GetName(source, &array);
|
||||
nsCOMPtr<nsIRDFLiteral> name;
|
||||
rv = GetName(source, getter_AddRefs(name));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return name->QueryInterface(nsIRDFNode::GetIID(), (void**) target);
|
||||
}
|
||||
else if (peq(property, kNC_URL))
|
||||
else if (property == kNC_URL)
|
||||
{
|
||||
rv = GetURL(source, &array);
|
||||
nsCOMPtr<nsIRDFLiteral> url;
|
||||
rv = GetURL(source, getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return url->QueryInterface(nsIRDFNode::GetIID(), (void**) target);
|
||||
}
|
||||
else if (peq(property, kRDF_type))
|
||||
else if (property == kRDF_type)
|
||||
{
|
||||
nsXPIDLCString uri;
|
||||
kNC_FileSystemObject->GetValue( getter_Copies(uri) );
|
||||
if (uri)
|
||||
{
|
||||
nsAutoString url(uri);
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
||||
*target = literal;
|
||||
rv = NS_OK;
|
||||
}
|
||||
return(rv);
|
||||
rv = kNC_FileSystemObject->GetValue( getter_Copies(uri) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString url(uri);
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
||||
rv = literal->QueryInterface(nsIRDFNode::GetIID(), (void**) target);
|
||||
NS_RELEASE(literal);
|
||||
return rv;
|
||||
}
|
||||
else if (peq(property, kNC_pulse))
|
||||
else if (property == kNC_pulse)
|
||||
{
|
||||
nsAutoString pulse("12");
|
||||
nsIRDFLiteral *pulseLiteral;
|
||||
gRDFService->GetLiteral(pulse.GetUnicode(), &pulseLiteral);
|
||||
array = new nsVoidArray();
|
||||
if (array)
|
||||
{
|
||||
array->AppendElement(pulseLiteral);
|
||||
rv = NS_OK;
|
||||
}
|
||||
rv = pulseLiteral->QueryInterface(nsIRDFNode::GetIID(), (void**) target);
|
||||
NS_RELEASE(pulseLiteral);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
if (array != nsnull)
|
||||
{
|
||||
nsIRDFLiteral *literal = (nsIRDFLiteral *)(array->ElementAt(0));
|
||||
*target = (nsIRDFNode *)literal;
|
||||
delete array;
|
||||
rv = NS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = NS_RDF_NO_VALUE;
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::GetTargets(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor **targets /* out */)
|
||||
nsIRDFEnumerator **targets /* out */)
|
||||
{
|
||||
nsVoidArray *array = nsnull;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// we only have positive assertions in the file system data source.
|
||||
if (! tv)
|
||||
return rv;
|
||||
return NS_RDF_NO_VALUE;
|
||||
|
||||
if (peq(source, kNC_FileSystemRoot))
|
||||
nsresult rv;
|
||||
|
||||
if (source == kNC_FileSystemRoot)
|
||||
{
|
||||
if (peq(property, kNC_Child))
|
||||
if (property == kNC_Child)
|
||||
{
|
||||
rv = GetVolumeList(&array);
|
||||
return GetVolumeList(targets);
|
||||
}
|
||||
else if (peq(property, kNC_pulse))
|
||||
else if (property == kNC_pulse)
|
||||
{
|
||||
nsAutoString pulse("12");
|
||||
nsIRDFLiteral *pulseLiteral;
|
||||
gRDFService->GetLiteral(pulse.GetUnicode(), &pulseLiteral);
|
||||
array = new nsVoidArray();
|
||||
if (array)
|
||||
{
|
||||
array->AppendElement(pulseLiteral);
|
||||
rv = NS_OK;
|
||||
}
|
||||
nsIRDFEnumerator* result = new nsSingletonEnumerator(pulseLiteral);
|
||||
NS_RELEASE(pulseLiteral);
|
||||
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else if (isFileURI(source))
|
||||
{
|
||||
if (peq(property, kNC_Child))
|
||||
if (property == kNC_Child)
|
||||
{
|
||||
rv = GetFolderList(source, &array);
|
||||
return GetFolderList(source, targets);
|
||||
}
|
||||
else if (peq(property, kNC_Name))
|
||||
else if (property == kNC_Name)
|
||||
{
|
||||
rv = GetName(source, &array);
|
||||
nsCOMPtr<nsIRDFLiteral> name;
|
||||
rv = GetName(source, getter_AddRefs(name));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFEnumerator* result = new nsSingletonEnumerator(name);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (peq(property, kNC_URL))
|
||||
else if (property == kNC_URL)
|
||||
{
|
||||
rv = GetURL(source, &array);
|
||||
nsCOMPtr<nsIRDFLiteral> url;
|
||||
rv = GetURL(source, getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFEnumerator* result = new nsSingletonEnumerator(url);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (peq(property, kRDF_type))
|
||||
else if (property == kRDF_type)
|
||||
{
|
||||
nsXPIDLCString uri;
|
||||
kNC_FileSystemObject->GetValue( getter_Copies(uri) );
|
||||
if (uri)
|
||||
{
|
||||
nsAutoString url(uri);
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
||||
array = new nsVoidArray();
|
||||
if (array)
|
||||
{
|
||||
array->AppendElement(literal);
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
rv = kNC_FileSystemObject->GetValue( getter_Copies(uri) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString url(uri);
|
||||
nsIRDFLiteral *literal;
|
||||
|
||||
rv = gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFEnumerator* result = new nsSingletonEnumerator(literal);
|
||||
NS_RELEASE(literal);
|
||||
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (peq(property, kNC_pulse))
|
||||
else if (property == kNC_pulse)
|
||||
{
|
||||
nsAutoString pulse("12");
|
||||
nsIRDFLiteral *pulseLiteral;
|
||||
gRDFService->GetLiteral(pulse.GetUnicode(), &pulseLiteral);
|
||||
array = new nsVoidArray();
|
||||
if (array)
|
||||
{
|
||||
array->AppendElement(pulseLiteral);
|
||||
rv = NS_OK;
|
||||
}
|
||||
rv = gRDFService->GetLiteral(pulse.GetUnicode(), &pulseLiteral);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFEnumerator* result = new nsSingletonEnumerator(pulseLiteral);
|
||||
NS_RELEASE(pulseLiteral);
|
||||
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*targets = result;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if ((rv == NS_OK) && (nsnull != array))
|
||||
{
|
||||
*targets = new FileSystemCursor(source, property, PR_FALSE, array);
|
||||
NS_ADDREF(*targets);
|
||||
}
|
||||
return(rv);
|
||||
|
||||
return NS_NewEmptyEnumerator(targets);
|
||||
}
|
||||
|
||||
|
||||
@@ -455,33 +514,33 @@ FileSystemDataSource::HasAssertion(nsIRDFResource *source,
|
||||
PRBool tv,
|
||||
PRBool *hasAssertion /* out */)
|
||||
{
|
||||
PRBool retVal = PR_FALSE;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// we only have positive assertions in the file system data source.
|
||||
if (! tv)
|
||||
return rv;
|
||||
if (! tv) {
|
||||
*hasAssertion = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*hasAssertion = PR_FALSE;
|
||||
if (peq(source, kNC_FileSystemRoot) || isFileURI(source))
|
||||
if ((source == kNC_FileSystemRoot) || isFileURI(source))
|
||||
{
|
||||
if (peq(property, kRDF_type))
|
||||
if (property == kRDF_type)
|
||||
{
|
||||
if (peq((nsIRDFResource *)target, kRDF_type))
|
||||
{
|
||||
*hasAssertion = PR_TRUE;
|
||||
rv = NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIRDFResource> resource( do_QueryInterface(target) );
|
||||
if (resource.get() == kRDF_type) {
|
||||
*hasAssertion = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (rv);
|
||||
|
||||
*hasAssertion = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::ArcLabelsIn(nsIRDFNode *node,
|
||||
nsIRDFArcsInCursor ** labels /* out */)
|
||||
nsIRDFEnumerator ** labels /* out */)
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -491,62 +550,62 @@ FileSystemDataSource::ArcLabelsIn(nsIRDFNode *node,
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::ArcLabelsOut(nsIRDFResource *source,
|
||||
nsIRDFArcsOutCursor **labels /* out */)
|
||||
nsIRDFEnumerator **labels /* out */)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
nsresult rv;
|
||||
|
||||
*labels = nsnull;
|
||||
|
||||
if (peq(source, kNC_FileSystemRoot))
|
||||
if (source == kNC_FileSystemRoot)
|
||||
{
|
||||
nsVoidArray *temp = new nsVoidArray();
|
||||
if (nsnull == temp)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(array));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
temp->AppendElement(kNC_Child);
|
||||
temp->AppendElement(kNC_pulse);
|
||||
*labels = new FileSystemCursor(source, kNC_Child, PR_TRUE, temp);
|
||||
if (nsnull != *labels)
|
||||
{
|
||||
NS_ADDREF(*labels);
|
||||
rv = NS_OK;
|
||||
}
|
||||
array->AppendElement(kNC_Child);
|
||||
array->AppendElement(kNC_pulse);
|
||||
|
||||
nsIRDFEnumerator* result = new nsArrayEnumerator(array);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*labels = result;
|
||||
return NS_OK;
|
||||
}
|
||||
else if (isFileURI(source))
|
||||
{
|
||||
nsVoidArray *temp = new nsVoidArray();
|
||||
if (nsnull == temp)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(array));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString uri;
|
||||
source->GetValue( getter_Copies(uri) );
|
||||
if (uri)
|
||||
{
|
||||
nsFileURL fileURL(uri);
|
||||
nsFileSpec fileSpec(fileURL);
|
||||
if (fileSpec.IsDirectory())
|
||||
{
|
||||
temp->AppendElement(kNC_Child);
|
||||
temp->AppendElement(kNC_pulse);
|
||||
}
|
||||
}
|
||||
nsXPIDLCString uri;
|
||||
rv = source->GetValue( getter_Copies(uri) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
temp->AppendElement(kRDF_type);
|
||||
*labels = new FileSystemCursor(source, kRDF_type, PR_TRUE, temp);
|
||||
if (nsnull != *labels)
|
||||
{
|
||||
NS_ADDREF(*labels);
|
||||
rv = NS_OK;
|
||||
}
|
||||
nsFileURL fileURL(uri);
|
||||
nsFileSpec fileSpec(fileURL);
|
||||
if (fileSpec.IsDirectory()) {
|
||||
array->AppendElement(kNC_Child);
|
||||
array->AppendElement(kNC_pulse);
|
||||
}
|
||||
|
||||
array->AppendElement(kRDF_type);
|
||||
|
||||
nsIRDFEnumerator* result = new nsArrayEnumerator(array);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*labels = result;
|
||||
return NS_OK;
|
||||
}
|
||||
return(rv);
|
||||
|
||||
return NS_NewEmptyEnumerator(labels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemDataSource::GetAllResources(nsIRDFResourceCursor** aCursor)
|
||||
FileSystemDataSource::GetAllResources(nsIRDFEnumerator** aCursor)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("sorry!");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -637,17 +696,15 @@ NS_NewRDFFileSystemDataSource(nsIRDFDataSource **result)
|
||||
|
||||
|
||||
nsresult
|
||||
GetVolumeList(nsVoidArray **array)
|
||||
FileSystemDataSource::GetVolumeList(nsIRDFEnumerator** aResult)
|
||||
{
|
||||
nsVoidArray *volumes = new nsVoidArray();
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupportsArray> volumes;
|
||||
|
||||
*array = volumes;
|
||||
if (nsnull == *array)
|
||||
{
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(volumes));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFResource *vol;
|
||||
nsCOMPtr<nsIRDFResource> vol;
|
||||
|
||||
#ifdef XP_MAC
|
||||
StrFileName fname;
|
||||
@@ -660,11 +717,10 @@ GetVolumeList(nsVoidArray **array)
|
||||
if (PBHGetVInfo(&pb,FALSE) != noErr)
|
||||
break;
|
||||
nsFileSpec fss(pb.volumeParam.ioVRefNum, fsRtParID, fname);
|
||||
if (NS_SUCCEEDED(gRDFService->GetResource(nsFileURL(fss).GetAsString(), (nsIRDFResource**)&vol)))
|
||||
{
|
||||
NS_ADDREF(vol);
|
||||
volumes->AppendElement(vol);
|
||||
}
|
||||
rv = gRDFService->GetResource(nsFileURL(fss).GetAsString(), getter_AddRefs(vol));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
volumes->AppendElement(vol);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -682,175 +738,34 @@ GetVolumeList(nsVoidArray **array)
|
||||
{
|
||||
if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))
|
||||
{
|
||||
gRDFService->GetResource(url, (nsIRDFResource **)&vol);
|
||||
NS_ADDREF(vol);
|
||||
volumes->AppendElement(vol);
|
||||
PR_Free(url);
|
||||
rv = gRDFService->GetResource(url, getter_AddRefs(vol));
|
||||
PR_Free(url);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
volumes->AppendElement(vol);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
gRDFService->GetResource("file:///", (nsIRDFResource **)&vol);
|
||||
NS_ADDREF(vol);
|
||||
gRDFService->GetResource("file:///", getter_AddRefs(vol));
|
||||
volumes->AppendElement(vol);
|
||||
#endif
|
||||
|
||||
nsIRDFEnumerator* result = new nsArrayEnumerator(volumes);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*aResult = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FileSystemCursor::FileSystemCursor(nsIRDFResource *source,
|
||||
nsIRDFResource *property,
|
||||
PRBool isArcsOut,
|
||||
nsVoidArray *array)
|
||||
: mSource(source),
|
||||
mProperty(property),
|
||||
mArcsOut(isArcsOut),
|
||||
mArray(array),
|
||||
mCount(0),
|
||||
mTarget(nsnull),
|
||||
mValue(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_ADDREF(mSource);
|
||||
NS_ADDREF(mProperty);
|
||||
}
|
||||
|
||||
|
||||
|
||||
FileSystemCursor::~FileSystemCursor(void)
|
||||
{
|
||||
NS_IF_RELEASE(mSource);
|
||||
NS_IF_RELEASE(mValue);
|
||||
NS_IF_RELEASE(mProperty);
|
||||
NS_IF_RELEASE(mTarget);
|
||||
if (nsnull != mArray)
|
||||
{
|
||||
delete mArray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::Advance(void)
|
||||
{
|
||||
if (!mArray)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (mArray->Count() <= mCount)
|
||||
return NS_RDF_CURSOR_EMPTY;
|
||||
NS_IF_RELEASE(mValue);
|
||||
mTarget = mValue = (nsIRDFNode *)mArray->ElementAt(mCount++);
|
||||
NS_ADDREF(mValue);
|
||||
NS_ADDREF(mTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetValue(nsIRDFNode **aValue)
|
||||
{
|
||||
if (nsnull == mValue)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ADDREF(mValue);
|
||||
*aValue = mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetDataSource(nsIRDFDataSource **aDataSource)
|
||||
{
|
||||
NS_ADDREF(gFileSystemDataSource);
|
||||
*aDataSource = gFileSystemDataSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetSource(nsIRDFResource **aResource)
|
||||
{
|
||||
NS_ADDREF(mSource);
|
||||
*aResource = mSource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetLabel(nsIRDFResource **aPredicate)
|
||||
{
|
||||
if (mArcsOut == PR_FALSE)
|
||||
{
|
||||
NS_ADDREF(mProperty);
|
||||
*aPredicate = mProperty;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nsnull == mValue)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ADDREF(mValue);
|
||||
*(nsIRDFNode **)aPredicate = mValue;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetTarget(nsIRDFNode **aObject)
|
||||
{
|
||||
if (nsnull != mTarget)
|
||||
NS_ADDREF(mTarget);
|
||||
*aObject = mTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::GetTruthValue(PRBool *aTruthValue)
|
||||
{
|
||||
*aTruthValue = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(FileSystemCursor);
|
||||
NS_IMPL_RELEASE(FileSystemCursor);
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
FileSystemCursor::QueryInterface(REFNSIID iid, void **result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(kIRDFAssertionCursorIID) ||
|
||||
iid.Equals(kIRDFCursorIID) ||
|
||||
iid.Equals(kIRDFArcsOutCursorIID) ||
|
||||
iid.Equals(kISupportsIID))
|
||||
{
|
||||
*result = NS_STATIC_CAST(nsIRDFAssertionCursor *, this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return(NS_NOINTERFACE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool
|
||||
isVisible(nsNativeFileSpec file)
|
||||
FileSystemDataSource::isVisible(const nsNativeFileSpec& file)
|
||||
{
|
||||
PRBool isVisible = PR_TRUE;
|
||||
|
||||
@@ -892,21 +807,16 @@ isVisible(nsNativeFileSpec file)
|
||||
|
||||
|
||||
nsresult
|
||||
GetFolderList(nsIRDFResource *source, nsVoidArray **array /* out */)
|
||||
FileSystemDataSource::GetFolderList(nsIRDFResource *source, nsIRDFEnumerator** aResult)
|
||||
{
|
||||
nsVoidArray *nameArray = new nsVoidArray();
|
||||
*array = nameArray;
|
||||
if (nsnull == nameArray)
|
||||
{
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupportsArray> nameArray;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(nameArray));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString uri;
|
||||
source->GetValue( getter_Copies(uri) );
|
||||
if (! uri)
|
||||
{
|
||||
return(NS_ERROR_FAILURE);
|
||||
}
|
||||
rv = source->GetValue( getter_Copies(uri) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsFileURL parentDir(uri);
|
||||
nsNativeFileSpec nativeDir(parentDir);
|
||||
@@ -918,60 +828,58 @@ GetFolderList(nsIRDFResource *source, nsVoidArray **array /* out */)
|
||||
const char *childURL = fileURL.GetAsString();
|
||||
if (childURL != nsnull)
|
||||
{
|
||||
nsIRDFResource *file;
|
||||
gRDFService->GetResource(childURL, (nsIRDFResource **)&file);
|
||||
nsCOMPtr<nsIRDFResource> file;
|
||||
gRDFService->GetResource(childURL, getter_AddRefs(file));
|
||||
nameArray->AppendElement(file);
|
||||
}
|
||||
}
|
||||
return(NS_OK);
|
||||
|
||||
nsIRDFEnumerator* result = new nsArrayEnumerator(nameArray);
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(result);
|
||||
*aResult = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
GetName(nsIRDFResource *source, nsVoidArray **array)
|
||||
FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult)
|
||||
{
|
||||
nsVoidArray *nameArray = new nsVoidArray();
|
||||
*array = nameArray;
|
||||
if (nsnull == nameArray)
|
||||
{
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsXPIDLCString uri;
|
||||
source->GetValue( getter_Copies(uri) );
|
||||
nsFileURL url(uri);
|
||||
nsNativeFileSpec native(url);
|
||||
char *basename = native.GetLeafName();
|
||||
if (basename)
|
||||
{
|
||||
nsAutoString name(basename);
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(name.GetUnicode(), &literal);
|
||||
nameArray->AppendElement(literal);
|
||||
delete []basename;
|
||||
}
|
||||
return(NS_OK);
|
||||
|
||||
if (! basename)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsAutoString name(basename);
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(name.GetUnicode(), &literal);
|
||||
*aResult = literal;
|
||||
delete []basename;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
GetURL(nsIRDFResource *source, nsVoidArray **array)
|
||||
FileSystemDataSource::GetURL(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
||||
{
|
||||
nsVoidArray *urlArray = new nsVoidArray();
|
||||
*array = urlArray;
|
||||
if (nsnull == urlArray)
|
||||
{
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
nsXPIDLCString uri;
|
||||
source->GetValue( getter_Copies(uri) );
|
||||
nsAutoString url(uri);
|
||||
|
||||
nsIRDFLiteral *literal;
|
||||
gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
||||
urlArray->AppendElement(literal);
|
||||
return(NS_OK);
|
||||
*aResult = literal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <ctype.h> // for toupper()
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsIRDFObserver.h"
|
||||
#include "nsIRDFResourceFactory.h"
|
||||
@@ -63,15 +62,6 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Interface IDs
|
||||
|
||||
static NS_DEFINE_IID(kIRDFArcsInCursorIID, NS_IRDFARCSINCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFArcsOutCursorIID, NS_IRDFARCSOUTCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFAssertionCursorIID, NS_IRDFASSERTIONCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
||||
static NS_DEFINE_IID(kIRDFDataSourceIID, NS_IRDFDATASOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
|
||||
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
|
||||
@@ -189,7 +179,7 @@ public:
|
||||
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target, PRBool tv,
|
||||
nsIRDFAssertionCursor** sources) {
|
||||
nsIRDFEnumerator** sources) {
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
|
||||
@@ -225,7 +215,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets) {
|
||||
nsIRDFEnumerator** targets) {
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
|
||||
@@ -260,12 +250,12 @@ public:
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
@@ -293,8 +283,8 @@ public:
|
||||
return mInner->DoCommand(aSources, aCommand, aArguments);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) {
|
||||
return mInner->GetAllResources(aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) {
|
||||
return mInner->GetAllResources(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHOD AddPage (const char* aURI, const char* aRefererURI, PRTime aTime);
|
||||
@@ -355,7 +345,8 @@ nsHistoryDataSource::nsHistoryDataSource(void)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
kIRDFServiceIID, (nsISupports**) &gRDFService);
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**) &gRDFService);
|
||||
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
@@ -440,7 +431,7 @@ nsHistoryDataSource::Init(const char* uri)
|
||||
{
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID,
|
||||
nsnull, kIRDFDataSourceIID, (void**) &mInner)))
|
||||
nsnull, nsIRDFDataSource::GetIID(), (void**) &mInner)))
|
||||
return rv;
|
||||
|
||||
if (NS_FAILED(rv = mInner->Init(uri)))
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* aProperty,
|
||||
nsIRDFNode* aTarget,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor** aSources) {
|
||||
nsIRDFEnumerator** aSources) {
|
||||
return mInner->GetSources(aProperty, aTarget, aTruthValue, aSources);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* aSource,
|
||||
nsIRDFResource* aProperty,
|
||||
PRBool aTruthValue,
|
||||
nsIRDFAssertionCursor** aTargets) {
|
||||
nsIRDFEnumerator** aTargets) {
|
||||
return mInner->GetTargets(aSource, aProperty, aTruthValue, aTargets);
|
||||
}
|
||||
|
||||
@@ -118,17 +118,17 @@ public:
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* aNode,
|
||||
nsIRDFArcsInCursor** aLabels) {
|
||||
nsIRDFEnumerator** aLabels) {
|
||||
return mInner->ArcLabelsIn(aNode, aLabels);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* aSource,
|
||||
nsIRDFArcsOutCursor** aLabels) {
|
||||
nsIRDFEnumerator** aLabels) {
|
||||
return mInner->ArcLabelsOut(aSource, aLabels);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) {
|
||||
return mInner->GetAllResources(aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) {
|
||||
return mInner->GetAllResources(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void) {
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIRDFContentSink.h"
|
||||
#include "nsIRDFCursor.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
@@ -135,7 +134,7 @@ public:
|
||||
NS_IMETHOD GetSources(nsIRDFResource* property,
|
||||
nsIRDFNode* target,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** sources) {
|
||||
nsIRDFEnumerator** sources) {
|
||||
return mInner->GetSources(property, target, tv, sources);
|
||||
}
|
||||
|
||||
@@ -149,7 +148,7 @@ public:
|
||||
NS_IMETHOD GetTargets(nsIRDFResource* source,
|
||||
nsIRDFResource* property,
|
||||
PRBool tv,
|
||||
nsIRDFAssertionCursor** targets) {
|
||||
nsIRDFEnumerator** targets) {
|
||||
return mInner->GetTargets(source, property, tv, targets);
|
||||
}
|
||||
|
||||
@@ -183,17 +182,17 @@ public:
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsIn(nsIRDFNode* node,
|
||||
nsIRDFArcsInCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsIn(node, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD ArcLabelsOut(nsIRDFResource* source,
|
||||
nsIRDFArcsOutCursor** labels) {
|
||||
nsIRDFEnumerator** labels) {
|
||||
return mInner->ArcLabelsOut(source, labels);
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAllResources(nsIRDFResourceCursor** aCursor) {
|
||||
return mInner->GetAllResources(aCursor);
|
||||
NS_IMETHOD GetAllResources(nsIRDFEnumerator** aResult) {
|
||||
return mInner->GetAllResources(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHOD Flush(void);
|
||||
|
||||
Reference in New Issue
Block a user