2002-09-27 10:08:49 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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/. */
|
2002-09-27 10:08:49 +04:00
|
|
|
|
|
|
|
#ifndef nsArray_h__
|
|
|
|
#define nsArray_h__
|
|
|
|
|
2006-04-12 19:43:32 +04:00
|
|
|
#include "nsIMutableArray.h"
|
2002-09-27 10:08:49 +04:00
|
|
|
#include "nsCOMArray.h"
|
2002-10-04 00:20:13 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2008-02-07 14:37:18 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-06-06 03:51:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2002-09-27 10:08:49 +04:00
|
|
|
|
|
|
|
#define NS_ARRAY_CLASSNAME \
|
|
|
|
"nsIArray implementation"
|
|
|
|
|
|
|
|
// {35C66FD1-95E9-4e0a-80C5-C3BD2B375481}
|
|
|
|
#define NS_ARRAY_CID \
|
|
|
|
{ 0x35c66fd1, 0x95e9, 0x4e0a, \
|
|
|
|
{ 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } }
|
|
|
|
|
|
|
|
class nsArray : public nsIMutableArray
|
|
|
|
{
|
|
|
|
public:
|
2009-01-16 07:02:22 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2002-09-27 10:08:49 +04:00
|
|
|
NS_DECL_NSIARRAY
|
|
|
|
NS_DECL_NSIMUTABLEARRAY
|
|
|
|
|
2012-09-21 20:12:32 +04:00
|
|
|
/* Both of these factory functions create a cycle-collectable array
|
|
|
|
on the main thread and a non-cycle-collectable array on other
|
|
|
|
threads. */
|
|
|
|
static already_AddRefed<nsIMutableArray> Create();
|
|
|
|
/* Only for the benefit of the XPCOM module system, use Create()
|
|
|
|
instead. */
|
|
|
|
static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
|
|
|
|
void** aResult);
|
2009-01-16 07:02:22 +03:00
|
|
|
protected:
|
2012-09-21 20:12:32 +04:00
|
|
|
nsArray() { }
|
|
|
|
nsArray(const nsArray& other);
|
|
|
|
nsArray(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray)
|
|
|
|
{ }
|
|
|
|
|
2012-06-06 03:51:58 +04:00
|
|
|
virtual ~nsArray(); // nsArrayCC inherits from this
|
2004-01-15 09:14:18 +03:00
|
|
|
|
2002-10-02 22:54:12 +04:00
|
|
|
nsCOMArray_base mArray;
|
2002-09-27 10:08:49 +04:00
|
|
|
};
|
|
|
|
|
2012-06-06 03:51:58 +04:00
|
|
|
class nsArrayCC MOZ_FINAL : public nsArray
|
2009-01-16 07:02:22 +03:00
|
|
|
{
|
2012-09-21 20:12:32 +04:00
|
|
|
friend class nsArray;
|
|
|
|
|
2009-01-16 07:02:22 +03:00
|
|
|
public:
|
2012-09-21 20:12:32 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC)
|
|
|
|
|
|
|
|
private:
|
2009-01-16 07:02:22 +03:00
|
|
|
nsArrayCC() : nsArray() { }
|
2012-09-21 20:12:32 +04:00
|
|
|
nsArrayCC(const nsArrayCC& other);
|
2009-01-16 07:02:22 +03:00
|
|
|
nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArray(aBaseArray)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2002-09-27 10:08:49 +04:00
|
|
|
#endif
|