Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_text_qbytearrayview.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QtCore/qbytearrayview.h>
4
6 void myfun1(QByteArrayView bv); // preferred
7 void myfun2(const QByteArrayView &bv); // compiles and works, but slower
9
12 void fun(char ch) { fun(QByteArrayView(&ch, 1)); }
14
17bool ok;
18int hex = str.toInt(&ok, 16); // hex == 255, ok == true
19int dec = str.toInt(&ok, 10); // dec == 0, ok == false
21
24bool ok;
25long hex = str.toLong(&ok, 16); // hex == 255, ok == true
26long dec = str.toLong(&ok, 10); // dec == 0, ok == false
28
30QByteArrayView string("1234.56 Volt");
31bool ok;
32float a = str.toFloat(&ok); // a == 0, ok == false
33a = string.first(7).toFloat(&ok); // a == 1234.56, ok == true
int toInt(bool *ok=nullptr, int base=10) const
float toFloat(bool *ok=nullptr) const
long toLong(bool *ok=nullptr, int base=10) const
GLboolean GLboolean GLboolean GLboolean a
[7]
QByteArrayView str("FF")
[1]
QByteArrayView string("1234.56 Volt")
[3]
void myfun1(QByteArrayView bv)
[0]
void myfun2(const QByteArrayView &bv)
QJSValue fun
[0]