home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / i18n / unicdcm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  2.9 KB  |  79 lines

  1. /*
  2. *****************************************************************************************
  3. *                                                                                       *
  4. * COPYRIGHT:                                                                            *
  5. *   (C) Copyright Taligent, Inc.,  1997                                                 *
  6. *   (C) Copyright International Business Machines Corporation,  1997-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. * File UNICDCM.H
  14. *
  15. * UnicodeClassMapping maps characters to state change inputs for WordBreakTable.
  16. *
  17. * @package  Text and International
  18. * @category Text Scanning
  19. *
  20. * Modification History:
  21. *
  22. *   Date        Name        Description
  23. *   02/18/97    aliu        Converted from OpenClass.
  24. *   05/06/97    aliu        Made SpecialMapping an array of objects instead of pointers,
  25. *                           to help out non-compliant compilers.
  26. *****************************************************************************************
  27. */
  28.  
  29. #ifndef UNICDCM_H
  30. #define UNICDCM_H
  31.  
  32. #include "spclmap.h"
  33. #include "unicode.h"
  34.  
  35. /**
  36.  * This class maps characters to state change inputs for
  37.  * WordBreakTable.  If the character appears in the exception list,
  38.  * the mapping there is retuned, otherwise the mapping returned by
  39.  * IUnicode::type is returned.
  40.  *
  41.  * Note in this implementation characters from 0x0040 to 0x009f always use the
  42.  * mapping returned by IUnicode::type and never the exception list.
  43.  */
  44. class UnicodeClassMapping {
  45. public:
  46.     // For convenience
  47.     typedef TextBoundaryData::Type Type;
  48.  
  49.     /**
  50.      * Create a mapping given a mapping from categories and a list
  51.      * of exceptions.  Both the mapping list and exceptionChars list must
  52.      * be sorted in ascending order.
  53.      */
  54.     UnicodeClassMapping(Type* mappedValue, 
  55.             int32_t mappedValue_length,
  56.                         const SpecialMapping* exceptionChars, 
  57.             int32_t exceptionChars_length,
  58.                         const bool_t* hasException,
  59.                         Type* asiiValues );
  60.     
  61.     /**
  62.      * Map a character to a state change input for WordBreakTable.
  63.      * @param ch the character to map.
  64.      * @return the mapped value.
  65.      */
  66.     Type mappedChar(UChar ch) const;
  67.  
  68. private:
  69.     const bool_t            *fHasException;
  70.     const Type*             fMappedValue;
  71.     const int32_t           fMappedValue_length;
  72.     const SpecialMapping*   fExceptionChars;
  73.     const int32_t           fExceptionChars_length;
  74.     const Type*             fAsciiValues;
  75. };
  76.  
  77. #endif // _UNICDCM
  78. //eof
  79.