aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/modelinglib/qmt/controller/references.h
blob: 4f43127590479a852eead8e7fa7a6a98d26a1aae (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
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QList>

namespace qmt {

template<class T>
class References
{
protected:
    References() = default;

public:
    ~References() = default;

    bool isEmpty() const { return m_elements.empty(); }
    int size() const { return m_elements.size(); }
    QList<T *> elements() const { return m_elements; }
    void setElements(const QList<T *> &elements) { m_elements = elements; }
    void clear() { m_elements.clear(); }
    void append(T *element) { m_elements.append(element); }

private:
    QList<T *> m_elements;
};

} // namespace qmt