| 1 | // Copyright (C) 2017 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 QT3DANIMATION_QCHANNELCOMPONENT_H |
| 5 | #define QT3DANIMATION_QCHANNELCOMPONENT_H |
| 6 | |
| 7 | #include <QtCore/qscopedpointer.h> |
| 8 | #include <QtCore/qstring.h> |
| 9 | #include <Qt3DAnimation/qt3danimation_global.h> |
| 10 | #include <Qt3DAnimation/qkeyframe.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace Qt3DAnimation { |
| 15 | |
| 16 | class QChannelComponentPrivate; |
| 17 | |
| 18 | class Q_3DANIMATIONSHARED_EXPORT QChannelComponent |
| 19 | { |
| 20 | public: |
| 21 | QChannelComponent(); |
| 22 | explicit QChannelComponent(const QString &name); |
| 23 | QChannelComponent(const QChannelComponent &); |
| 24 | QChannelComponent &operator=(const QChannelComponent &); |
| 25 | ~QChannelComponent(); |
| 26 | |
| 27 | void setName(const QString &name); |
| 28 | QString name() const; |
| 29 | |
| 30 | int keyFrameCount() const; |
| 31 | void appendKeyFrame(const QKeyFrame &kf); |
| 32 | void insertKeyFrame(int index, const QKeyFrame &kf); |
| 33 | void removeKeyFrame(int index); |
| 34 | void clearKeyFrames(); |
| 35 | |
| 36 | // Iterator API |
| 37 | typedef const QKeyFrame *const_iterator; |
| 38 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
| 39 | |
| 40 | const_iterator begin() const noexcept; |
| 41 | const_iterator cbegin() const noexcept { return begin(); } |
| 42 | const_iterator end() const noexcept; |
| 43 | const_iterator cend() const noexcept { return end(); } |
| 44 | const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } |
| 45 | const_reverse_iterator crbegin() const noexcept { return rbegin(); } |
| 46 | const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } |
| 47 | const_reverse_iterator crend() const noexcept { return rend(); } |
| 48 | |
| 49 | friend Q_3DANIMATIONSHARED_EXPORT bool operator==(const QChannelComponent &, |
| 50 | const QChannelComponent &) noexcept; |
| 51 | friend Q_3DANIMATIONSHARED_EXPORT bool operator!=(const QChannelComponent &, |
| 52 | const QChannelComponent &) noexcept; |
| 53 | |
| 54 | private: |
| 55 | QScopedPointer<QChannelComponentPrivate> d; |
| 56 | }; |
| 57 | |
| 58 | } // namespace Qt3DAnimation |
| 59 | |
| 60 | QT_END_NAMESPACE |
| 61 | |
| 62 | #endif // QT3DANIMATION_QCHANNELCOMPONENT_H |
| 63 |
