2015-04-09 20:25:05 +03: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/. */
|
2002-09-27 10:08:49 +04:00
|
|
|
|
|
|
|
#ifndef nsArray_h__
|
|
|
|
#define nsArray_h__
|
|
|
|
|
2016-10-24 23:24:26 +03:00
|
|
|
#include "nsIArrayExtensions.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
|
|
|
|
|
|
|
// {35C66FD1-95E9-4e0a-80C5-C3BD2B375481}
|
|
|
|
#define NS_ARRAY_CID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2002-09-27 10:08:49 +04:00
|
|
|
0x35c66fd1, 0x95e9, 0x4e0a, { \
|
|
|
|
0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2014-05-15 20:52:58 +04:00
|
|
|
// nsArray without any refcounting declarations
|
|
|
|
class nsArrayBase : public nsIMutableArray {
|
2002-09-27 10:08:49 +04:00
|
|
|
public:
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_DECL_NSIARRAY
|
2016-10-24 23:24:26 +03:00
|
|
|
NS_DECL_NSIARRAYEXTENSIONS
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_DECL_NSIMUTABLEARRAY
|
|
|
|
|
|
|
|
/* 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);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2009-01-16 07:02:22 +03:00
|
|
|
protected:
|
2014-07-09 19:15:21 +04:00
|
|
|
nsArrayBase() {}
|
|
|
|
nsArrayBase(const nsArrayBase& aOther);
|
2014-07-28 21:19:06 +04:00
|
|
|
explicit nsArrayBase(const nsCOMArray_base& aBaseArray)
|
|
|
|
: mArray(aBaseArray) {}
|
2014-07-09 19:15:21 +04:00
|
|
|
virtual ~nsArrayBase();
|
2004-01-15 09:14:18 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
nsCOMArray_base mArray;
|
2002-09-27 10:08:49 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsArray final : public nsArrayBase {
|
2014-07-09 19:15:21 +04:00
|
|
|
friend class nsArrayBase;
|
2014-05-15 20:52:58 +04:00
|
|
|
|
|
|
|
public:
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2014-05-15 20:52:58 +04:00
|
|
|
|
|
|
|
private:
|
2014-07-09 19:15:21 +04:00
|
|
|
nsArray() : nsArrayBase() {}
|
|
|
|
nsArray(const nsArray& aOther);
|
2014-07-28 21:19:06 +04:00
|
|
|
explicit nsArray(const nsCOMArray_base& aBaseArray)
|
|
|
|
: nsArrayBase(aBaseArray) {}
|
2014-07-09 19:15:21 +04:00
|
|
|
~nsArray() {}
|
2014-05-15 20:52:58 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsArrayCC final : public nsArrayBase {
|
2014-07-09 19:15:21 +04:00
|
|
|
friend class nsArrayBase;
|
2012-09-21 20:12:32 +04:00
|
|
|
|
2009-01-16 07:02:22 +03:00
|
|
|
public:
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2016-10-24 23:24:26 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsArrayCC, nsIMutableArray)
|
2012-09-21 20:12:32 +04:00
|
|
|
|
|
|
|
private:
|
2014-07-09 19:15:21 +04:00
|
|
|
nsArrayCC() : nsArrayBase() {}
|
|
|
|
nsArrayCC(const nsArrayCC& aOther);
|
2014-07-28 21:19:06 +04:00
|
|
|
explicit nsArrayCC(const nsCOMArray_base& aBaseArray)
|
|
|
|
: nsArrayBase(aBaseArray) {}
|
2014-07-09 19:15:21 +04:00
|
|
|
~nsArrayCC() {}
|
2009-01-16 07:02:22 +03:00
|
|
|
};
|
|
|
|
|
2002-09-27 10:08:49 +04:00
|
|
|
#endif
|