Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | #include "nsIRDFDataSource.idl" |
michael@0 | 8 | #include "nsIRDFResource.idl" |
michael@0 | 9 | #include "nsIRDFNode.idl" |
michael@0 | 10 | #include "nsISimpleEnumerator.idl" |
michael@0 | 11 | |
michael@0 | 12 | // A wrapper for manipulating RDF containers |
michael@0 | 13 | [scriptable, uuid(D4214E90-FB94-11D2-BDD8-00104BDE6048)] |
michael@0 | 14 | interface nsIRDFContainer : nsISupports { |
michael@0 | 15 | readonly attribute nsIRDFDataSource DataSource; |
michael@0 | 16 | readonly attribute nsIRDFResource Resource; |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * Initialize the container wrapper to the specified resource |
michael@0 | 20 | * using the specified datasource for context. |
michael@0 | 21 | */ |
michael@0 | 22 | void Init(in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer); |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * Return the number of elements in the container. Note that this |
michael@0 | 26 | * may not always be accurate due to aggregation. |
michael@0 | 27 | */ |
michael@0 | 28 | long GetCount(); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Return an enumerator that can be used to enumerate the contents |
michael@0 | 32 | * of the container in ascending order. |
michael@0 | 33 | */ |
michael@0 | 34 | nsISimpleEnumerator GetElements(); |
michael@0 | 35 | |
michael@0 | 36 | /** |
michael@0 | 37 | * Append an element to the container, assigning it the next |
michael@0 | 38 | * available ordinal. |
michael@0 | 39 | */ |
michael@0 | 40 | void AppendElement(in nsIRDFNode aElement); |
michael@0 | 41 | |
michael@0 | 42 | /** |
michael@0 | 43 | * Remove the first occurence of the specified element from the |
michael@0 | 44 | * container. If aRenumber is 'true', then the underlying RDF graph |
michael@0 | 45 | * will be 're-numbered' to account for the removal. |
michael@0 | 46 | */ |
michael@0 | 47 | void RemoveElement(in nsIRDFNode aElement, in boolean aRenumber); |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * Insert aElement at the specified index. If aRenumber is 'true', then |
michael@0 | 51 | * the underlying RDF graph will be 're-numbered' to accomodate the new |
michael@0 | 52 | * element. |
michael@0 | 53 | */ |
michael@0 | 54 | void InsertElementAt(in nsIRDFNode aElement, in long aIndex, in boolean aRenumber); |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Remove the element at the specified index. If aRenumber is 'true', then |
michael@0 | 58 | * the underlying RDF graph will be 're-numbered' to account for the |
michael@0 | 59 | * removal. |
michael@0 | 60 | * |
michael@0 | 61 | * @return the element that was removed. |
michael@0 | 62 | */ |
michael@0 | 63 | nsIRDFNode RemoveElementAt(in long aIndex, in boolean aRenumber); |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * Determine the index of an element in the container. |
michael@0 | 67 | * |
michael@0 | 68 | * @return The index of the specified element in the container. If |
michael@0 | 69 | * the element is not contained in the container, this function |
michael@0 | 70 | * returns '-1'. |
michael@0 | 71 | */ |
michael@0 | 72 | long IndexOf(in nsIRDFNode aElement); |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | %{C++ |
michael@0 | 76 | nsresult |
michael@0 | 77 | NS_NewRDFContainer(nsIRDFContainer** aResult); |
michael@0 | 78 | |
michael@0 | 79 | nsresult |
michael@0 | 80 | NS_NewRDFContainer(nsIRDFDataSource* aDataSource, |
michael@0 | 81 | nsIRDFResource* aResource, |
michael@0 | 82 | nsIRDFContainer** aResult); |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Create a cursor on a container that enumerates its contents in |
michael@0 | 86 | * order |
michael@0 | 87 | */ |
michael@0 | 88 | nsresult |
michael@0 | 89 | NS_NewContainerEnumerator(nsIRDFDataSource* aDataSource, |
michael@0 | 90 | nsIRDFResource* aContainer, |
michael@0 | 91 | nsISimpleEnumerator** aResult); |
michael@0 | 92 | |
michael@0 | 93 | |
michael@0 | 94 | %} |