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