2010-03-08 07:44:59 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsAtomService.h"
|
|
|
|
|
2013-07-18 19:31:26 -07:00
|
|
|
NS_IMPL_ISUPPORTS1(nsAtomService, nsIAtomService)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsAtomService::nsAtomService()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2008-08-11 13:26:40 -07:00
|
|
|
nsAtomService::GetAtom(const nsAString& aString, nsIAtom ** aResult)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-04-22 04:13:22 -07:00
|
|
|
*aResult = NS_NewAtom(aString).get();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2008-08-11 13:26:40 -07:00
|
|
|
nsAtomService::GetPermanentAtom(const nsAString& aString, nsIAtom ** aResult)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-03-08 07:45:00 -08:00
|
|
|
*aResult = NS_NewPermanentAtom(aString);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsAtomService::GetAtomUTF8(const char *aValue, nsIAtom* *aResult)
|
|
|
|
{
|
2013-04-22 04:13:22 -07:00
|
|
|
*aResult = NS_NewAtom(aValue).get();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsAtomService::GetPermanentAtomUTF8(const char *aValue, nsIAtom* *aResult)
|
|
|
|
{
|
2010-03-08 07:45:00 -08:00
|
|
|
*aResult = NS_NewPermanentAtom(NS_ConvertUTF8toUTF16(aValue));
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|