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