1/****************************************************************************
2**
3** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qanimationclipdata.h"
41
42#include <QtCore/qvector.h>
43
44QT_BEGIN_NAMESPACE
45
46namespace Qt3DAnimation {
47
48class QAnimationClipDataPrivate
49{
50public:
51 QVector<QChannel> m_channels;
52 QString m_name;
53};
54
55/*!
56 \class Qt3DAnimation::QAnimationClipData
57 \inmodule Qt3DAnimation
58 \brief Class containing the animation data.
59*/
60QAnimationClipData::QAnimationClipData()
61 : d(new QAnimationClipDataPrivate)
62{
63}
64
65QAnimationClipData::QAnimationClipData(const QAnimationClipData &rhs)
66 : d(new QAnimationClipDataPrivate)
67{
68 *d = *(rhs.d);
69}
70
71QAnimationClipData &QAnimationClipData::operator=(const QAnimationClipData &rhs)
72{
73 if (this != &rhs)
74 *d = *(rhs.d);
75 return *this;
76}
77
78QAnimationClipData::~QAnimationClipData()
79{
80}
81
82void QAnimationClipData::setName(const QString &name)
83{
84 d->m_name = name;
85}
86
87QString QAnimationClipData::name() const
88{
89 return d->m_name;
90}
91
92int QAnimationClipData::channelCount() const
93{
94 return d->m_channels.size();
95}
96
97void QAnimationClipData::appendChannel(const QChannel &c)
98{
99 d->m_channels.append(t: c);
100}
101
102void QAnimationClipData::insertChannel(int index, const QChannel &c)
103{
104 d->m_channels.insert(i: index, t: c);
105}
106
107void QAnimationClipData::removeChannel(int index)
108{
109 d->m_channels.remove(i: index);
110}
111
112void QAnimationClipData::clearChannels()
113{
114 d->m_channels.clear();
115}
116
117bool QAnimationClipData::isValid() const Q_DECL_NOTHROW
118{
119 // TODO: Perform more thorough checks
120 return !d->m_channels.isEmpty();
121}
122
123QAnimationClipData::const_iterator QAnimationClipData::begin() const Q_DECL_NOTHROW
124{
125 return d->m_channels.cbegin();
126}
127
128QAnimationClipData::const_iterator QAnimationClipData::end() const Q_DECL_NOTHROW
129{
130 return d->m_channels.cend();
131}
132
133
134bool operator==(const QAnimationClipData &lhs, const QAnimationClipData &rhs) Q_DECL_NOTHROW
135{
136 return lhs.d->m_name == rhs.d->m_name &&
137 lhs.d->m_channels == rhs.d->m_channels;
138}
139
140bool operator!=(const QAnimationClipData &lhs, const QAnimationClipData &rhs) Q_DECL_NOTHROW
141{
142 return lhs.d->m_name != rhs.d->m_name ||
143 lhs.d->m_channels != rhs.d->m_channels;
144}
145
146} // namespace Qt3DAnimation
147
148QT_END_NAMESPACE
149

source code of qt3d/src/animation/frontend/qanimationclipdata.cpp