Added nsIRDFContainer and nsIRDFContainerUtils.

This commit is contained in:
waterson%netscape.com 1999-04-26 18:45:14 +00:00
parent 12fb50fbaa
commit 328cfbabc3

View File

@ -325,3 +325,69 @@ interface nsIRDFService : nsISupports {
// be initialized via <tt>nsIRDFDataSource::Init()</tt>.
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);
};