michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (C) 2005-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: */ michael@0: michael@0: #ifndef __CSMATCH_H michael@0: #define __CSMATCH_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: michael@0: /* michael@0: * CharsetMatch represents the results produced by one Charset Recognizer for one input text michael@0: * Any confidence > 0 indicates a possible match, meaning that the input bytes michael@0: * are at least legal. michael@0: * michael@0: * The full results of a detect are represented by an array of these michael@0: * CharsetMatch objects, each representing a possible matching charset. michael@0: * michael@0: * Note that a single charset recognizer may detect multiple closely related michael@0: * charsets, and set different names depending on the exact input bytes seen. michael@0: */ michael@0: class CharsetMatch : public UMemory michael@0: { michael@0: private: michael@0: InputText *textIn; michael@0: int32_t confidence; michael@0: const char *fCharsetName; michael@0: const char *fLang; michael@0: michael@0: public: michael@0: CharsetMatch(); michael@0: michael@0: /** michael@0: * fully set the state of this CharsetMatch. michael@0: * Called by the CharsetRecognizers to record match results. michael@0: * Default (NULL) parameters for names will be filled by calling the michael@0: * corresponding getters on the recognizer. michael@0: */ michael@0: void set(InputText *input, michael@0: const CharsetRecognizer *cr, michael@0: int32_t conf, michael@0: const char *csName=NULL, michael@0: const char *lang=NULL); michael@0: michael@0: /** michael@0: * Return the name of the charset for this Match michael@0: */ michael@0: const char *getName() const; michael@0: michael@0: const char *getLanguage()const; michael@0: michael@0: int32_t getConfidence()const; michael@0: michael@0: int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const; michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif michael@0: #endif /* __CSMATCH_H */