gecko-dev/intl/locale/nsCollationFactory.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.1 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2012-05-21 11:12:37 +00: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-01-21 01:28:27 +00:00
#include "nsCollationFactory.h"
#include "nsCollation.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/intl/LocaleService.h"
////////////////////////////////////////////////////////////////////////////////
1999-01-21 01:28:27 +00:00
NS_IMPL_ISUPPORTS(nsCollationFactory, nsICollationFactory)
1999-01-21 01:28:27 +00:00
nsresult nsCollationFactory::CreateCollation(nsICollation** instancePtr) {
nsAutoCString appLocale;
mozilla::intl::LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale);
return CreateCollationForLocale(appLocale, instancePtr);
}
nsresult nsCollationFactory::CreateCollationForLocale(
const nsACString& locale, nsICollation** instancePtr) {
1999-01-21 01:28:27 +00:00
// Create a collation interface instance.
//
nsCOMPtr<nsICollation> inst = new nsCollation();
1999-01-21 01:28:27 +00:00
inst->Initialize(locale);
inst.forget(instancePtr);
1999-01-21 01:28:27 +00:00
return NS_OK;
1999-01-21 01:28:27 +00:00
}