Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:12:23

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTESTDATA_H
0005 #define QTESTDATA_H
0006 
0007 #include <QtTest/qttestglobal.h>
0008 
0009 #include <QtCore/qmetatype.h>
0010 #include <QtCore/qstring.h>
0011 
0012 QT_BEGIN_NAMESPACE
0013 
0014 
0015 class QTestTable;
0016 class QTestDataPrivate;
0017 
0018 class Q_TESTLIB_EXPORT QTestData
0019 {
0020 public:
0021     ~QTestData();
0022 
0023     void append(int type, const void *data);
0024     void *data(int index) const;
0025     const char *dataTag() const;
0026     QTestTable *parent() const;
0027     int dataCount() const;
0028 
0029 private:
0030     friend class QTestTable;
0031     QTestData(const char *tag, QTestTable *parent);
0032 
0033     Q_DISABLE_COPY(QTestData)
0034 
0035     QTestDataPrivate *d;
0036 };
0037 
0038 template<typename T>
0039 QTestData &operator<<(QTestData &data, const T &value)
0040 {
0041     data.append(qMetaTypeId<T>(), &value);
0042     return data;
0043 }
0044 
0045 inline QTestData &operator<<(QTestData &data, const char * value)
0046 {
0047     QString str = QString::fromUtf8(value);
0048     data.append(QMetaType::QString, &str);
0049     return data;
0050 }
0051 
0052 #ifdef __cpp_char8_t
0053 Q_WEAK_OVERLOAD
0054 inline QTestData &operator<<(QTestData &data, const char8_t *value)
0055 {
0056     return data << reinterpret_cast<const char *>(value);
0057 }
0058 #endif
0059 
0060 #ifdef QT_USE_QSTRINGBUILDER
0061 template<typename A, typename B>
0062 inline QTestData &operator<<(QTestData &data, const QStringBuilder<A, B> &value)
0063 {
0064     return data << typename QConcatenable<QStringBuilder<A, B> >::ConvertTo(value);
0065 }
0066 #endif
0067 
0068 QT_END_NAMESPACE
0069 
0070 #endif