1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/csmatch.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* 1.5 + ********************************************************************** 1.6 + * Copyright (C) 2005-2012, International Business Machines 1.7 + * Corporation and others. All Rights Reserved. 1.8 + ********************************************************************** 1.9 + */ 1.10 + 1.11 +#ifndef __CSMATCH_H 1.12 +#define __CSMATCH_H 1.13 + 1.14 +#include "unicode/uobject.h" 1.15 + 1.16 +#if !UCONFIG_NO_CONVERSION 1.17 + 1.18 +U_NAMESPACE_BEGIN 1.19 + 1.20 +class InputText; 1.21 +class CharsetRecognizer; 1.22 + 1.23 +/* 1.24 + * CharsetMatch represents the results produced by one Charset Recognizer for one input text 1.25 + * Any confidence > 0 indicates a possible match, meaning that the input bytes 1.26 + * are at least legal. 1.27 + * 1.28 + * The full results of a detect are represented by an array of these 1.29 + * CharsetMatch objects, each representing a possible matching charset. 1.30 + * 1.31 + * Note that a single charset recognizer may detect multiple closely related 1.32 + * charsets, and set different names depending on the exact input bytes seen. 1.33 + */ 1.34 +class CharsetMatch : public UMemory 1.35 +{ 1.36 + private: 1.37 + InputText *textIn; 1.38 + int32_t confidence; 1.39 + const char *fCharsetName; 1.40 + const char *fLang; 1.41 + 1.42 + public: 1.43 + CharsetMatch(); 1.44 + 1.45 + /** 1.46 + * fully set the state of this CharsetMatch. 1.47 + * Called by the CharsetRecognizers to record match results. 1.48 + * Default (NULL) parameters for names will be filled by calling the 1.49 + * corresponding getters on the recognizer. 1.50 + */ 1.51 + void set(InputText *input, 1.52 + const CharsetRecognizer *cr, 1.53 + int32_t conf, 1.54 + const char *csName=NULL, 1.55 + const char *lang=NULL); 1.56 + 1.57 + /** 1.58 + * Return the name of the charset for this Match 1.59 + */ 1.60 + const char *getName() const; 1.61 + 1.62 + const char *getLanguage()const; 1.63 + 1.64 + int32_t getConfidence()const; 1.65 + 1.66 + int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const; 1.67 +}; 1.68 + 1.69 +U_NAMESPACE_END 1.70 + 1.71 +#endif 1.72 +#endif /* __CSMATCH_H */