blob: cef35447fb750b5d1b5d63f9059c50f195e6ae5c [file] [log] [blame]
Victor Chang73229502020-09-17 13:39:19 +01001// © 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
19U_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 */
27class CharsetRecog_Unicode : public CharsetRecognizer
28{
29
30public:
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
45class CharsetRecog_UTF_16_BE : public CharsetRecog_Unicode
46{
47public:
48
49 virtual ~CharsetRecog_UTF_16_BE();
50
51 const char *getName() const;
52
53 UBool match(InputText* textIn, CharsetMatch *results) const;
54};
55
56class CharsetRecog_UTF_16_LE : public CharsetRecog_Unicode
57{
58public:
59
60 virtual ~CharsetRecog_UTF_16_LE();
61
62 const char *getName() const;
63
64 UBool match(InputText* textIn, CharsetMatch *results) const;
65};
66
67class CharsetRecog_UTF_32 : public CharsetRecog_Unicode
68{
69protected:
70 virtual int32_t getChar(const uint8_t *input, int32_t index) const = 0;
71public:
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
81class CharsetRecog_UTF_32_BE : public CharsetRecog_UTF_32
82{
83protected:
84 int32_t getChar(const uint8_t *input, int32_t index) const;
85
86public:
87
88 virtual ~CharsetRecog_UTF_32_BE();
89
90 const char *getName() const;
91};
92
93
94class CharsetRecog_UTF_32_LE : public CharsetRecog_UTF_32
95{
96protected:
97 int32_t getChar(const uint8_t *input, int32_t index) const;
98
99public:
100 virtual ~CharsetRecog_UTF_32_LE();
101
102 const char* getName() const;
103};
104
105U_NAMESPACE_END
106
107#endif
108#endif /* __CSRUCODE_H */