| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 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 QT3DRENDER_QSORTPOLICY_P_H |
| 5 | #define QT3DRENDER_QSORTPOLICY_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qframegraphnode_p.h> |
| 19 | #include "qsortpolicy.h" |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | namespace Qt3DRender { |
| 24 | |
| 25 | |
| 26 | class QSortPolicyPrivate : public QFrameGraphNodePrivate |
| 27 | { |
| 28 | public: |
| 29 | QSortPolicyPrivate(); |
| 30 | Q_DECLARE_PUBLIC(QSortPolicy) |
| 31 | QList<QSortPolicy::SortType> m_sortTypes; |
| 32 | }; |
| 33 | |
| 34 | } // namespace Qt3DRender |
| 35 | |
| 36 | namespace { |
| 37 | template<class From, class To> |
| 38 | To typeCastHelper(From type) |
| 39 | { |
| 40 | return static_cast<To>(type); |
| 41 | } |
| 42 | |
| 43 | template<class From, class To> |
| 44 | void transformVector(const QList<From> &input, QList<To> &output) |
| 45 | { |
| 46 | Q_ASSERT(output.isEmpty()); |
| 47 | |
| 48 | output.reserve(input.size()); |
| 49 | std::transform(input.constBegin(), input.constEnd(), |
| 50 | std::back_inserter(output), |
| 51 | typeCastHelper<From, To>); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | QT_END_NAMESPACE |
| 56 | |
| 57 | #endif // QT3DRENDER_QSORTPOLICY_P_H |
| 58 | |