]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/csr2022.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (C) 2005-2015, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_CONVERSION
24 * class CharsetRecog_2022 part of the ICU charset detection imlementation.
25 * This is a superclass for the individual detectors for
26 * each of the detectable members of the ISO 2022 family
29 * The separate classes are nested within this class.
33 class CharsetRecog_2022
: public CharsetRecognizer
37 virtual ~CharsetRecog_2022() = 0;
42 * Matching function shared among the 2022 detectors JP, CN and KR
43 * Counts up the number of legal an unrecognized escape sequences in
44 * the sample of text, and computes a score based on the total number &
45 * the proportion that fit the encoding.
48 * @param text the byte buffer containing text to analyse
49 * @param textLen the size of the text in the byte.
50 * @param escapeSequences the byte escape sequences to test for.
51 * @return match quality, in the range of 0-100.
53 int32_t match_2022(const uint8_t *text
,
55 const uint8_t escapeSequences
[][5],
56 int32_t escapeSequences_length
) const;
60 class CharsetRecog_2022JP
:public CharsetRecog_2022
63 virtual ~CharsetRecog_2022JP();
65 const char *getName() const;
67 UBool
match(InputText
*textIn
, CharsetMatch
*results
) const;
70 #if !UCONFIG_ONLY_HTML_CONVERSION
71 class CharsetRecog_2022KR
:public CharsetRecog_2022
{
73 virtual ~CharsetRecog_2022KR();
75 const char *getName() const;
77 UBool
match(InputText
*textIn
, CharsetMatch
*results
) const;
81 class CharsetRecog_2022CN
:public CharsetRecog_2022
84 virtual ~CharsetRecog_2022CN();
86 const char* getName() const;
88 UBool
match(InputText
*textIn
, CharsetMatch
*results
) const;
95 #endif /* __CSR2022_H */