summaryrefslogtreecommitdiffstats
path: root/src/animation/frontend/qchannelcomponent.cpp
blob: d47bcd4d2709593ebe5f202ed7a160999b9d613f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qchannelcomponent.h"

#include <QtCore/qlist.h>

QT_BEGIN_NAMESPACE

namespace Qt3DAnimation {

class QChannelComponentPrivate
{
public:
    QVector<QKeyFrame> m_keyFrames;
    QString m_name;
};

QChannelComponent::QChannelComponent()
    : d(new QChannelComponentPrivate)
{
}

QChannelComponent::QChannelComponent(const QString &name)
    : d(new QChannelComponentPrivate)
{
    d->m_name = name;
}

QChannelComponent::QChannelComponent(const QChannelComponent &rhs)
    : d(new QChannelComponentPrivate)
{
    *d = *(rhs.d);
}

QChannelComponent &QChannelComponent::operator=(const QChannelComponent &rhs)
{
    if (this != &rhs)
        *d = *(rhs.d);
    return *this;
}

QChannelComponent::~QChannelComponent()
{
}

void QChannelComponent::setName(const QString &name)
{
    d->m_name = name;
}

QString QChannelComponent::name() const
{
    return d->m_name;
}

int QChannelComponent::keyFrameCount() const
{
    return d->m_keyFrames.size();
}

void QChannelComponent::appendKeyFrame(const QKeyFrame &kf)
{
    d->m_keyFrames.append(kf);
}

void QChannelComponent::insertKeyFrame(int index, const QKeyFrame &kf)
{
    d->m_keyFrames.insert(index, kf);
}

void QChannelComponent::removeKeyFrame(int index)
{
    d->m_keyFrames.remove(index);
}

void QChannelComponent::clearKeyFrames()
{
    d->m_keyFrames.clear();
}

QChannelComponent::const_iterator QChannelComponent::begin() const noexcept
{
    return d->m_keyFrames.cbegin().operator->();
}

QChannelComponent::const_iterator QChannelComponent::end() const noexcept
{
    return d->m_keyFrames.cend().operator->();
}

bool operator==(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept
{
    return lhs.d->m_name == rhs.d->m_name &&
           lhs.d->m_keyFrames == rhs.d->m_keyFrames;
}

bool operator!=(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept
{
    return lhs.d->m_name != rhs.d->m_name ||
           lhs.d->m_keyFrames != rhs.d->m_keyFrames;
}

} // namespace Qt3DAnimation

QT_END_NAMESPACE