Home | History | Annotate | Download | only in i18n
      1 /*
      2  **********************************************************************
      3  *   Copyright (C) 2005-2012, International Business Machines
      4  *   Corporation and others.  All Rights Reserved.
      5  **********************************************************************
      6  */
      7 
      8 #ifndef __CSRUCODE_H
      9 #define __CSRUCODE_H
     10 
     11 #include "unicode/utypes.h"
     12 
     13 #if !UCONFIG_NO_CONVERSION
     14 
     15 #include "csrecog.h"
     16 
     17 U_NAMESPACE_BEGIN
     18 
     19 /**
     20  * This class matches UTF-16 and UTF-32, both big- and little-endian. The
     21  * BOM will be used if it is present.
     22  *
     23  * @internal
     24  */
     25 class CharsetRecog_Unicode : public CharsetRecognizer
     26 {
     27 
     28 public:
     29 
     30     virtual ~CharsetRecog_Unicode();
     31     /* (non-Javadoc)
     32      * @see com.ibm.icu.text.CharsetRecognizer#getName()
     33      */
     34     const char* getName() const = 0;
     35 
     36     /* (non-Javadoc)
     37      * @see com.ibm.icu.text.CharsetRecognizer#match(com.ibm.icu.text.CharsetDetector)
     38      */
     39     UBool match(InputText* textIn, CharsetMatch *results) const = 0;
     40 };
     41 
     42 
     43 class CharsetRecog_UTF_16_BE : public CharsetRecog_Unicode
     44 {
     45 public:
     46 
     47     virtual ~CharsetRecog_UTF_16_BE();
     48 
     49     const char *getName() const;
     50 
     51     UBool match(InputText* textIn, CharsetMatch *results) const;
     52 };
     53 
     54 class CharsetRecog_UTF_16_LE : public CharsetRecog_Unicode
     55 {
     56 public:
     57 
     58     virtual ~CharsetRecog_UTF_16_LE();
     59 
     60     const char *getName() const;
     61 
     62     UBool match(InputText* textIn, CharsetMatch *results) const;
     63 };
     64 
     65 class CharsetRecog_UTF_32 : public CharsetRecog_Unicode
     66 {
     67 protected:
     68     virtual int32_t getChar(const uint8_t *input, int32_t index) const = 0;
     69 public:
     70 
     71     virtual ~CharsetRecog_UTF_32();
     72 
     73     const char* getName() const = 0;
     74 
     75     UBool match(InputText* textIn, CharsetMatch *results) const;
     76 };
     77 
     78 
     79 class CharsetRecog_UTF_32_BE : public CharsetRecog_UTF_32
     80 {
     81 protected:
     82     int32_t getChar(const uint8_t *input, int32_t index) const;
     83 
     84 public:
     85 
     86     virtual ~CharsetRecog_UTF_32_BE();
     87 
     88     const char *getName() const;
     89 };
     90 
     91 
     92 class CharsetRecog_UTF_32_LE : public CharsetRecog_UTF_32
     93 {
     94 protected:
     95     int32_t getChar(const uint8_t *input, int32_t index) const;
     96 
     97 public:
     98     virtual ~CharsetRecog_UTF_32_LE();
     99 
    100     const char* getName() const;
    101 };
    102 
    103 U_NAMESPACE_END
    104 
    105 #endif
    106 #endif /* __CSRUCODE_H */
    107