Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /*
2 **********************************************************************
3 * Copyright (C) 2005-2013, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
8 #ifndef __CSDETECT_H
9 #define __CSDETECT_H
11 #include "unicode/uobject.h"
13 #if !UCONFIG_NO_CONVERSION
15 U_NAMESPACE_BEGIN
17 class InputText;
18 class CharsetRecognizer;
19 class CharsetMatch;
21 class CharsetDetector : public UMemory
22 {
23 private:
24 InputText *textIn;
25 CharsetMatch **resultArray;
26 int32_t resultCount;
27 UBool fStripTags; // If true, setText() will strip tags from input text.
28 UBool fFreshTextSet;
29 static void setRecognizers(UErrorCode &status);
31 UBool *fEnabledRecognizers; // If not null, active set of charset recognizers had
32 // been changed from the default. The array index is
33 // corresponding to fCSRecognizers. See setDetectableCharset().
35 public:
36 CharsetDetector(UErrorCode &status);
38 ~CharsetDetector();
40 void setText(const char *in, int32_t len);
42 const CharsetMatch * const *detectAll(int32_t &maxMatchesFound, UErrorCode &status);
44 const CharsetMatch *detect(UErrorCode& status);
46 void setDeclaredEncoding(const char *encoding, int32_t len) const;
48 UBool setStripTagsFlag(UBool flag);
50 UBool getStripTagsFlag() const;
52 // const char *getCharsetName(int32_t index, UErrorCode& status) const;
54 static int32_t getDetectableCount();
57 static UEnumeration * getAllDetectableCharsets(UErrorCode &status);
58 UEnumeration * getDetectableCharsets(UErrorCode &status) const;
59 void setDetectableCharset(const char *encoding, UBool enabled, UErrorCode &status);
60 };
62 U_NAMESPACE_END
64 #endif
65 #endif /* __CSDETECT_H */