1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
39 #include
"nsIRDFDataSource.idl"
40 #include
"nsIRDFResource.idl"
41 #include
"nsIRDFNode.idl"
42 #include
"nsISimpleEnumerator.idl"
44 // A wrapper for manipulating RDF containers
45 [scriptable
, uuid(D4214E90
-FB94
-11D2
-BDD8
-00104BDE6048
)]
46 interface nsIRDFContainer
: nsISupports
{
47 readonly attribute nsIRDFDataSource DataSource
;
48 readonly attribute nsIRDFResource Resource
;
51 * Initialize the container wrapper to the specified resource
52 * using the specified datasource for context.
54 void Init
(in nsIRDFDataSource aDataSource
, in nsIRDFResource aContainer
);
57 * Return the number of elements in the container. Note that this
58 * may not always be accurate due to aggregation.
63 * Return an enumerator that can be used to enumerate the contents
64 * of the container in ascending order.
66 nsISimpleEnumerator GetElements
();
69 * Append an element to the container, assigning it the next
72 void AppendElement
(in nsIRDFNode aElement
);
75 * Remove the first occurence of the specified element from the
76 * container. If aRenumber is 'true', then the underlying RDF graph
77 * will be 're-numbered' to account for the removal.
79 void RemoveElement
(in nsIRDFNode aElement
, in boolean aRenumber
);
82 * Insert aElement at the specified index. If aRenumber is 'true', then
83 * the underlying RDF graph will be 're-numbered' to accomodate the new
86 void InsertElementAt
(in nsIRDFNode aElement
, in long aIndex
, in boolean aRenumber
);
89 * Remove the element at the specified index. If aRenumber is 'true', then
90 * the underlying RDF graph will be 're-numbered' to account for the
93 * @return the element that was removed.
95 nsIRDFNode RemoveElementAt
(in long aIndex
, in boolean aRenumber
);
98 * Determine the index of an element in the container.
100 * @return The index of the specified element in the container. If
101 * the element is not contained in the container, this function
104 long IndexOf
(in nsIRDFNode aElement
);
109 NS_NewRDFContainer
(nsIRDFContainer
** aResult
);
112 NS_NewRDFContainer
(nsIRDFDataSource
* aDataSource
,
113 nsIRDFResource
* aResource
,
114 nsIRDFContainer
** aResult
);
117 * Create a cursor on a container that enumerates its contents in
121 NS_NewContainerEnumerator
(nsIRDFDataSource
* aDataSource
,
122 nsIRDFResource
* aContainer
,
123 nsISimpleEnumerator
** aResult
);