BibleTime
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
Functions
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
v
Variables
a
b
c
d
g
h
i
k
l
m
p
r
s
u
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
w
Properties
Related Symbols
Files
File List
File Members
All
a
b
c
e
f
h
i
j
k
l
m
o
p
r
s
t
u
w
Functions
b
c
f
i
j
l
m
o
p
r
t
Variables
Typedefs
Enumerations
Enumerator
Macros
a
b
c
i
l
m
r
s
t
u
w
src
util
cp1252.cpp
Go to the documentation of this file.
1
/*********
2
*
3
* In the name of the Father, and of the Son, and of the Holy Spirit.
4
*
5
* This file is part of BibleTime's source code, https://bibletime.info/
6
*
7
* Copyright 1999-2025 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
9
* version 2.0.
10
*
11
**********/
12
13
#include "
cp1252.h
"
14
15
#include <QStringDecoder>
16
#include <QStringEncoder>
17
#include "
btassert.h
"
18
19
20
namespace
util
{
21
namespace
cp1252 {
22
23
QString
toUnicode
(QByteArray
const
& data) {
24
QStringDecoder decoder(
"Windows-1252"
, QStringDecoder::Flag::Stateless);
25
// Do not use auto here due to QTBUG-117705/QTBUG-117902:
26
QString result = decoder(data);
27
BT_ASSERT
(!decoder.hasError());
28
return
result;
29
}
23
QString
toUnicode
(QByteArray
const
& data) {
…
}
30
31
QByteArray
fromUnicode
(QString
const
& str) {
32
QStringEncoder encoder(
"Windows-1252"
, QStringEncoder::Flag::Stateless);
33
// Do not use auto here due to QTBUG-117705/QTBUG-117902:
34
QByteArray result = encoder(str);
35
BT_ASSERT
(!encoder.hasError());
36
return
result;
37
}
31
QByteArray
fromUnicode
(QString
const
& str) {
…
}
38
39
}
/* namespace cp1252 { */
21
namespace
cp1252 {
…
}
40
}
/* namespace util { */
20
namespace
util
{
…
}
btassert.h
BT_ASSERT
#define BT_ASSERT(...)
Definition
btassert.h:17
cp1252.h
util::cp1252::toUnicode
QString toUnicode(QByteArray const &data)
Definition
cp1252.cpp:23
util::cp1252::fromUnicode
QByteArray fromUnicode(QString const &str)
Definition
cp1252.cpp:31
util
Definition
cp1252.cpp:20
Generated by
1.9.8