michael@0: /* -*- Mode: C++; 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: #ifndef nsArrayUtils_h__ michael@0: #define nsArrayUtils_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIArray.h" michael@0: michael@0: // helper class for do_QueryElementAt michael@0: class NS_COM_GLUE nsQueryArrayElementAt : public nsCOMPtr_helper michael@0: { michael@0: public: michael@0: nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex, michael@0: nsresult* aErrorPtr) michael@0: : mArray(aArray), 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: nsIArray* mArray; michael@0: uint32_t mIndex; michael@0: nsresult* mErrorPtr; michael@0: }; michael@0: michael@0: inline michael@0: const nsQueryArrayElementAt michael@0: do_QueryElementAt(nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = 0) michael@0: { michael@0: return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr); michael@0: } michael@0: michael@0: #endif // nsArrayUtils_h__