/**************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ******************************************************************************/ #ifndef QTESTDATA_H #define QTESTDATA_H #include #include #include QT_BEGIN_NAMESPACE class QTestTable; class QTestDataPrivate; class Q_TESTLIB_EXPORT QTestData { public: ~QTestData(); void append(int type, const void *data); void *data(int index) const; const char *dataTag() const; QTestTable *parent() const; int dataCount() const; private: friend class QTestTable; QTestData(const char *tag, QTestTable *parent); Q_DISABLE_COPY(QTestData) QTestDataPrivate *d; }; template QTestData &operator<<(QTestData &data, const T &value) { data.append(qMetaTypeId(), &value); return data; } inline QTestData &operator<<(QTestData &data, const char * value) { QString str = QString::fromUtf8(value); data.append(QMetaType::QString, &str); return data; } #ifdef __cpp_char8_t Q_WEAK_OVERLOAD inline QTestData &operator<<(QTestData &data, const char8_t *value) { return data << reinterpret_cast(value); } #endif #ifdef QT_USE_QSTRINGBUILDER template inline QTestData &operator<<(QTestData &data, const QStringBuilder &value) { return data << typename QConcatenable >::ConvertTo(value); } #endif QT_END_NAMESPACE #endif