/
mcharsetmatch.h
178 lines (156 loc) · 4.94 KB
/
mcharsetmatch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/***************************************************************************
**
** Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef ML10N_MCHARSETMATCH_H
#define ML10N_MCHARSETMATCH_H
#include "mlocaleexport.h"
#include <QString>
namespace ML10N {
class MCharsetMatchPrivate;
/*!
* \class MCharsetMatch
*
* \brief class representing a match obtained from MCharsetDetector
*
*/
class MLOCALE_EXPORT MCharsetMatch
{
public:
/*!
* \brief constructor for MCharsetMatch
*/
MCharsetMatch();
/*!
* \brief constructor for MCharsetMatch
* \param name name of the charset. For example "UTF-8", "ISO-8859-1", ...
* \param language RFC 3066 code of the language like "en", "zh", ...
* \param confidence number between 0 and 100 for the quality of the match
*
* Constructs an MCharsetMatch object setting a name of the
* charset a language, and a confidence.
*/
explicit MCharsetMatch(const QString name, const QString language = QString(), const qint32 confidence = 0);
/*!
* \brief copy constructor for MCharsetMatch
*/
MCharsetMatch(const MCharsetMatch &other);
/*!
* \brief destructor for MCharsetMatch
*/
virtual ~MCharsetMatch();
/*!
* \brief operator= for MCharsetMatch
*/
MCharsetMatch &operator=(const MCharsetMatch &other);
/*!
* \brief operator< for MCharsetMatch
*
* A MCharsetMatch object is less than another MCharsetMatch
* object if its confidence value is less than the confidence
* value of the other object.
*
* \sa confidence()
*/
bool operator<(const MCharsetMatch &other) const;
/*!
* \brief operator> for MCharsetMatch
*
* A MCharsetMatch object is greater than another MCharsetMatch
* object if its confidence value is greater than the confidence
* value of the other object.
*
* \sa confidence()
*/
bool operator>(const MCharsetMatch &other) const;
/*!
* \brief name of the detected charset of this match
*
* returns the name of the charset of the match represented
* by this MCharsetMatch object.
*
* \sa setName(QString name)
*/
QString name() const;
/*!
* \brief sets the name of the detected charset for this match
*
* sets the name of the charset of the match represented by this
* MCharsetMatch object. In most cases only used by MCharsetDetector
* when storing the matches found.
*
* \sa name()
*/
void setName(QString name);
/*!
* \brief detected language of this match
*
* returns the detected language of the match represented
* by this MCharsetMatch object.
*
* \sa setLanguage(QString language)
*/
QString language() const;
/*!
* \brief sets the detected language for this match
*
* sets the detected language of the match represented by this
* MCharsetMatch object. In most cases only used by
* MCharsetDetector when storing the matches found.
*
* \sa language()
*/
void setLanguage(QString language);
/*!
* \brief confidence level of this match
*
* returns the confidence level of the match represented by this
* MCharsetMatch object.
*
* Confidence numbers range from zero to 100, with 100
* representing complete confidence and zero representing no
* confidence.
*
* The confidence values are somewhat arbitrary. They define an an
* ordering within the results for any single detection operation
* but are not generally comparable between the results for
* different input.
*
* A confidence value of 10 does have a general meaning — it is
* used for charsets that can represent the input data, but for
* which there is no other indication that suggests that the
* charset is the correct one.
*
* \sa setConfidence()
*/
qint32 confidence() const;
/*!
* \brief sets the confidence level for this match
*
* sets the confidece level of the match represented by this
* MCharsetMatch object. In most cases only used by
* MCharsetDetector when storing the matches found.
*
* \sa confidence()
*/
void setConfidence(qint32 confidence);
private:
MCharsetMatchPrivate *const d_ptr;
Q_DECLARE_PRIVATE(MCharsetMatch)
};
}
#endif