home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / common / locmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  3.6 KB  |  129 lines

  1. /*
  2. *****************************************************************************************
  3. *                                                                                       *
  4. * COPYRIGHT:                                                                            *
  5. *   (C) Copyright Taligent, Inc.,  1996                                                 *
  6. *   (C) Copyright International Business Machines Corporation,  1996-1999               *
  7. *   Licensed Material - Program-Property of IBM - All Rights Reserved.                  *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure             *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                              *
  10. *                                                                                       *
  11. *****************************************************************************************
  12. */
  13. // $Revision: 1.3 $
  14. //===============================================================================
  15. //
  16. // File locmap.hpp      : Locale Mapping Classes
  17. //
  18. // 
  19. //
  20. // Created by: Helena Shih
  21. //
  22. // Modification History:
  23. //
  24. //  Date        Name        Description
  25. //  3/11/97     aliu        Added setId().
  26. //  4/20/99     Madhu       Added T_convertToPosix()
  27. //===============================================================================
  28. #ifndef LOCMAP_H
  29. #define LOCMAP_H
  30.  
  31. #include "utypes.h"
  32. #ifdef XP_CPLUSPLUS
  33. class Locale;
  34. /////////////////////////////////////////////////
  35. //
  36. // Internal Classes for LCID <--> POSIX Mapping
  37. //
  38. /////////////////////////////////////////////////
  39.  
  40. class ILcidPosixElement
  41. {
  42. public:
  43.   ILcidPosixElement(uint32_t, const char*);
  44.  
  45.   ILcidPosixElement();
  46.   ILcidPosixElement(const ILcidPosixElement&);
  47.   ILcidPosixElement& operator=(const ILcidPosixElement&);
  48.  
  49.   ~ILcidPosixElement();
  50.  
  51. private:
  52.   int32_t setId(const char* id);
  53.   enum { MAX_ID_LENGTH = 8 };
  54.  
  55.   uint32_t fHostID;
  56.   char fPosixID[MAX_ID_LENGTH];
  57.  
  58.   friend class ILcidPosixMap;
  59. };
  60.  
  61. class ILcidPosixMap
  62. {
  63. public:
  64.  
  65.   ILcidPosixMap();
  66.   void initialize (uint32_t hostID,
  67.                    const char* posixID,
  68.                    uint32_t totalNumberOfRegions = 1);
  69.  
  70.   ~ILcidPosixMap();
  71.  
  72.   void addRegion (uint32_t hostID,
  73.                   const char* posixID);
  74.  
  75.   uint16_t hostLangID(void) const
  76.   { return fHostLangID; };
  77.  
  78.   const char* posixLangID(void) const
  79.   { return fPosixLangID; };
  80.  
  81.   uint32_t hostID(const char* fromPosixID) const;
  82.   const char* posixID(uint32_t fromHostID) const;
  83.  
  84.   static const char* fgWildCard;
  85.  
  86.  
  87. private:
  88.   ILcidPosixMap(const ILcidPosixMap&);
  89.   ILcidPosixMap& operator=(const ILcidPosixMap&);
  90.  
  91.   uint16_t fHostLangID;
  92.   char fPosixLangID[3];
  93.  
  94.   ILcidPosixElement* fRegionMaps;
  95.   uint32_t fMapSize;
  96.   uint32_t fNumRegions;
  97. };
  98.  
  99. //
  100.  
  101. class IGlobalLocales {
  102.     public:
  103.                 static void                  initializeMapRegions(void);
  104.                 static const char*         convertToPosix(uint32_t hostid);
  105.                 static uint32_t              convertToLCID(const char* posixID);
  106.                 static uint16_t              languageLCID(uint32_t hostID);
  107.     protected:
  108.                 IGlobalLocales() { }
  109.                 IGlobalLocales(const IGlobalLocales& that) { }
  110.                 IGlobalLocales& operator=(const IGlobalLocales& that) { return *this;}
  111. private:
  112.  
  113.                 static int32_t                  fgLocaleCount;
  114.                 static uint32_t                 fgStdLang;
  115.                 static const    uint32_t        kMapSize;
  116.                 static ILcidPosixMap *          fgPosixIDmap;
  117.         
  118.     protected:
  119.                 ~IGlobalLocales() { }
  120. };
  121.  
  122. #else
  123.  U_CAPI const char* U_EXPORT2 T_convertToPosix(uint32_t hostid);
  124. #endif
  125. #endif
  126.  
  127.  
  128.  
  129.