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/. */
|
1999-08-04 10:57:38 +04:00
|
|
|
|
|
|
|
#include "nsSupportsPrimitives.h"
|
2000-06-03 13:46:12 +04:00
|
|
|
#include "nsMemory.h"
|
2015-09-06 19:53:33 +03:00
|
|
|
#include "mozilla/Assertions.h"
|
2015-08-23 03:57:52 +03:00
|
|
|
#include "mozilla/IntegerPrintfMacros.h"
|
2016-08-15 09:43:21 +03:00
|
|
|
#include "mozilla/Sprintf.h"
|
2015-09-06 19:53:33 +03:00
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
static char*
|
|
|
|
DataToString(const char* aFormat, T aData)
|
|
|
|
{
|
|
|
|
static const int size = 32;
|
|
|
|
char buf[size];
|
|
|
|
|
2017-10-17 05:28:40 +03:00
|
|
|
SprintfLiteral(buf, aFormat, aData);
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2017-10-17 05:28:40 +03:00
|
|
|
return moz_xstrdup(buf);
|
2015-09-06 19:53:33 +03:00
|
|
|
}
|
1999-08-04 10:57:38 +04:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsID, nsISupportsID, nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsID::nsSupportsID()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(nullptr)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsID::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_ID;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsID::GetData(nsID** aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2017-10-18 02:39:20 +03:00
|
|
|
*aData = mData ? mData->Clone() : nullptr;
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsID::SetData(const nsID* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
if (mData) {
|
2015-03-27 03:01:12 +03:00
|
|
|
free(mData);
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2017-10-18 02:39:20 +03:00
|
|
|
mData = aData ? aData->Clone() : nullptr;
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsID::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
if (mData) {
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = mData->ToString();
|
2014-07-09 19:15:21 +04:00
|
|
|
} else {
|
2017-10-17 05:28:40 +03:00
|
|
|
*aResult = moz_xstrdup("null");
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-20 07:14:46 +04:00
|
|
|
|
2015-09-06 19:53:33 +03:00
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
2001-05-10 06:44:35 +04:00
|
|
|
/*****************************************************************************
|
2016-05-03 23:25:41 +03:00
|
|
|
* nsSupportsCString
|
2001-05-10 06:44:35 +04:00
|
|
|
*****************************************************************************/
|
1999-08-04 10:57:38 +04:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsCString, nsISupportsCString,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsCString::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_CSTRING;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsCString::GetData(nsACString& aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsCString::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
*aResult = ToNewCString(mData);
|
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2001-05-10 06:44:35 +04:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
2001-05-10 06:44:35 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsCString::SetData(const nsACString& aData)
|
2001-05-10 06:44:35 +04:00
|
|
|
{
|
2015-01-28 12:00:40 +03:00
|
|
|
bool ok = mData.Assign(aData, mozilla::fallible);
|
2014-07-09 19:15:21 +04:00
|
|
|
if (!ok) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
1999-12-01 01:06:05 +03:00
|
|
|
}
|
|
|
|
|
2001-05-10 06:44:35 +04:00
|
|
|
/*****************************************************************************
|
2016-05-03 23:25:41 +03:00
|
|
|
* nsSupportsString
|
2001-05-10 06:44:35 +04:00
|
|
|
*****************************************************************************/
|
1999-08-04 10:57:38 +04:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsString, nsISupportsString,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsString::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_STRING;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsString::GetData(nsAString& aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
aData = mData;
|
|
|
|
return NS_OK;
|
1999-12-01 01:06:05 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsString::ToString(char16_t** aResult)
|
1999-12-01 01:06:05 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
*aResult = ToNewUnicode(mData);
|
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
2001-05-10 06:44:35 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsString::SetData(const nsAString& aData)
|
2001-05-10 06:44:35 +04:00
|
|
|
{
|
2015-01-28 12:00:40 +03:00
|
|
|
bool ok = mData.Assign(aData, mozilla::fallible);
|
2014-07-09 19:15:21 +04:00
|
|
|
if (!ok) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRBool, nsISupportsPRBool,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRBool::nsSupportsPRBool()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(false)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRBool::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRBOOL;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRBool::GetData(bool* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRBool::SetData(bool aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRBool::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2017-10-17 05:09:29 +03:00
|
|
|
*aResult = moz_xstrdup(mData ? "true" : "false");
|
2015-09-06 19:53:33 +03:00
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRUint8, nsISupportsPRUint8,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint8::nsSupportsPRUint8()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint8::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRUINT8;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint8::GetData(uint8_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint8::SetData(uint8_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint8::ToString(char** aResult)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%u", static_cast<unsigned int>(mData));
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-04 10:57:38 +04:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRUint16, nsISupportsPRUint16,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint16::nsSupportsPRUint16()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint16::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRUINT16;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint16::GetData(uint16_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint16::SetData(uint16_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint16::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%u", static_cast<unsigned int>(mData));
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRUint32, nsISupportsPRUint32,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint32::nsSupportsPRUint32()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint32::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRUINT32;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint32::GetData(uint32_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint32::SetData(uint32_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint32::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%u", mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRUint64, nsISupportsPRUint64,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint64::nsSupportsPRUint64()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint64::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRUINT64;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint64::GetData(uint64_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint64::SetData(uint64_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRUint64::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%llu", mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRTime, nsISupportsPRTime,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRTime::nsSupportsPRTime()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRTime::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRTIME;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRTime::GetData(PRTime* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRTime::SetData(PRTime aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRTime::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%" PRIu64, mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsChar, nsISupportsChar,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsChar::nsSupportsChar()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsChar::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_CHAR;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsChar::GetData(char* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsChar::SetData(char aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsChar::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = static_cast<char*>(moz_xmalloc(2 * sizeof(char)));
|
|
|
|
*aResult[0] = mData;
|
|
|
|
*aResult[1] = '\0';
|
1999-08-06 13:42:12 +04:00
|
|
|
|
2015-09-06 19:53:33 +03:00
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRInt16, nsISupportsPRInt16,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt16::nsSupportsPRInt16()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt16::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRINT16;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt16::GetData(int16_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt16::SetData(int16_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt16::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%d", static_cast<int>(mData));
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRInt32, nsISupportsPRInt32,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt32::nsSupportsPRInt32()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt32::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRINT32;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt32::GetData(int32_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt32::SetData(int32_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt32::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%d", mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsPRInt64, nsISupportsPRInt64,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt64::nsSupportsPRInt64()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(0)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt64::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_PRINT64;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt64::GetData(int64_t* aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt64::SetData(int64_t aData)
|
1999-08-04 10:57:38 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-04 10:57:38 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsPRInt64::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%" PRId64, mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsFloat, nsISupportsFloat,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsFloat::nsSupportsFloat()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(float(0.0))
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsFloat::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_FLOAT;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsFloat::GetData(float* aData)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-06 13:42:12 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsFloat::SetData(float aData)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-06 13:42:12 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsFloat::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%f", static_cast<double>(mData));
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-06 13:42:12 +04:00
|
|
|
|
1999-08-04 10:57:38 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsDouble, nsISupportsDouble,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsDouble::nsSupportsDouble()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(double(0.0))
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsDouble::GetType(uint16_t* aType)
|
2001-03-23 06:09:49 +03:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_DOUBLE;
|
|
|
|
return NS_OK;
|
2001-03-23 06:09:49 +03:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsDouble::GetData(double* aData)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
return NS_OK;
|
1999-08-06 13:42:12 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsDouble::SetData(double aData)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
1999-08-06 13:42:12 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsDouble::ToString(char** aResult)
|
1999-08-06 13:42:12 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2015-09-06 19:53:33 +03:00
|
|
|
*aResult = DataToString("%f", mData);
|
|
|
|
return NS_OK;
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
1999-08-20 07:14:46 +04:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsInterfacePointer,
|
2014-04-27 11:06:00 +04:00
|
|
|
nsISupportsInterfacePointer,
|
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::nsSupportsInterfacePointer()
|
2014-07-09 19:15:21 +04:00
|
|
|
: mIID(nullptr)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::~nsSupportsInterfacePointer()
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
if (mIID) {
|
2015-03-27 03:01:12 +03:00
|
|
|
free(mIID);
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::GetType(uint16_t* aType)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aType, "Bad pointer");
|
|
|
|
*aType = TYPE_INTERFACE_POINTER;
|
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::GetData(nsISupports** aData)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aData, "Bad pointer");
|
|
|
|
*aData = mData;
|
|
|
|
NS_IF_ADDREF(*aData);
|
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::SetData(nsISupports* aData)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
mData = aData;
|
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::GetDataIID(nsID** aIID)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aIID, "Bad pointer");
|
2001-04-10 07:56:48 +04:00
|
|
|
|
2017-10-18 02:39:20 +03:00
|
|
|
*aIID = mIID ? mIID->Clone() : nullptr;
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::SetDataIID(const nsID* aIID)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
if (mIID) {
|
2015-03-27 03:01:12 +03:00
|
|
|
free(mIID);
|
2014-07-09 19:15:21 +04:00
|
|
|
}
|
2015-09-06 19:53:33 +03:00
|
|
|
|
2017-10-18 02:39:20 +03:00
|
|
|
mIID = aIID ? aIID->Clone() : nullptr;
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMETHODIMP
|
2016-05-03 23:25:41 +03:00
|
|
|
nsSupportsInterfacePointer::ToString(char** aResult)
|
2001-04-10 07:56:48 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_ASSERTION(aResult, "Bad pointer");
|
2001-04-10 07:56:48 +04:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
// jband sez: think about asking nsIInterfaceInfoManager whether
|
|
|
|
// the interface has a known human-readable name
|
2017-10-17 05:28:40 +03:00
|
|
|
*aResult = moz_xstrdup("[interface pointer]");
|
|
|
|
return NS_OK;
|
2001-04-10 07:56:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
2003-06-18 15:26:27 +04:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsSupportsDependentCString, nsISupportsCString,
|
|
|
|
nsISupportsPrimitive)
|
2008-02-21 23:39:20 +03:00
|
|
|
|
2003-06-18 15:26:27 +04:00
|
|
|
nsSupportsDependentCString::nsSupportsDependentCString(const char* aStr)
|
2014-07-09 19:15:21 +04:00
|
|
|
: mData(aStr)
|
2003-06-18 15:26:27 +04:00
|
|
|
{ }
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-07-09 19:15:21 +04:00
|
|
|
nsSupportsDependentCString::GetType(uint16_t* aType)
|
2003-06-18 15:26:27 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
if (NS_WARN_IF(!aType)) {
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
2003-06-18 15:26:27 +04:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
*aType = TYPE_CSTRING;
|
|
|
|
return NS_OK;
|
2003-06-18 15:26:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSupportsDependentCString::GetData(nsACString& aData)
|
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
aData = mData;
|
|
|
|
return NS_OK;
|
2003-06-18 15:26:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-07-09 19:15:21 +04:00
|
|
|
nsSupportsDependentCString::ToString(char** aResult)
|
2003-06-18 15:26:27 +04:00
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
if (NS_WARN_IF(!aResult)) {
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = ToNewCString(mData);
|
|
|
|
if (!*aResult) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2003-06-18 15:26:27 +04:00
|
|
|
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_OK;
|
2003-06-18 15:26:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSupportsDependentCString::SetData(const nsACString& aData)
|
|
|
|
{
|
2014-07-09 19:15:21 +04:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2003-06-18 15:26:27 +04:00
|
|
|
}
|