scuffed-code/icu4c/source/common/locmap.h

94 lines
2.8 KiB
C
Raw Normal View History

1999-08-16 21:50:52 +00:00
/*
******************************************************************************
*
* Copyright (C) 1996-2001, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
1999-08-16 21:50:52 +00:00
*/
// $Revision: 1.12 $
//============================================================================
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()
// 09/18/00 george Removed the memory leaks.
//============================================================================
1999-08-16 21:50:52 +00:00
/* include this first so that we are sure to get WIN32 defined */
#include "unicode/utypes.h"
1999-08-16 21:50:52 +00:00
#if defined(WIN32) && !defined(LOCMAP_H)
#define LOCMAP_H
1999-08-16 21:50:52 +00:00
#define LANGUAGE_LCID(hostID) (uint16_t)(0x03FF & hostID)
U_CFUNC const char *T_convertToPosix(uint32_t hostid, UErrorCode* status);
#ifdef XP_CPLUSPLUS
1999-08-16 21:50:52 +00:00
struct ILcidPosixMap;
1999-08-16 21:50:52 +00:00
class IGlobalLocales {
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.
* @return ICU locale
*/
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.
* @return the LCID
*/
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.
* @return the language part of the LCID
*/
static inline uint16_t languageLCID(uint32_t hostID) {return LANGUAGE_LCID(hostID);}
1999-08-16 21:50:52 +00:00
protected:
// IGlobalLocales() {}
// IGlobalLocales(const IGlobalLocales&/* that*/) {}
// IGlobalLocales& operator=(const IGlobalLocales&/* that*/) {return *this;}
// ~IGlobalLocales() {}
static void initializeMapRegions(void);
private:
static uint32_t LocaleCount;
static ILcidPosixMap* PosixIDmap;
static const char* WildCard;
1999-08-16 21:50:52 +00:00
};
#endif
#endif