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-2012, 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 __CSMATCH_H |
michael@0 | 9 | #define __CSMATCH_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 | |
michael@0 | 20 | /* |
michael@0 | 21 | * CharsetMatch represents the results produced by one Charset Recognizer for one input text |
michael@0 | 22 | * Any confidence > 0 indicates a possible match, meaning that the input bytes |
michael@0 | 23 | * are at least legal. |
michael@0 | 24 | * |
michael@0 | 25 | * The full results of a detect are represented by an array of these |
michael@0 | 26 | * CharsetMatch objects, each representing a possible matching charset. |
michael@0 | 27 | * |
michael@0 | 28 | * Note that a single charset recognizer may detect multiple closely related |
michael@0 | 29 | * charsets, and set different names depending on the exact input bytes seen. |
michael@0 | 30 | */ |
michael@0 | 31 | class CharsetMatch : public UMemory |
michael@0 | 32 | { |
michael@0 | 33 | private: |
michael@0 | 34 | InputText *textIn; |
michael@0 | 35 | int32_t confidence; |
michael@0 | 36 | const char *fCharsetName; |
michael@0 | 37 | const char *fLang; |
michael@0 | 38 | |
michael@0 | 39 | public: |
michael@0 | 40 | CharsetMatch(); |
michael@0 | 41 | |
michael@0 | 42 | /** |
michael@0 | 43 | * fully set the state of this CharsetMatch. |
michael@0 | 44 | * Called by the CharsetRecognizers to record match results. |
michael@0 | 45 | * Default (NULL) parameters for names will be filled by calling the |
michael@0 | 46 | * corresponding getters on the recognizer. |
michael@0 | 47 | */ |
michael@0 | 48 | void set(InputText *input, |
michael@0 | 49 | const CharsetRecognizer *cr, |
michael@0 | 50 | int32_t conf, |
michael@0 | 51 | const char *csName=NULL, |
michael@0 | 52 | const char *lang=NULL); |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * Return the name of the charset for this Match |
michael@0 | 56 | */ |
michael@0 | 57 | const char *getName() const; |
michael@0 | 58 | |
michael@0 | 59 | const char *getLanguage()const; |
michael@0 | 60 | |
michael@0 | 61 | int32_t getConfidence()const; |
michael@0 | 62 | |
michael@0 | 63 | int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const; |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | U_NAMESPACE_END |
michael@0 | 67 | |
michael@0 | 68 | #endif |
michael@0 | 69 | #endif /* __CSMATCH_H */ |