1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsICollection.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 +#include "nsISerializable.idl" 1.10 + 1.11 +interface nsIEnumerator; 1.12 + 1.13 +[scriptable, uuid(83b6019c-cbc4-11d2-8cca-0060b0fc14a3)] 1.14 +interface nsICollection : nsISerializable 1.15 +{ 1.16 + 1.17 + uint32_t Count(); 1.18 + nsISupports GetElementAt(in uint32_t index); 1.19 + void QueryElementAt(in uint32_t index, in nsIIDRef uuid, 1.20 + [iid_is(uuid),retval] out nsQIResult result); 1.21 + void SetElementAt(in uint32_t index, in nsISupports item); 1.22 + void AppendElement(in nsISupports item); 1.23 + void RemoveElement(in nsISupports item); 1.24 + 1.25 + nsIEnumerator Enumerate(); 1.26 + 1.27 + void Clear(); 1.28 + 1.29 +}; 1.30 + 1.31 +%{C++ 1.32 + 1.33 +#ifndef nsCOMPtr_h__ 1.34 +#include "nsCOMPtr.h" 1.35 +#endif 1.36 + 1.37 +class nsQueryElementAt : public nsCOMPtr_helper 1.38 + { 1.39 + public: 1.40 + nsQueryElementAt( nsICollection* aCollection, uint32_t aIndex, nsresult* aErrorPtr ) 1.41 + : mCollection(aCollection), 1.42 + mIndex(aIndex), 1.43 + mErrorPtr(aErrorPtr) 1.44 + { 1.45 + // nothing else to do here 1.46 + } 1.47 + 1.48 + virtual nsresult NS_FASTCALL operator()( const nsIID& aIID, void** ) const; 1.49 + 1.50 + private: 1.51 + nsICollection* mCollection; 1.52 + uint32_t mIndex; 1.53 + nsresult* mErrorPtr; 1.54 + }; 1.55 + 1.56 +inline 1.57 +const nsQueryElementAt 1.58 +do_QueryElementAt( nsICollection* aCollection, uint32_t aIndex, nsresult* aErrorPtr = 0 ) 1.59 + { 1.60 + return nsQueryElementAt(aCollection, aIndex, aErrorPtr); 1.61 + } 1.62 + 1.63 +%}