2006-02-06 18:03:11 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
|
|
|
* Copyright (C) 2005-2006, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CSDETECT_H
|
|
|
|
#define __CSDETECT_H
|
|
|
|
|
|
|
|
#include "unicode/uobject.h"
|
|
|
|
|
2006-05-09 18:06:10 +00:00
|
|
|
#if !UCONFIG_NO_CONVERSION
|
|
|
|
|
2006-02-06 18:03:11 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class InputText;
|
|
|
|
class CharsetRecognizer;
|
2006-02-06 20:45:30 +00:00
|
|
|
class CharsetMatch;
|
2006-02-06 18:03:11 +00:00
|
|
|
|
2006-02-06 20:45:30 +00:00
|
|
|
class CharsetDetector : public UMemory
|
2006-02-06 18:03:11 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
InputText *textIn;
|
2006-02-06 20:45:30 +00:00
|
|
|
CharsetMatch **resultArray;
|
2006-02-07 20:24:16 +00:00
|
|
|
int32_t resultCount;
|
2006-02-06 18:03:11 +00:00
|
|
|
UBool fStripTags; // If true, setText() will strip tags from input text.
|
|
|
|
UBool fFreshTextSet;
|
|
|
|
static void setRecognizers();
|
|
|
|
|
|
|
|
public:
|
2006-02-06 20:45:30 +00:00
|
|
|
CharsetDetector();
|
2006-02-06 18:03:11 +00:00
|
|
|
|
2006-02-06 20:45:30 +00:00
|
|
|
~CharsetDetector();
|
2006-02-06 18:03:11 +00:00
|
|
|
|
|
|
|
void setText(const char *in, int32_t len);
|
|
|
|
|
2006-02-06 20:45:30 +00:00
|
|
|
const CharsetMatch * const *detectAll(int32_t &maxMatchesFound, UErrorCode &status);
|
2006-02-06 18:03:11 +00:00
|
|
|
|
2006-02-06 20:45:30 +00:00
|
|
|
const CharsetMatch *detect(UErrorCode& status);
|
2006-02-06 18:03:11 +00:00
|
|
|
|
|
|
|
void setDeclaredEncoding(const char *encoding, int32_t len) const;
|
|
|
|
|
|
|
|
UBool setStripTagsFlag(UBool flag);
|
|
|
|
|
|
|
|
UBool getStripTagsFlag() const;
|
|
|
|
|
|
|
|
const char *getCharsetName(int32_t index, UErrorCode& status) const;
|
|
|
|
|
|
|
|
static int32_t getDetectableCount();
|
|
|
|
};
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2006-05-09 18:06:10 +00:00
|
|
|
#endif
|
2006-02-06 18:03:11 +00:00
|
|
|
#endif /* __CSDETECT_H */
|