first cleanup of RDF DOMDataSource in preparation for adding document observers

This commit is contained in:
alecf%netscape.com 1999-09-25 06:21:21 +00:00
Родитель 3ca1ef4519
Коммит 7072a94718
2 изменённых файлов: 36 добавлений и 167 удалений

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

@ -58,6 +58,7 @@ static NS_DEFINE_CID(kISupportsIID, NS_ISUPPORTS_IID);
nsRDFDOMDataSource::nsRDFDOMDataSource():
mURI(nsnull),
mRDFService(nsnull),
mMode(nsIDOMDataSource::modeDOM),
mObservers(nsnull)
{
NS_INIT_REFCNT();
@ -80,50 +81,9 @@ nsRDFDOMDataSource::~nsRDFDOMDataSource()
mRDFService);
}
NS_IMPL_ADDREF(nsRDFDOMDataSource)
NS_IMPL_RELEASE(nsRDFDOMDataSource)
NS_IMETHODIMP
nsRDFDOMDataSource::QueryInterface(const nsIID& iid, void **result)
{
nsresult rv = NS_NOINTERFACE;
if (!result) return NS_ERROR_NULL_POINTER;
void *res=nsnull;
if (iid.Equals(nsIRDFDataSource::GetIID()) ||
iid.Equals(kISupportsIID)) {
res = NS_STATIC_CAST(nsIRDFDataSource*, this);
}
else if(iid.Equals(nsIDOMDataSource::GetIID())) {
res = NS_STATIC_CAST(nsIDOMDataSource*, this);
}
if (res) {
NS_ADDREF(this);
*result = res;
rv = NS_OK;
}
return rv;
}
/* void Init (in string uri); */
NS_IMETHODIMP
nsRDFDOMDataSource::Init(const char *uri)
{
nsresult rv=NS_OK;
if (!mURI || PL_strcmp(uri, mURI) != 0)
mURI = PL_strdup(uri);
rv = getRDFService()->RegisterDataSource(this, PR_FALSE);
if (NS_FAILED(rv)) return rv;
return rv;
}
NS_IMPL_ISUPPORTS2(nsRDFDOMDataSource,
nsIRDFDataSource,
nsIDOMDataSource);
/* readonly attribute string URI; */
@ -427,6 +387,20 @@ nsRDFDOMDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **
return NS_OK;
}
NS_IMETHODIMP
nsRDFDOMDataSource::Change(nsIRDFResource *, nsIRDFResource *,
nsIRDFNode *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsRDFDOMDataSource::Move(nsIRDFResource *, nsIRDFResource *,
nsIRDFResource *, nsIRDFNode*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISimpleEnumerator GetAllResources (); */
NS_IMETHODIMP
@ -436,14 +410,6 @@ nsRDFDOMDataSource::GetAllResources(nsISimpleEnumerator **_retval)
}
/* void Flush (); */
NS_IMETHODIMP
nsRDFDOMDataSource::Flush()
{
return NS_RDF_NO_VALUE;
}
/* nsIEnumerator GetAllCommands (in nsIRDFResource aSource); */
NS_IMETHODIMP
nsRDFDOMDataSource::GetAllCommands(nsIRDFResource *aSource, nsIEnumerator **_retval)
@ -539,6 +505,7 @@ nsRDFDOMDataSource::unassertEnumFunc(void *aElement, void *aData)
return PR_TRUE;
}
// nsIDOMDataSource methods
nsresult
nsRDFDOMDataSource::SetWindow(nsIDOMWindow *window) {
nsresult rv;
@ -550,6 +517,19 @@ nsRDFDOMDataSource::SetWindow(nsIDOMWindow *window) {
return rv;
}
nsresult
nsRDFDOMDataSource::SetMode(PRInt32 aMode)
{
mMode = aMode;
return NS_OK;
}
nsresult
nsRDFDOMDataSource::GetMode(PRInt32 *aMode)
{
*aMode = mMode;
return NS_OK;
}
NS_METHOD

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

@ -44,123 +44,10 @@ class nsRDFDOMDataSource : public nsIRDFDataSource,
virtual ~nsRDFDOMDataSource();
NS_DECL_ISUPPORTS
/* void Init (in string uri); */
NS_IMETHOD Init(const char *uri);
/* readonly attribute string URI; */
NS_IMETHOD GetURI(char * *aURI);
NS_DECL_NSIRDFDATASOURCE
/* nsIRDFResource GetSource (in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue); */
NS_IMETHOD GetSource(nsIRDFResource *aProperty,
nsIRDFNode *aTarget,
PRBool aTruthValue,
nsIRDFResource **_retval);
/* nsISimpleEnumerator GetSources (in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue); */
NS_IMETHOD GetSources(nsIRDFResource *aProperty,
nsIRDFNode *aTarget,
PRBool aTruthValue,
nsISimpleEnumerator **_retval);
/* nsIRDFNode GetTarget (in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in boolean aTruthValue); */
NS_IMETHOD GetTarget(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
PRBool aTruthValue,
nsIRDFNode **_retval);
/* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in boolean aTruthValue); */
NS_IMETHOD GetTargets(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
PRBool aTruthValue,
nsISimpleEnumerator **_retval);
/* void Assert (in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue); */
NS_IMETHOD Assert(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
nsIRDFNode *aTarget,
PRBool aTruthValue);
/* void Unassert (in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget); */
NS_IMETHOD Unassert(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
nsIRDFNode *aTarget);
/* boolean HasAssertion (in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue); */
NS_IMETHOD HasAssertion(nsIRDFResource *aSource,
nsIRDFResource *aProperty,
nsIRDFNode *aTarget,
PRBool aTruthValue,
PRBool *_retval);
/* void AddObserver (in nsIRDFObserver aObserver); */
NS_IMETHOD AddObserver(nsIRDFObserver *aObserver);
/* void RemoveObserver (in nsIRDFObserver aObserver); */
NS_IMETHOD RemoveObserver(nsIRDFObserver *aObserver);
/* nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode); */
NS_IMETHOD ArcLabelsIn(nsIRDFNode *aNode,
nsISimpleEnumerator **_retval);
/* nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource); */
NS_IMETHOD ArcLabelsOut(nsIRDFResource *aSource,
nsISimpleEnumerator **_retval);
/* nsISimpleEnumerator GetAllResources (); */
NS_IMETHOD GetAllResources(nsISimpleEnumerator **_retval);
/* void Flush (); */
NS_IMETHOD Flush();
/* nsIEnumerator GetAllCommands (in nsIRDFResource aSource); */
NS_IMETHOD GetAllCommands(nsIRDFResource *aSource,
nsIEnumerator **_retval);
/* nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource); */
NS_IMETHOD GetAllCmds(nsIRDFResource *aSource,
nsISimpleEnumerator **_retval);
/* boolean IsCommandEnabled (in nsISupportsArray aSources,
in nsIRDFResource aCommand,
in nsISupportsArray aArguments); */
NS_IMETHOD IsCommandEnabled(nsISupportsArray *aSources,
nsIRDFResource *aCommand,
nsISupportsArray *aArguments,
PRBool *_retval);
/* void DoCommand (in nsISupportsArray aSources,
in nsIRDFResource aCommand,
in nsISupportsArray aArguments); */
NS_IMETHOD DoCommand(nsISupportsArray *aSources,
nsIRDFResource *aCommand,
nsISupportsArray *aArguments);
NS_IMETHOD SetWindow(nsIDOMWindow *window);
NS_IMETHOD Change(nsIRDFResource*, nsIRDFResource*,
nsIRDFNode*, nsIRDFNode*)
{return NS_ERROR_NOT_IMPLEMENTED;}
NS_IMETHOD Move(nsIRDFResource*, nsIRDFResource*,
nsIRDFResource*, nsIRDFNode*)
{return NS_ERROR_NOT_IMPLEMENTED;}
NS_DECL_NSIDOMDATASOURCE
static NS_METHOD Create(nsISupports* aOuter,
const nsIID& iid,
@ -179,6 +66,7 @@ class nsRDFDOMDataSource : public nsIRDFDataSource,
PRBool init;
nsIRDFService *mRDFService;
PRInt32 mMode;
nsVoidArray *mObservers;
nsCOMPtr<nsIDOMDocument> mDocument;
@ -188,6 +76,7 @@ class nsRDFDOMDataSource : public nsIRDFDataSource,
nsIRDFResource* kNC_Type;
nsIRDFResource* kNC_Child;
nsIRDFResource* kNC_DOMRoot;
};
#endif