/src/mozilla-central/intl/locale/nsCollationFactory.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
5 | | |
6 | | #include "nsCollationFactory.h" |
7 | | #include "nsCollation.h" |
8 | | #include "nsServiceManagerUtils.h" |
9 | | #include "mozilla/intl/LocaleService.h" |
10 | | |
11 | | //////////////////////////////////////////////////////////////////////////////// |
12 | | |
13 | | NS_IMPL_ISUPPORTS(nsCollationFactory, nsICollationFactory) |
14 | | |
15 | | nsresult nsCollationFactory::CreateCollation(nsICollation** instancePtr) |
16 | 0 | { |
17 | 0 | nsAutoCString appLocale; |
18 | 0 | mozilla::intl::LocaleService::GetInstance()->GetAppLocaleAsLangTag(appLocale); |
19 | 0 |
|
20 | 0 | return CreateCollationForLocale(appLocale, instancePtr); |
21 | 0 | } |
22 | | |
23 | | nsresult |
24 | | nsCollationFactory::CreateCollationForLocale(const nsACString& locale, nsICollation** instancePtr) |
25 | 0 | { |
26 | 0 | // Create a collation interface instance. |
27 | 0 | // |
28 | 0 | nsCOMPtr<nsICollation> inst = new nsCollation(); |
29 | 0 |
|
30 | 0 | inst->Initialize(locale); |
31 | 0 |
|
32 | 0 | inst.forget(instancePtr); |
33 | 0 |
|
34 | 0 | return NS_OK; |
35 | 0 | } |