michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (C) 2005-2013, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: */ michael@0: michael@0: #ifndef __CSDETECT_H michael@0: #define __CSDETECT_H michael@0: michael@0: #include "unicode/uobject.h" michael@0: michael@0: #if !UCONFIG_NO_CONVERSION michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: class InputText; michael@0: class CharsetRecognizer; michael@0: class CharsetMatch; michael@0: michael@0: class CharsetDetector : public UMemory michael@0: { michael@0: private: michael@0: InputText *textIn; michael@0: CharsetMatch **resultArray; michael@0: int32_t resultCount; michael@0: UBool fStripTags; // If true, setText() will strip tags from input text. michael@0: UBool fFreshTextSet; michael@0: static void setRecognizers(UErrorCode &status); michael@0: michael@0: UBool *fEnabledRecognizers; // If not null, active set of charset recognizers had michael@0: // been changed from the default. The array index is michael@0: // corresponding to fCSRecognizers. See setDetectableCharset(). michael@0: michael@0: public: michael@0: CharsetDetector(UErrorCode &status); michael@0: michael@0: ~CharsetDetector(); michael@0: michael@0: void setText(const char *in, int32_t len); michael@0: michael@0: const CharsetMatch * const *detectAll(int32_t &maxMatchesFound, UErrorCode &status); michael@0: michael@0: const CharsetMatch *detect(UErrorCode& status); michael@0: michael@0: void setDeclaredEncoding(const char *encoding, int32_t len) const; michael@0: michael@0: UBool setStripTagsFlag(UBool flag); michael@0: michael@0: UBool getStripTagsFlag() const; michael@0: michael@0: // const char *getCharsetName(int32_t index, UErrorCode& status) const; michael@0: michael@0: static int32_t getDetectableCount(); michael@0: michael@0: michael@0: static UEnumeration * getAllDetectableCharsets(UErrorCode &status); michael@0: UEnumeration * getDetectableCharsets(UErrorCode &status) const; michael@0: void setDetectableCharset(const char *encoding, UBool enabled, UErrorCode &status); michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif michael@0: #endif /* __CSDETECT_H */