Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MODMED
modmedLog
Commits
3a1fae1e
Commit
3a1fae1e
authored
Aug 01, 2018
by
EXT Arnaud Clère
Browse files
Fixed QDataStream QString's utf8 to utf16 and unfair benchmarks
parent
37429af5
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/QBind/QDataStream_impl.h
View file @
3a1fae1e
...
...
@@ -67,6 +67,7 @@ protected:
bool
_record
(
quint32
*
cols
=
nullptr
)
{
Q_UNUSED
(
cols
)
;
return
true
;
}
bool
_null
(
)
{
return
true
;
}
bool
_bind
(
const
char
*
s
)
{
*
io
<<
s
;
return
true
;
}
bool
_bind
(
QString
&
s
)
{
*
io
<<
s
;
return
true
;
}
bool
_bind
(
bool
&
b
)
{
*
io
<<
b
;
return
true
;
}
bool
_bind
(
float
&
f
)
{
*
io
<<
f
;
return
true
;
}
bool
_bind
(
double
&
d
)
{
*
io
<<
d
;
return
true
;
}
...
...
@@ -84,6 +85,7 @@ private:
QDataStream
*
io
;
};
template
<
>
struct
BindSupport
<
DataStreamWriter
,
const
char
*>
:
BindNative
{};
template
<
>
struct
BindSupport
<
DataStreamWriter
,
QString
&>
:
BindNative
{};
template
<
>
struct
BindSupport
<
DataStreamWriter
,
bool
&>
:
BindNative
{};
template
<
>
struct
BindSupport
<
DataStreamWriter
,
float
&>
:
BindNative
{};
template
<
>
struct
BindSupport
<
DataStreamWriter
,
double
&>
:
BindNative
{};
...
...
tests/QBind/main.cpp
View file @
3a1fae1e
...
...
@@ -247,9 +247,8 @@ int main()
START
{
b
.
seek
(
0
);
b
.
buffer
().
clear
();
QDataStream
data
(
&
b
);
data
<<
'['
;
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
data
<<
' '
<<
transform
[
i
];
data
<<
transform
[
i
];
};
}
STOP
(
"QDataStream"
,
QString
::
fromUtf8
(
b
.
buffer
().
toHex
()));
...
...
@@ -299,13 +298,12 @@ int main()
{
START
{
b
.
seek
(
0
);
b
.
buffer
().
clear
();
QDataStream
(
&
b
)
<<
'['
<<
' '
<<
person
.
firstName
.
constData
()
<<
' '
<<
person
.
lastName
.
constData
()
<<
' '
<<
person
.
height
<<
' '
<<
person
.
age
<<
' '
<<
person
.
phones
<<
']'
QDataStream
(
&
b
)
<<
person
.
firstName
.
constData
()
<<
person
.
lastName
.
constData
()
<<
person
.
height
<<
person
.
age
<<
person
.
phones
;
}
STOP
(
"QDataStream"
,
QString
::
fromUtf8
(
b
.
buffer
().
toHex
()));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment