1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Pierre Phaneuf <pp@ludusdesign.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef nsLocaleConstructors_h__
40 : #define nsLocaleConstructors_h__
41 :
42 : #include "nsCollationCID.h"
43 : #include "nsDateTimeFormatCID.h"
44 : #include "mozilla/ModuleUtils.h"
45 : #include "nsILocaleService.h"
46 : #include "nsIScriptableDateFormat.h"
47 : #include "nsIServiceManager.h"
48 : #include "nsLanguageAtomService.h"
49 : #include "nsPlatformCharset.h"
50 : #include "nsLocaleCID.h"
51 :
52 : #if defined(XP_MACOSX)
53 : #define USE_MAC_LOCALE
54 : #endif
55 :
56 : #if defined(XP_UNIX) && !defined(XP_MACOSX)
57 : #define USE_UNIX_LOCALE
58 : #endif
59 :
60 : #ifdef XP_WIN
61 : #include "nsCollationWin.h"
62 : #include "nsDateTimeFormatWin.h"
63 : #endif
64 :
65 : #ifdef XP_OS2
66 : #include "nsOS2Locale.h"
67 : #include "nsCollationOS2.h"
68 : #include "nsDateTimeFormatOS2.h"
69 : #endif
70 :
71 : #ifdef USE_MAC_LOCALE
72 : #include "nsCollationMacUC.h"
73 : #include "nsDateTimeFormatMac.h"
74 : #endif
75 :
76 : #ifdef USE_UNIX_LOCALE
77 : #include "nsCollationUnix.h"
78 : #include "nsDateTimeFormatUnix.h"
79 : #endif
80 :
81 : #define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_) \
82 : static nsresult \
83 : ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
84 : { \
85 : *aResult = nsnull; \
86 : if (aOuter) \
87 : return NS_ERROR_NO_AGGREGATION; \
88 : iface_* inst; \
89 : nsresult rv = func_(&inst); \
90 : if (NS_SUCCEEDED(rv)) { \
91 : rv = inst->QueryInterface(aIID, aResult); \
92 : NS_RELEASE(inst); \
93 : } \
94 : return rv; \
95 : }
96 :
97 :
98 83 : NSLOCALE_MAKE_CTOR(CreateLocaleService, nsILocaleService, NS_NewLocaleService)
99 38 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationFactory)
100 : //NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableDateTimeFormat)
101 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsLanguageAtomService)
102 482 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPlatformCharset, Init)
103 :
104 : #ifdef XP_WIN
105 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationWin)
106 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatWin)
107 : #endif
108 :
109 : #ifdef USE_UNIX_LOCALE
110 38 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationUnix)
111 2834 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatUnix)
112 : #endif
113 :
114 : #ifdef USE_MAC_LOCALE
115 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationMacUC)
116 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatMac)
117 : #endif
118 :
119 : #ifdef XP_OS2
120 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsOS2Locale)
121 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationOS2)
122 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatOS2)
123 : #endif
124 :
125 : #endif
|