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
qtestdata.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTESTDATA_H
5#define QTESTDATA_H
6
7#include <QtTest/qttestglobal.h>
8
9#include <QtCore/qmetatype.h>
10#include <QtCore/qstring.h>
11
13
14
15class QTestTable;
17
18class Q_TESTLIB_EXPORT QTestData
19{
20public:
21 ~QTestData();
22
23 void append(int type, const void *data);
24 void *data(int index) const;
25 const char *dataTag() const;
26 QTestTable *parent() const;
27 int dataCount() const;
28
29private:
30 friend class QTestTable;
31 QTestData(const char *tag, QTestTable *parent);
32
33 Q_DISABLE_COPY(QTestData)
34
36};
37
38template<typename T>
40{
41 data.append(qMetaTypeId<T>(), &value);
42 return data;
43}
44
45inline QTestData &operator<<(QTestData &data, const char * value)
46{
48 data.append(QMetaType::QString, &str);
49 return data;
50}
51
52#ifdef __cpp_char8_t
54inline QTestData &operator<<(QTestData &data, const char8_t *value)
55{
56 return data << reinterpret_cast<const char *>(value);
57}
58#endif
59
60#ifdef QT_USE_QSTRINGBUILDER
61template<typename A, typename B>
62inline QTestData &operator<<(QTestData &data, const QStringBuilder<A, B> &value)
63{
64 return data << typename QConcatenable<QStringBuilder<A, B> >::ConvertTo(value);
65}
66#endif
67
69
70#endif
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
void append(int type, const void *data)
Definition qtestdata.cpp:46
QString str
[2]
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
#define Q_WEAK_OVERLOAD
AudioChannelLayoutTag tag
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum type
QTestData & operator<<(QTestData &data, const T &value)
Definition qtestdata.h:39