Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 **********************************************************************
3 * Copyright (C) 2005-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 */
8 #ifndef __CSMATCH_H
9 #define __CSMATCH_H
11 #include "unicode/uobject.h"
13 #if !UCONFIG_NO_CONVERSION
15 U_NAMESPACE_BEGIN
17 class InputText;
18 class CharsetRecognizer;
20 /*
21 * CharsetMatch represents the results produced by one Charset Recognizer for one input text
22 * Any confidence > 0 indicates a possible match, meaning that the input bytes
23 * are at least legal.
24 *
25 * The full results of a detect are represented by an array of these
26 * CharsetMatch objects, each representing a possible matching charset.
27 *
28 * Note that a single charset recognizer may detect multiple closely related
29 * charsets, and set different names depending on the exact input bytes seen.
30 */
31 class CharsetMatch : public UMemory
32 {
33 private:
34 InputText *textIn;
35 int32_t confidence;
36 const char *fCharsetName;
37 const char *fLang;
39 public:
40 CharsetMatch();
42 /**
43 * fully set the state of this CharsetMatch.
44 * Called by the CharsetRecognizers to record match results.
45 * Default (NULL) parameters for names will be filled by calling the
46 * corresponding getters on the recognizer.
47 */
48 void set(InputText *input,
49 const CharsetRecognizer *cr,
50 int32_t conf,
51 const char *csName=NULL,
52 const char *lang=NULL);
54 /**
55 * Return the name of the charset for this Match
56 */
57 const char *getName() const;
59 const char *getLanguage()const;
61 int32_t getConfidence()const;
63 int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const;
64 };
66 U_NAMESPACE_END
68 #endif
69 #endif /* __CSMATCH_H */