]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/csdetect.h
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / csdetect.h
1 /*
2 **********************************************************************
3 * Copyright (C) 2005-2016, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
7
8 #ifndef __CSDETECT_H
9 #define __CSDETECT_H
10
11 #include "unicode/uobject.h"
12
13 #if !UCONFIG_NO_CONVERSION
14
15 #include "unicode/uenum.h"
16
17 U_NAMESPACE_BEGIN
18
19 class InputText;
20 class CharsetRecognizer;
21 class CharsetMatch;
22
23 class CharsetDetector : public UMemory
24 {
25 private:
26 InputText *textIn;
27 CharsetMatch **resultArray;
28 int32_t resultCount;
29 UBool fStripTags; // If true, setText() will strip tags from input text.
30 UBool fFreshTextSet;
31 static void setRecognizers(UErrorCode &status);
32
33 UBool *fEnabledRecognizers; // If not null, active set of charset recognizers had
34 // been changed from the default. The array index is
35 // corresponding to fCSRecognizers. See setDetectableCharset().
36
37 public:
38 CharsetDetector(UErrorCode &status);
39
40 ~CharsetDetector();
41
42 void setText(const char *in, int32_t len);
43
44 const CharsetMatch * const *detectAll(int32_t &maxMatchesFound, UErrorCode &status);
45
46 const CharsetMatch *detect(UErrorCode& status);
47
48 void setDeclaredEncoding(const char *encoding, int32_t len) const;
49
50 UBool setStripTagsFlag(UBool flag);
51
52 UBool getStripTagsFlag() const;
53
54 // const char *getCharsetName(int32_t index, UErrorCode& status) const;
55
56 static int32_t getDetectableCount();
57
58
59 static UEnumeration * getAllDetectableCharsets(UErrorCode &status);
60 UEnumeration * getDetectableCharsets(UErrorCode &status) const;
61 void setDetectableCharset(const char *encoding, UBool enabled, UErrorCode &status);
62 };
63
64 U_NAMESPACE_END
65
66 #endif
67 #endif /* __CSDETECT_H */