1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsISupportsIterators.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,292 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* nsISupportsIterators.idl --- IDL defining general purpose iterators */ 1.10 + 1.11 + 1.12 +#include "nsISupports.idl" 1.13 + 1.14 + 1.15 + /* 1.16 + ... 1.17 + */ 1.18 + 1.19 + 1.20 + /** 1.21 + * ... 1.22 + */ 1.23 +[scriptable, uuid(7330650e-1dd2-11b2-a0c2-9ff86ee97bed)] 1.24 +interface nsIOutputIterator : nsISupports 1.25 + { 1.26 + /** 1.27 + * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. 1.28 + * The iterator and the underlying container or sequence cooperate to |Release()| 1.29 + * the replaced element, if any and if necessary, and to |AddRef()| the new element. 1.30 + * 1.31 + * The result is undefined if this iterator currently points outside the 1.32 + * useful range of the underlying container or sequence. 1.33 + * 1.34 + * @param anElementToPut the element to place into the underlying container or sequence 1.35 + */ 1.36 + void putElement( in nsISupports anElementToPut ); 1.37 + 1.38 + /** 1.39 + * Advance this iterator to the next position in the underlying container or sequence. 1.40 + */ 1.41 + void stepForward(); 1.42 + }; 1.43 + 1.44 + /** 1.45 + * ... 1.46 + */ 1.47 +[scriptable, uuid(85585e12-1dd2-11b2-a930-f6929058269a)] 1.48 +interface nsIInputIterator : nsISupports 1.49 + { 1.50 + /** 1.51 + * Retrieve (and |AddRef()|) the element this iterator currently points to. 1.52 + * 1.53 + * The result is undefined if this iterator currently points outside the 1.54 + * useful range of the underlying container or sequence. 1.55 + * 1.56 + * @result a new reference to the element this iterator currently points to (if any) 1.57 + */ 1.58 + nsISupports getElement(); 1.59 + 1.60 + /** 1.61 + * Advance this iterator to the next position in the underlying container or sequence. 1.62 + */ 1.63 + void stepForward(); 1.64 + 1.65 + /** 1.66 + * Test if |anotherIterator| points to the same position in the underlying container or sequence. 1.67 + * 1.68 + * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. 1.69 + * 1.70 + * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence 1.71 + * @result true if |anotherIterator| points to the same position in the underlying container or sequence 1.72 + */ 1.73 + boolean isEqualTo( in nsISupports anotherIterator ); 1.74 + 1.75 + /** 1.76 + * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. 1.77 + * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. 1.78 + * 1.79 + * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator 1.80 + */ 1.81 + nsISupports clone(); 1.82 + }; 1.83 + 1.84 + /** 1.85 + * ... 1.86 + */ 1.87 +[scriptable, uuid(8da01646-1dd2-11b2-98a7-c7009045be7e)] 1.88 +interface nsIForwardIterator : nsISupports 1.89 + { 1.90 + /** 1.91 + * Retrieve (and |AddRef()|) the element this iterator currently points to. 1.92 + * 1.93 + * The result is undefined if this iterator currently points outside the 1.94 + * useful range of the underlying container or sequence. 1.95 + * 1.96 + * @result a new reference to the element this iterator currently points to (if any) 1.97 + */ 1.98 + nsISupports getElement(); 1.99 + 1.100 + /** 1.101 + * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. 1.102 + * The iterator and the underlying container or sequence cooperate to |Release()| 1.103 + * the replaced element, if any and if necessary, and to |AddRef()| the new element. 1.104 + * 1.105 + * The result is undefined if this iterator currently points outside the 1.106 + * useful range of the underlying container or sequence. 1.107 + * 1.108 + * @param anElementToPut the element to place into the underlying container or sequence 1.109 + */ 1.110 + void putElement( in nsISupports anElementToPut ); 1.111 + 1.112 + /** 1.113 + * Advance this iterator to the next position in the underlying container or sequence. 1.114 + */ 1.115 + void stepForward(); 1.116 + 1.117 + /** 1.118 + * Test if |anotherIterator| points to the same position in the underlying container or sequence. 1.119 + * 1.120 + * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. 1.121 + * 1.122 + * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence 1.123 + * @result true if |anotherIterator| points to the same position in the underlying container or sequence 1.124 + */ 1.125 + boolean isEqualTo( in nsISupports anotherIterator ); 1.126 + 1.127 + /** 1.128 + * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. 1.129 + * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. 1.130 + * 1.131 + * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator 1.132 + */ 1.133 + nsISupports clone(); 1.134 + }; 1.135 + 1.136 + /** 1.137 + * ... 1.138 + */ 1.139 +[scriptable, uuid(948defaa-1dd1-11b2-89f6-8ce81f5ebda9)] 1.140 +interface nsIBidirectionalIterator : nsISupports 1.141 + { 1.142 + /** 1.143 + * Retrieve (and |AddRef()|) the element this iterator currently points to. 1.144 + * 1.145 + * The result is undefined if this iterator currently points outside the 1.146 + * useful range of the underlying container or sequence. 1.147 + * 1.148 + * @result a new reference to the element this iterator currently points to (if any) 1.149 + */ 1.150 + nsISupports getElement(); 1.151 + 1.152 + /** 1.153 + * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. 1.154 + * The iterator and the underlying container or sequence cooperate to |Release()| 1.155 + * the replaced element, if any and if necessary, and to |AddRef()| the new element. 1.156 + * 1.157 + * The result is undefined if this iterator currently points outside the 1.158 + * useful range of the underlying container or sequence. 1.159 + * 1.160 + * @param anElementToPut the element to place into the underlying container or sequence 1.161 + */ 1.162 + void putElement( in nsISupports anElementToPut ); 1.163 + 1.164 + /** 1.165 + * Advance this iterator to the next position in the underlying container or sequence. 1.166 + */ 1.167 + void stepForward(); 1.168 + 1.169 + /** 1.170 + * Move this iterator to the previous position in the underlying container or sequence. 1.171 + */ 1.172 + void stepBackward(); 1.173 + 1.174 + /** 1.175 + * Test if |anotherIterator| points to the same position in the underlying container or sequence. 1.176 + * 1.177 + * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. 1.178 + * 1.179 + * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence 1.180 + * @result true if |anotherIterator| points to the same position in the underlying container or sequence 1.181 + */ 1.182 + boolean isEqualTo( in nsISupports anotherIterator ); 1.183 + 1.184 + /** 1.185 + * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. 1.186 + * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. 1.187 + * 1.188 + * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator 1.189 + */ 1.190 + nsISupports clone(); 1.191 + }; 1.192 + 1.193 + /** 1.194 + * ... 1.195 + */ 1.196 +[scriptable, uuid(9bd6fdb0-1dd1-11b2-9101-d15375968230)] 1.197 +interface nsIRandomAccessIterator : nsISupports 1.198 + { 1.199 + /** 1.200 + * Retrieve (and |AddRef()|) the element this iterator currently points to. 1.201 + * 1.202 + * The result is undefined if this iterator currently points outside the 1.203 + * useful range of the underlying container or sequence. 1.204 + * 1.205 + * @result a new reference to the element this iterator currently points to (if any) 1.206 + */ 1.207 + nsISupports getElement(); 1.208 + 1.209 + /** 1.210 + * Retrieve (and |AddRef()|) an element at some offset from where this iterator currently points. 1.211 + * The offset may be negative. |getElementAt(0)| is equivalent to |getElement()|. 1.212 + * 1.213 + * The result is undefined if this iterator currently points outside the 1.214 + * useful range of the underlying container or sequence. 1.215 + * 1.216 + * @param anOffset a |0|-based offset from the position to which this iterator currently points 1.217 + * @result a new reference to the indicated element (if any) 1.218 + */ 1.219 + nsISupports getElementAt( in int32_t anOffset ); 1.220 + 1.221 + /** 1.222 + * Put |anElementToPut| into the underlying container or sequence at the position currently pointed to by this iterator. 1.223 + * The iterator and the underlying container or sequence cooperate to |Release()| 1.224 + * the replaced element, if any and if necessary, and to |AddRef()| the new element. 1.225 + * 1.226 + * The result is undefined if this iterator currently points outside the 1.227 + * useful range of the underlying container or sequence. 1.228 + * 1.229 + * @param anElementToPut the element to place into the underlying container or sequence 1.230 + */ 1.231 + void putElement( in nsISupports anElementToPut ); 1.232 + 1.233 + /** 1.234 + * Put |anElementToPut| into the underlying container or sequence at the position |anOffset| away from that currently pointed to by this iterator. 1.235 + * The iterator and the underlying container or sequence cooperate to |Release()| 1.236 + * the replaced element, if any and if necessary, and to |AddRef()| the new element. 1.237 + * |putElementAt(0, obj)| is equivalent to |putElement(obj)|. 1.238 + * 1.239 + * The result is undefined if this iterator currently points outside the 1.240 + * useful range of the underlying container or sequence. 1.241 + * 1.242 + * @param anOffset a |0|-based offset from the position to which this iterator currently points 1.243 + * @param anElementToPut the element to place into the underlying container or sequence 1.244 + */ 1.245 + void putElementAt( in int32_t anOffset, in nsISupports anElementToPut ); 1.246 + 1.247 + /** 1.248 + * Advance this iterator to the next position in the underlying container or sequence. 1.249 + */ 1.250 + void stepForward(); 1.251 + 1.252 + /** 1.253 + * Move this iterator by |anOffset| positions in the underlying container or sequence. 1.254 + * |anOffset| may be negative. |stepForwardBy(1)| is equivalent to |stepForward()|. 1.255 + * |stepForwardBy(0)| is a no-op. 1.256 + * 1.257 + * @param anOffset a |0|-based offset from the position to which this iterator currently points 1.258 + */ 1.259 + void stepForwardBy( in int32_t anOffset ); 1.260 + 1.261 + /** 1.262 + * Move this iterator to the previous position in the underlying container or sequence. 1.263 + */ 1.264 + void stepBackward(); 1.265 + 1.266 + /** 1.267 + * Move this iterator backwards by |anOffset| positions in the underlying container or sequence. 1.268 + * |anOffset| may be negative. |stepBackwardBy(1)| is equivalent to |stepBackward()|. 1.269 + * |stepBackwardBy(n)| is equivalent to |stepForwardBy(-n)|. |stepBackwardBy(0)| is a no-op. 1.270 + * 1.271 + * @param anOffset a |0|-based offset from the position to which this iterator currently points 1.272 + */ 1.273 + void stepBackwardBy( in int32_t anOffset ); 1.274 + 1.275 + /** 1.276 + * Test if |anotherIterator| points to the same position in the underlying container or sequence. 1.277 + * 1.278 + * The result is undefined if |anotherIterator| was not created by or for the same underlying container or sequence. 1.279 + * 1.280 + * @param anotherIterator another iterator to compare against, created by or for the same underlying container or sequence 1.281 + * @result true if |anotherIterator| points to the same position in the underlying container or sequence 1.282 + */ 1.283 + boolean isEqualTo( in nsISupports anotherIterator ); 1.284 + 1.285 + /** 1.286 + * Create a new iterator pointing to the same position in the underlying container or sequence to which this iterator currently points. 1.287 + * The returned iterator is suitable for use in a subsequent call to |isEqualTo()| against this iterator. 1.288 + * 1.289 + * @result a new iterator pointing at the same position in the same underlying container or sequence as this iterator 1.290 + */ 1.291 + nsISupports clone(); 1.292 + }; 1.293 + 1.294 +%{C++ 1.295 +%}