2014-06-30 19:39:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-04-12 19:43:32 +04:00
|
|
|
|
|
|
|
#ifndef nsArrayUtils_h__
|
|
|
|
#define nsArrayUtils_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIArray.h"
|
|
|
|
|
|
|
|
// helper class for do_QueryElementAt
|
2015-04-20 23:58:15 +03:00
|
|
|
class MOZ_STACK_CLASS nsQueryArrayElementAt final : public nsCOMPtr_helper
|
2014-06-27 05:35:39 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex,
|
|
|
|
nsresult* aErrorPtr)
|
|
|
|
: mArray(aArray)
|
|
|
|
, mIndex(aIndex)
|
|
|
|
, mErrorPtr(aErrorPtr)
|
2006-04-12 19:43:32 +04:00
|
|
|
{
|
2014-06-27 05:35:39 +04:00
|
|
|
}
|
2006-04-12 19:43:32 +04:00
|
|
|
|
2015-01-15 19:36:10 +03:00
|
|
|
virtual nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2006-04-12 19:43:32 +04:00
|
|
|
|
2014-06-27 05:35:39 +04:00
|
|
|
private:
|
2015-01-18 21:55:45 +03:00
|
|
|
nsIArray* MOZ_NON_OWNING_REF mArray;
|
2014-06-27 05:35:39 +04:00
|
|
|
uint32_t mIndex;
|
|
|
|
nsresult* mErrorPtr;
|
|
|
|
};
|
2006-04-12 19:43:32 +04:00
|
|
|
|
2014-06-27 05:35:39 +04:00
|
|
|
inline const nsQueryArrayElementAt
|
2012-08-22 19:56:38 +04:00
|
|
|
do_QueryElementAt(nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = 0)
|
2014-06-27 05:35:39 +04:00
|
|
|
{
|
|
|
|
return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr);
|
|
|
|
}
|
2006-04-12 19:43:32 +04:00
|
|
|
|
|
|
|
#endif // nsArrayUtils_h__
|