michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsIRDFContainer.idl" michael@0: #include "nsIRDFResource.idl" michael@0: michael@0: michael@0: // Container utilities michael@0: [scriptable, uuid(D4214E91-FB94-11D2-BDD8-00104BDE6048)] michael@0: interface nsIRDFContainerUtils : nsISupports { michael@0: /** michael@0: * Returns 'true' if the property is an RDF ordinal property. michael@0: */ michael@0: boolean IsOrdinalProperty(in nsIRDFResource aProperty); michael@0: michael@0: /** michael@0: * Convert the specified index to an ordinal property. michael@0: */ michael@0: nsIRDFResource IndexToOrdinalResource(in long aIndex); michael@0: michael@0: /** michael@0: * Convert the specified ordinal property into an index michael@0: */ michael@0: long OrdinalResourceToIndex(in nsIRDFResource aOrdinal); michael@0: michael@0: /** michael@0: * Return 'true' if the specified resource is a container michael@0: */ michael@0: boolean IsContainer(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Return 'true' if the specified resource is a container and it is empty michael@0: */ michael@0: boolean IsEmpty(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Return 'true' if the specified resource is a bag michael@0: */ michael@0: boolean IsBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Return 'true' if the specified resource is a sequence michael@0: */ michael@0: boolean IsSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Return 'true' if the specified resource is an alternation michael@0: */ michael@0: boolean IsAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Decorates the specified resource appropriately to make it michael@0: * usable as an empty bag in the specified data source. michael@0: */ michael@0: nsIRDFContainer MakeBag(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Decorates the specified resource appropriately to make it michael@0: * usable as an empty sequence in the specified data source. michael@0: */ michael@0: nsIRDFContainer MakeSeq(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Decorates the specified resource appropriately to make it michael@0: * usable as an empty alternation in the specified data source. michael@0: */ michael@0: nsIRDFContainer MakeAlt(in nsIRDFDataSource aDataSource, in nsIRDFResource aResource); michael@0: michael@0: /** michael@0: * Retrieve the index of element in the container. Returns -1 if michael@0: * the element is not in the container. michael@0: */ michael@0: long indexOf(in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer, in nsIRDFNode aElement); michael@0: }; michael@0: michael@0: %{C++ michael@0: extern nsresult michael@0: NS_NewRDFContainerUtils(nsIRDFContainerUtils** aResult); michael@0: %}