1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsAtomService.h"
9 NS_IMPL_ISUPPORTS1(nsAtomService
, nsIAtomService
)
11 nsAtomService::nsAtomService()
16 nsAtomService::GetAtom(const nsAString
& aString
, nsIAtom
** aResult
)
18 *aResult
= NS_NewAtom(aString
).get();
21 return NS_ERROR_OUT_OF_MEMORY
;
27 nsAtomService::GetPermanentAtom(const nsAString
& aString
, nsIAtom
** aResult
)
29 *aResult
= NS_NewPermanentAtom(aString
);
32 return NS_ERROR_OUT_OF_MEMORY
;
38 nsAtomService::GetAtomUTF8(const char *aValue
, nsIAtom
* *aResult
)
40 *aResult
= NS_NewAtom(aValue
).get();
43 return NS_ERROR_OUT_OF_MEMORY
;
49 nsAtomService::GetPermanentAtomUTF8(const char *aValue
, nsIAtom
* *aResult
)
51 *aResult
= NS_NewPermanentAtom(NS_ConvertUTF8toUTF16(aValue
));
54 return NS_ERROR_OUT_OF_MEMORY
;