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