From 328cfbabc3181f9675a4f1519e6abacc36777d3c Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Mon, 26 Apr 1999 18:45:14 +0000 Subject: [PATCH] Added nsIRDFContainer and nsIRDFContainerUtils. --- rdf/base/idl/nsRDFInterfaces.idl | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/rdf/base/idl/nsRDFInterfaces.idl b/rdf/base/idl/nsRDFInterfaces.idl index 5def9708191d..c1493505ac17 100644 --- a/rdf/base/idl/nsRDFInterfaces.idl +++ b/rdf/base/idl/nsRDFInterfaces.idl @@ -325,3 +325,69 @@ interface nsIRDFService : nsISupports { // be initialized via nsIRDFDataSource::Init(). nsIRDFDataSource GetDataSource(in string aURI); }; + + +// A wrapper for manipulating RDF containers +[scriptable, uuid(D4214E90-FB94-11D2-BDD8-00104BDE6048)] +interface nsIRDFContainer : nsISupports { + + // Initialize the container wrapper to the specified resource + // using the specified datasource for context. + void Init(in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer); + + // Return the number of elements in the container. Note that this + // may not always be accurate due to aggregation. + long GetCount(); + + // Return an enumerator that can be used to enumerate the contents + // of the container in ascending order. + nsISimpleEnumerator GetElements(); + + // Append an element to the container, assigning it the next + // available ordinal. + void AppendElement(in nsIRDFNode aElement); + + // Remove the first occurence of the specified element from the + // container. + void RemoveElement(in nsIRDFNode aElement, in boolean aRenumber); + void InsertElementAt(in nsIRDFNode aElement, in long aIndex, in boolean aRenumber); + long IndexOf(in nsIRDFNode aElement); +}; + + +// Container utilities +[scriptable, uuid(D4214E91-FB94-11D2-BDD8-00104BDE6048)] +interface nsIRDFContainerUtils : nsISupports { + // Returns 'true' if the property is an RDF ordinal property. + boolean IsOrdinalProperty(in nsIRDFResource aProperty); + + // Convert the specified index to an ordinal property. + nsIRDFResource IndexToOrdinalResource(in long aIndex); + + // Convert the specified ordinal property into an index + long OrdinalResourceToIndex(in nsIRDFResource aOrdinal); + + // Return 'true' if the specified resource is a container + boolean IsContainer(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Return 'true' if the specified resource is a bag + boolean IsBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Return 'true' if the specified resource is a sequence + boolean IsSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Return 'true' if the specified resource is an alternation + boolean IsAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Decorates the specified resource appropriately to make it + // usable as an empty bag in the specified data source. + nsIRDFContainer MakeBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Decorates the specified resource appropriately to make it + // usable as an empty sequence in the specified data source. + nsIRDFContainer MakeSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); + + // Decorates the specified resource appropriately to make it + // usable as an empty alternation in the specified data source. + nsIRDFContainer MakeAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); +};