intl/locale/src/nsLocaleConstructors.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/locale/src/nsLocaleConstructors.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsLocaleConstructors_h__
    1.10 +#define nsLocaleConstructors_h__
    1.11 +
    1.12 +#include "nsCollationCID.h"
    1.13 +#include "nsDateTimeFormatCID.h"
    1.14 +#include "mozilla/ModuleUtils.h"
    1.15 +#include "nsILocaleService.h"
    1.16 +#include "nsIScriptableDateFormat.h"
    1.17 +#include "nsIServiceManager.h"
    1.18 +#include "nsLanguageAtomService.h"
    1.19 +#include "nsPlatformCharset.h"
    1.20 +
    1.21 +#if defined(XP_MACOSX)
    1.22 +#define USE_MAC_LOCALE
    1.23 +#endif
    1.24 +
    1.25 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
    1.26 +#define USE_UNIX_LOCALE
    1.27 +#endif
    1.28 +
    1.29 +#ifdef XP_WIN
    1.30 +#include "windows/nsCollationWin.h"
    1.31 +#include "windows/nsDateTimeFormatWin.h"
    1.32 +#endif
    1.33 +
    1.34 +#ifdef USE_MAC_LOCALE
    1.35 +#include "mac/nsCollationMacUC.h"
    1.36 +#include "mac/nsDateTimeFormatMac.h"
    1.37 +#endif
    1.38 +
    1.39 +#ifdef USE_UNIX_LOCALE
    1.40 +#include "unix/nsCollationUnix.h"
    1.41 +#include "unix/nsDateTimeFormatUnix.h"
    1.42 +#endif
    1.43 +
    1.44 +#define NSLOCALE_MAKE_CTOR(ctor_, iface_, func_)          \
    1.45 +static nsresult                                           \
    1.46 +ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
    1.47 +{                                                         \
    1.48 +  *aResult = nullptr;                                      \
    1.49 +  if (aOuter)                                             \
    1.50 +    return NS_ERROR_NO_AGGREGATION;                       \
    1.51 +  iface_* inst;                                           \
    1.52 +  nsresult rv = func_(&inst);                             \
    1.53 +  if (NS_SUCCEEDED(rv)) {                                 \
    1.54 +    rv = inst->QueryInterface(aIID, aResult);             \
    1.55 +    NS_RELEASE(inst);                                     \
    1.56 +  }                                                       \
    1.57 +  return rv;                                              \
    1.58 +}
    1.59 +
    1.60 +
    1.61 +NSLOCALE_MAKE_CTOR(CreateLocaleService, nsILocaleService, NS_NewLocaleService)
    1.62 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationFactory)
    1.63 +//NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableDateTimeFormat)
    1.64 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsLanguageAtomService)
    1.65 +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPlatformCharset, Init)
    1.66 +
    1.67 +#ifdef XP_WIN
    1.68 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationWin)
    1.69 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatWin)
    1.70 +#endif
    1.71 +
    1.72 +#ifdef USE_UNIX_LOCALE
    1.73 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationUnix)
    1.74 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatUnix)
    1.75 +#endif  
    1.76 +
    1.77 +#ifdef USE_MAC_LOCALE
    1.78 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationMacUC)
    1.79 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatMac)
    1.80 +#endif  
    1.81 +
    1.82 +#endif

mercurial