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

#pragma once

#include "qmt/infrastructure/uid.h"

#include <QList>

namespace qmt {

class QMT_EXPORT Selection
{
public:
    class Index
    {
    public:
        Index(const Uid &elementKey, const Uid &ownerKey)
            : m_elementKey(elementKey),
              m_ownerKey(ownerKey)
        {
        }

        Uid elementKey() const { return m_elementKey; }
        Uid ownerKey() const { return m_ownerKey; }

    private:
        Uid m_elementKey;
        Uid m_ownerKey;
    };

protected:
    Selection();

public:
    ~Selection();

    bool isEmpty() const { return m_indices.isEmpty(); }
    QList<Index> indices() const { return m_indices; }
    void setIndices(const QList<Index> &indices);

    void clear();
    void append(const Index &index);
    void append(const Uid &elementKey, const Uid &ownerKey);

private:
    QList<Index> m_indices;
};

} // namespace qmt