Line data Source code
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 : #ifndef nsLocaleConstructors_h__
7 : #define nsLocaleConstructors_h__
8 :
9 : #include "nsCollation.h"
10 : #include "nsCollationCID.h"
11 : #include "mozilla/ModuleUtils.h"
12 : #include "nsILocaleService.h"
13 : #include "nsIScriptableDateFormat.h"
14 : #include "nsIServiceManager.h"
15 : #include "nsPlatformCharset.h"
16 : #include "LocaleService.h"
17 : #include "OSPreferences.h"
18 :
19 : #define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_) \
20 : static nsresult \
21 : ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
22 : { \
23 : *aResult = nullptr; \
24 : if (aOuter) \
25 : return NS_ERROR_NO_AGGREGATION; \
26 : iface_* inst; \
27 : nsresult rv = func_(&inst); \
28 : if (NS_SUCCEEDED(rv)) { \
29 : rv = inst->QueryInterface(aIID, aResult); \
30 : NS_RELEASE(inst); \
31 : } \
32 : return rv; \
33 : }
34 :
35 :
36 0 : NSLOCALE_MAKE_CTOR(CreateLocaleService, nsILocaleService, NS_NewLocaleService)
37 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollation)
38 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationFactory)
39 0 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPlatformCharset, Init)
40 :
41 : namespace mozilla {
42 : namespace intl {
43 1 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(LocaleService,
44 : LocaleService::GetInstanceAddRefed)
45 1 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(OSPreferences,
46 : OSPreferences::GetInstanceAddRefed)
47 : }
48 : }
49 :
50 : #endif
|