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 | #include "qchannelcomponent.h" |
5 | |
6 | #include <QtCore/qlist.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | namespace Qt3DAnimation { |
11 | |
12 | class QChannelComponentPrivate |
13 | { |
14 | public: |
15 | QVector<QKeyFrame> m_keyFrames; |
16 | QString m_name; |
17 | }; |
18 | |
19 | QChannelComponent::QChannelComponent() |
20 | : d(new QChannelComponentPrivate) |
21 | { |
22 | } |
23 | |
24 | QChannelComponent::QChannelComponent(const QString &name) |
25 | : d(new QChannelComponentPrivate) |
26 | { |
27 | d->m_name = name; |
28 | } |
29 | |
30 | QChannelComponent::QChannelComponent(const QChannelComponent &rhs) |
31 | : d(new QChannelComponentPrivate) |
32 | { |
33 | *d = *(rhs.d); |
34 | } |
35 | |
36 | QChannelComponent &QChannelComponent::operator=(const QChannelComponent &rhs) |
37 | { |
38 | if (this != &rhs) |
39 | *d = *(rhs.d); |
40 | return *this; |
41 | } |
42 | |
43 | QChannelComponent::~QChannelComponent() |
44 | { |
45 | } |
46 | |
47 | void QChannelComponent::setName(const QString &name) |
48 | { |
49 | d->m_name = name; |
50 | } |
51 | |
52 | QString QChannelComponent::name() const |
53 | { |
54 | return d->m_name; |
55 | } |
56 | |
57 | int QChannelComponent::keyFrameCount() const |
58 | { |
59 | return d->m_keyFrames.size(); |
60 | } |
61 | |
62 | void QChannelComponent::appendKeyFrame(const QKeyFrame &kf) |
63 | { |
64 | d->m_keyFrames.append(t: kf); |
65 | } |
66 | |
67 | void QChannelComponent::insertKeyFrame(int index, const QKeyFrame &kf) |
68 | { |
69 | d->m_keyFrames.insert(i: index, t: kf); |
70 | } |
71 | |
72 | void QChannelComponent::removeKeyFrame(int index) |
73 | { |
74 | d->m_keyFrames.remove(i: index); |
75 | } |
76 | |
77 | void QChannelComponent::clearKeyFrames() |
78 | { |
79 | d->m_keyFrames.clear(); |
80 | } |
81 | |
82 | QChannelComponent::const_iterator QChannelComponent::begin() const noexcept |
83 | { |
84 | return d->m_keyFrames.cbegin().operator->(); |
85 | } |
86 | |
87 | QChannelComponent::const_iterator QChannelComponent::end() const noexcept |
88 | { |
89 | return d->m_keyFrames.cend().operator->(); |
90 | } |
91 | |
92 | bool operator==(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept |
93 | { |
94 | return lhs.d->m_name == rhs.d->m_name && |
95 | lhs.d->m_keyFrames == rhs.d->m_keyFrames; |
96 | } |
97 | |
98 | bool operator!=(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept |
99 | { |
100 | return lhs.d->m_name != rhs.d->m_name || |
101 | lhs.d->m_keyFrames != rhs.d->m_keyFrames; |
102 | } |
103 | |
104 | } // namespace Qt3DAnimation |
105 | |
106 | QT_END_NAMESPACE |
107 |