]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/csmatch.h
ICU-64243.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / csmatch.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
73c04bcf
A
3/*
4 **********************************************************************
51004dcb 5 * Copyright (C) 2005-2012, International Business Machines
73c04bcf
A
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 */
9
10#ifndef __CSMATCH_H
11#define __CSMATCH_H
12
13#include "unicode/uobject.h"
14
15#if !UCONFIG_NO_CONVERSION
16
17U_NAMESPACE_BEGIN
18
19class InputText;
20class CharsetRecognizer;
21
51004dcb
A
22/*
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
25 * are at least legal.
26 *
27 * The full results of a detect are represented by an array of these
28 * CharsetMatch objects, each representing a possible matching charset.
29 *
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.
32 */
73c04bcf
A
33class CharsetMatch : public UMemory
34{
35 private:
51004dcb
A
36 InputText *textIn;
37 int32_t confidence;
38 const char *fCharsetName;
39 const char *fLang;
73c04bcf
A
40
41 public:
42 CharsetMatch();
43
51004dcb
A
44 /**
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.
49 */
50 void set(InputText *input,
51 const CharsetRecognizer *cr,
52 int32_t conf,
53 const char *csName=NULL,
54 const char *lang=NULL);
73c04bcf 55
51004dcb
A
56 /**
57 * Return the name of the charset for this Match
58 */
59 const char *getName() const;
73c04bcf
A
60
61 const char *getLanguage()const;
62
63 int32_t getConfidence()const;
64
65 int32_t getUChars(UChar *buf, int32_t cap, UErrorCode *status) const;
66};
67
68U_NAMESPACE_END
69
70#endif
71#endif /* __CSMATCH_H */