2007-03-22 10:30:00 -07: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 "nsCOMPtr.h"
|
|
|
|
#include "nsILanguageAtomService.h"
|
|
|
|
#include "nsIStringBundle.h"
|
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
#include "nsIAtom.h"
|
2012-06-05 19:14:46 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define NS_LANGUAGEATOMSERVICE_CID \
|
2010-02-24 09:57:44 -08:00
|
|
|
{0xB7C65853, 0x2996, 0x435E, {0x96, 0x54, 0xDC, 0xC1, 0x78, 0xAA, 0xB4, 0x8C}}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-05 19:14:46 -07:00
|
|
|
class nsLanguageAtomService MOZ_FINAL : public nsILanguageAtomService
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsILanguageAtomService
|
2014-06-02 05:08:21 -07:00
|
|
|
virtual nsIAtom*
|
2011-05-30 22:09:05 -07:00
|
|
|
LookupLanguage(const nsACString &aLanguage, nsresult *aError);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-02 05:08:21 -07:00
|
|
|
virtual already_AddRefed<nsIAtom>
|
2014-05-08 02:32:00 -07:00
|
|
|
LookupCharSet(const nsACString& aCharSet);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-02 05:08:21 -07:00
|
|
|
virtual nsIAtom* GetLocaleLanguage(nsresult *aError);
|
2010-02-24 09:57:44 -08:00
|
|
|
|
2014-06-02 05:08:21 -07:00
|
|
|
virtual nsIAtom* GetLanguageGroup(nsIAtom *aLanguage,
|
2010-02-24 09:57:44 -08:00
|
|
|
nsresult *aError);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-02 05:08:24 -07:00
|
|
|
nsLanguageAtomService();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
2014-06-02 05:08:29 -07:00
|
|
|
~nsLanguageAtomService() { }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2014-06-02 05:08:21 -07:00
|
|
|
nsresult InitLangGroupTable();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-02-24 09:57:44 -08:00
|
|
|
nsInterfaceHashtable<nsISupportsHashKey, nsIAtom> mLangToGroup;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIStringBundle> mLangGroups;
|
2010-02-24 09:57:44 -08:00
|
|
|
nsCOMPtr<nsIAtom> mLocaleLanguage;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|