michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsLocaleConstructors_h__ michael@0: #define nsLocaleConstructors_h__ michael@0: michael@0: #include "nsCollationCID.h" michael@0: #include "nsDateTimeFormatCID.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: #include "nsILocaleService.h" michael@0: #include "nsIScriptableDateFormat.h" michael@0: #include "nsIServiceManager.h" michael@0: #include "nsLanguageAtomService.h" michael@0: #include "nsPlatformCharset.h" michael@0: michael@0: #if defined(XP_MACOSX) michael@0: #define USE_MAC_LOCALE michael@0: #endif michael@0: michael@0: #if defined(XP_UNIX) && !defined(XP_MACOSX) michael@0: #define USE_UNIX_LOCALE michael@0: #endif michael@0: michael@0: #ifdef XP_WIN michael@0: #include "windows/nsCollationWin.h" michael@0: #include "windows/nsDateTimeFormatWin.h" michael@0: #endif michael@0: michael@0: #ifdef USE_MAC_LOCALE michael@0: #include "mac/nsCollationMacUC.h" michael@0: #include "mac/nsDateTimeFormatMac.h" michael@0: #endif michael@0: michael@0: #ifdef USE_UNIX_LOCALE michael@0: #include "unix/nsCollationUnix.h" michael@0: #include "unix/nsDateTimeFormatUnix.h" michael@0: #endif michael@0: michael@0: #define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_) \ michael@0: static nsresult \ michael@0: ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \ michael@0: { \ michael@0: *aResult = nullptr; \ michael@0: if (aOuter) \ michael@0: return NS_ERROR_NO_AGGREGATION; \ michael@0: iface_* inst; \ michael@0: nsresult rv = func_(&inst); \ michael@0: if (NS_SUCCEEDED(rv)) { \ michael@0: rv = inst->QueryInterface(aIID, aResult); \ michael@0: NS_RELEASE(inst); \ michael@0: } \ michael@0: return rv; \ michael@0: } michael@0: michael@0: michael@0: NSLOCALE_MAKE_CTOR(CreateLocaleService, nsILocaleService, NS_NewLocaleService) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationFactory) michael@0: //NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableDateTimeFormat) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsLanguageAtomService) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPlatformCharset, Init) michael@0: michael@0: #ifdef XP_WIN michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationWin) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatWin) michael@0: #endif michael@0: michael@0: #ifdef USE_UNIX_LOCALE michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationUnix) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatUnix) michael@0: #endif michael@0: michael@0: #ifdef USE_MAC_LOCALE michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationMacUC) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatMac) michael@0: #endif michael@0: michael@0: #endif