michael@0: /* -*- Mode: IDL; 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 "nsISerializable.idl" michael@0: michael@0: interface nsIEnumerator; michael@0: michael@0: [scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)] michael@0: interface nsICollection : nsISerializable michael@0: { michael@0: michael@0: uint32_t Count(); michael@0: nsISupports GetElementAt(in uint32_t index); michael@0: void QueryElementAt(in uint32_t index, in nsIIDRef uuid, michael@0: [iid_is(uuid),retval] out nsQIResult result); michael@0: void SetElementAt(in uint32_t index, in nsISupports item); michael@0: void AppendElement(in nsISupports item); michael@0: void RemoveElement(in nsISupports item); michael@0: michael@0: nsIEnumerator Enumerate(); michael@0: michael@0: void Clear(); michael@0: michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: #ifndef nsCOMPtr_h__ michael@0: #include "nsCOMPtr.h" michael@0: #endif michael@0: michael@0: class nsQueryElementAt : public nsCOMPtr_helper michael@0: { michael@0: public: michael@0: nsQueryElementAt( nsICollection* aCollection, uint32_t aIndex, nsresult* aErrorPtr ) michael@0: : mCollection(aCollection), michael@0: mIndex(aIndex), michael@0: mErrorPtr(aErrorPtr) michael@0: { michael@0: // nothing else to do here michael@0: } michael@0: michael@0: virtual nsresult NS_FASTCALL operator()( const nsIID& aIID, void** ) const; michael@0: michael@0: private: michael@0: nsICollection* mCollection; michael@0: uint32_t mIndex; michael@0: nsresult* mErrorPtr; michael@0: }; michael@0: michael@0: inline michael@0: const nsQueryElementAt michael@0: do_QueryElementAt( nsICollection* aCollection, uint32_t aIndex, nsresult* aErrorPtr = 0 ) michael@0: { michael@0: return nsQueryElementAt(aCollection, aIndex, aErrorPtr); michael@0: } michael@0: michael@0: %}