1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*****************************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
2000-09-19 18:02:53 +00:00
|
|
|
* Copyright (C) 1996-2000, International Business Machines
|
1999-12-13 22:28:37 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*****************************************************************************************
|
|
|
|
*/
|
2000-10-28 00:39:54 +00:00
|
|
|
// $Revision: 1.11 $
|
1999-08-16 21:50:52 +00:00
|
|
|
//===============================================================================
|
|
|
|
//
|
|
|
|
// File locmap.hpp : Locale Mapping Classes
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by: Helena Shih
|
|
|
|
//
|
|
|
|
// Modification History:
|
|
|
|
//
|
|
|
|
// Date Name Description
|
|
|
|
// 3/11/97 aliu Added setId().
|
|
|
|
// 4/20/99 Madhu Added T_convertToPosix()
|
2000-09-19 18:02:53 +00:00
|
|
|
// 09/18/00 george Removed the memory leaks.
|
1999-08-16 21:50:52 +00:00
|
|
|
//===============================================================================
|
|
|
|
|
2000-01-20 22:33:52 +00:00
|
|
|
/* include this first so that we are sure to get WIN32 defined */
|
1999-12-28 23:39:02 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-01-20 22:33:52 +00:00
|
|
|
#if defined(WIN32) && !defined(LOCMAP_H)
|
|
|
|
#define LOCMAP_H
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-09-19 18:02:53 +00:00
|
|
|
#define LANGUAGE_LCID(hostID) (uint16_t)(0x03FF & hostID)
|
|
|
|
|
|
|
|
U_CFUNC const char *T_convertToPosix(uint32_t hostid, UErrorCode* status);
|
|
|
|
|
2000-01-20 22:33:52 +00:00
|
|
|
#ifdef XP_CPLUSPLUS
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-09-19 18:02:53 +00:00
|
|
|
struct ILcidPosixMap;
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
class IGlobalLocales {
|
2000-09-19 18:02:53 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Convert a Windows LCID number to an ICU locale name. For instance,
|
|
|
|
* 0x0409 will be return "en_US".
|
|
|
|
*
|
|
|
|
* @param hostid the Windows LCID number.
|
|
|
|
* @param status gets set to U_ILLEGAL_ARGUMENT_ERROR when the LCID has no
|
|
|
|
* equivalent ICU locale.
|
2000-10-28 00:39:54 +00:00
|
|
|
* @return ICU locale
|
2000-09-19 18:02:53 +00:00
|
|
|
*/
|
|
|
|
static const char* convertToPosix(uint32_t hostid, UErrorCode* status);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert an ICU locale name to a Windows LCID number. For instance,
|
|
|
|
* "en_US" will be return 0x0409.
|
|
|
|
*
|
|
|
|
* @param posixid the Posix style locale id.
|
|
|
|
* @param status gets set to U_ILLEGAL_ARGUMENT_ERROR when the Posix ID has
|
|
|
|
* no equivalent Windows LCID.
|
2000-10-28 00:39:54 +00:00
|
|
|
* @return the LCID
|
2000-09-19 18:02:53 +00:00
|
|
|
*/
|
|
|
|
static uint32_t convertToLCID(const char* posixID, UErrorCode* status);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a Windows LCID number to a Windows language ID.
|
|
|
|
* This removes the sort ID from the LCID. For instance, information about
|
|
|
|
* the modern sort verses traditional sort on Spanish is removed from the
|
|
|
|
* ID.
|
|
|
|
*
|
|
|
|
* @param hostid the Windows LCID number.
|
2000-10-28 00:39:54 +00:00
|
|
|
* @return the language part of the LCID
|
2000-09-19 18:02:53 +00:00
|
|
|
*/
|
|
|
|
static inline uint16_t languageLCID(uint32_t hostID) {return LANGUAGE_LCID(hostID);}
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-09-19 18:02:53 +00:00
|
|
|
protected:
|
|
|
|
// IGlobalLocales() {}
|
|
|
|
// IGlobalLocales(const IGlobalLocales&/* that*/) {}
|
|
|
|
// IGlobalLocales& operator=(const IGlobalLocales&/* that*/) {return *this;}
|
|
|
|
|
|
|
|
// ~IGlobalLocales() {}
|
|
|
|
|
|
|
|
static void initializeMapRegions(void);
|
|
|
|
private:
|
2000-10-28 00:39:54 +00:00
|
|
|
|
2000-09-19 18:02:53 +00:00
|
|
|
static uint32_t LocaleCount;
|
|
|
|
static ILcidPosixMap* PosixIDmap;
|
2000-10-10 00:00:04 +00:00
|
|
|
|
|
|
|
static const char* WildCard;
|
1999-08-16 21:50:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-01-20 22:33:52 +00:00
|
|
|
#endif
|