1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (C) 2005-2012, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
13 #include "unicode/uobject.h"
15 #if !UCONFIG_NO_CONVERSION
20 class CharsetRecognizer;
23 * CharsetMatch represents the results produced by one Charset Recognizer for one input text
24 * Any confidence > 0 indicates a possible match, meaning that the input bytes
27 * The full results of a detect are represented by an array of these
28 * CharsetMatch objects, each representing a possible matching charset.
30 * Note that a single charset recognizer may detect multiple closely related
31 * charsets, and set different names depending on the exact input bytes seen.
33 class CharsetMatch : public UMemory
38 const char *fCharsetName;
45 * fully set the state of this CharsetMatch.
46 * Called by the CharsetRecognizers to record match results.
47 * Default (NULL) parameters for names will be filled by calling the
48 * corresponding getters on the recognizer.
50 void set(InputText *input,
51 const CharsetRecognizer *cr,
53 const char *csName=NULL,
54 const char *lang=NULL);
57 * Return the name of the charset for this Match
59 const char *getName() const;
61 const char *getLanguage()const;
63 int32_t getConfidence()const;
65 int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const;
71 #endif /* __CSMATCH_H */