Bug 564076: Small parser cleanup changes. (r=mrbkap)
[mozilla-central.git] / xpcom / ds / nsICollection.idl
blobf97bf970d9b3ed32ac7d5d8921730a32a5ffa9e7
1 /* -*- Mode: IDL; 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
13 * License.
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.
22 * Contributor(s):
23 * Scott Collins <scc@mozilla.org>: |do_QueryElementAt|
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsISerializable.idl"
40 #include "nsIEnumerator.idl"
42 [scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)]
43 interface nsICollection : nsISerializable
46 PRUint32 Count();
47 nsISupports GetElementAt(in PRUint32 index);
48 void QueryElementAt(in PRUint32 index, in nsIIDRef uuid,
49 [iid_is(uuid),retval] out nsQIResult result);
50 void SetElementAt(in PRUint32 index, in nsISupports item);
51 void AppendElement(in nsISupports item);
52 void RemoveElement(in nsISupports item);
54 nsIEnumerator Enumerate();
56 void Clear();
60 %{C++
62 #ifndef nsCOMPtr_h__
63 #include "nsCOMPtr.h"
64 #endif
66 class NS_COM nsQueryElementAt : public nsCOMPtr_helper
68 public:
69 nsQueryElementAt( nsICollection* aCollection, PRUint32 aIndex, nsresult* aErrorPtr )
70 : mCollection(aCollection),
71 mIndex(aIndex),
72 mErrorPtr(aErrorPtr)
74 // nothing else to do here
77 virtual nsresult NS_FASTCALL operator()( const nsIID& aIID, void** ) const;
79 private:
80 nsICollection* mCollection;
81 PRUint32 mIndex;
82 nsresult* mErrorPtr;
85 inline
86 const nsQueryElementAt
87 do_QueryElementAt( nsICollection* aCollection, PRUint32 aIndex, nsresult* aErrorPtr = 0 )
89 return nsQueryElementAt(aCollection, aIndex, aErrorPtr);