1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*****************************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1996-1999, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*****************************************************************************************
|
|
|
|
*/
|
1999-12-28 23:39:02 +00:00
|
|
|
// $Revision: 1.5 $
|
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()
|
|
|
|
//===============================================================================
|
|
|
|
#ifndef LOCMAP_H
|
|
|
|
#define LOCMAP_H
|
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#ifdef XP_CPLUSPLUS
|
|
|
|
class Locale;
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Internal Classes for LCID <--> POSIX Mapping
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class ILcidPosixElement
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ILcidPosixElement(uint32_t, const char*);
|
|
|
|
|
|
|
|
ILcidPosixElement();
|
|
|
|
ILcidPosixElement(const ILcidPosixElement&);
|
|
|
|
ILcidPosixElement& operator=(const ILcidPosixElement&);
|
|
|
|
|
|
|
|
~ILcidPosixElement();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32_t setId(const char* id);
|
|
|
|
enum { MAX_ID_LENGTH = 8 };
|
|
|
|
|
|
|
|
uint32_t fHostID;
|
|
|
|
char fPosixID[MAX_ID_LENGTH];
|
|
|
|
|
|
|
|
friend class ILcidPosixMap;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ILcidPosixMap
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ILcidPosixMap();
|
|
|
|
void initialize (uint32_t hostID,
|
|
|
|
const char* posixID,
|
|
|
|
uint32_t totalNumberOfRegions = 1);
|
|
|
|
|
|
|
|
~ILcidPosixMap();
|
|
|
|
|
|
|
|
void addRegion (uint32_t hostID,
|
|
|
|
const char* posixID);
|
|
|
|
|
|
|
|
uint16_t hostLangID(void) const
|
|
|
|
{ return fHostLangID; };
|
|
|
|
|
|
|
|
const char* posixLangID(void) const
|
|
|
|
{ return fPosixLangID; };
|
|
|
|
|
|
|
|
uint32_t hostID(const char* fromPosixID) const;
|
|
|
|
const char* posixID(uint32_t fromHostID) const;
|
|
|
|
|
|
|
|
static const char* fgWildCard;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
ILcidPosixMap(const ILcidPosixMap&);
|
|
|
|
ILcidPosixMap& operator=(const ILcidPosixMap&);
|
|
|
|
|
|
|
|
uint16_t fHostLangID;
|
|
|
|
char fPosixLangID[3];
|
|
|
|
|
|
|
|
ILcidPosixElement* fRegionMaps;
|
|
|
|
uint32_t fMapSize;
|
|
|
|
uint32_t fNumRegions;
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
class IGlobalLocales {
|
|
|
|
public:
|
|
|
|
static void initializeMapRegions(void);
|
|
|
|
static const char* convertToPosix(uint32_t hostid);
|
|
|
|
static uint32_t convertToLCID(const char* posixID);
|
|
|
|
static uint16_t languageLCID(uint32_t hostID);
|
|
|
|
protected:
|
|
|
|
IGlobalLocales() { }
|
|
|
|
IGlobalLocales(const IGlobalLocales& that) { }
|
|
|
|
IGlobalLocales& operator=(const IGlobalLocales& that) { return *this;}
|
|
|
|
private:
|
|
|
|
|
|
|
|
static int32_t fgLocaleCount;
|
|
|
|
static uint32_t fgStdLang;
|
|
|
|
static const uint32_t kMapSize;
|
|
|
|
static ILcidPosixMap * fgPosixIDmap;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~IGlobalLocales() { }
|
|
|
|
};
|
|
|
|
|
|
|
|
#else
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CAPI const char* U_EXPORT2 T_convertToPosix(uint32_t hostid);
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|