csrucode.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. **********************************************************************
  5. * Copyright (C) 2005-2012, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. **********************************************************************
  8. */
  9. #ifndef __CSRUCODE_H
  10. #define __CSRUCODE_H
  11. #include "unicode/utypes.h"
  12. #if !UCONFIG_NO_CONVERSION
  13. #include "csrecog.h"
  14. U_NAMESPACE_BEGIN
  15. /**
  16. * This class matches UTF-16 and UTF-32, both big- and little-endian. The
  17. * BOM will be used if it is present.
  18. *
  19. * @internal
  20. */
  21. class CharsetRecog_Unicode : public CharsetRecognizer
  22. {
  23. public:
  24. virtual ~CharsetRecog_Unicode();
  25. /* (non-Javadoc)
  26. * @see com.ibm.icu.text.CharsetRecognizer#getName()
  27. */
  28. const char* getName() const = 0;
  29. /* (non-Javadoc)
  30. * @see com.ibm.icu.text.CharsetRecognizer#match(com.ibm.icu.text.CharsetDetector)
  31. */
  32. UBool match(InputText* textIn, CharsetMatch *results) const = 0;
  33. };
  34. class CharsetRecog_UTF_16_BE : public CharsetRecog_Unicode
  35. {
  36. public:
  37. virtual ~CharsetRecog_UTF_16_BE();
  38. const char *getName() const;
  39. UBool match(InputText* textIn, CharsetMatch *results) const;
  40. };
  41. class CharsetRecog_UTF_16_LE : public CharsetRecog_Unicode
  42. {
  43. public:
  44. virtual ~CharsetRecog_UTF_16_LE();
  45. const char *getName() const;
  46. UBool match(InputText* textIn, CharsetMatch *results) const;
  47. };
  48. class CharsetRecog_UTF_32 : public CharsetRecog_Unicode
  49. {
  50. protected:
  51. virtual int32_t getChar(const uint8_t *input, int32_t index) const = 0;
  52. public:
  53. virtual ~CharsetRecog_UTF_32();
  54. const char* getName() const = 0;
  55. UBool match(InputText* textIn, CharsetMatch *results) const;
  56. };
  57. class CharsetRecog_UTF_32_BE : public CharsetRecog_UTF_32
  58. {
  59. protected:
  60. int32_t getChar(const uint8_t *input, int32_t index) const;
  61. public:
  62. virtual ~CharsetRecog_UTF_32_BE();
  63. const char *getName() const;
  64. };
  65. class CharsetRecog_UTF_32_LE : public CharsetRecog_UTF_32
  66. {
  67. protected:
  68. int32_t getChar(const uint8_t *input, int32_t index) const;
  69. public:
  70. virtual ~CharsetRecog_UTF_32_LE();
  71. const char* getName() const;
  72. };
  73. U_NAMESPACE_END
  74. #endif
  75. #endif /* __CSRUCODE_H */