aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/projectstorage/storagecacheentry.h
blob: 63fc93efdd0788ae1a5ac18a69e78854e7cc2fd2 (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

namespace QmlDesigner {

template<typename Type, typename ViewType, typename IndexType>
class StorageCacheEntry
{
public:
    StorageCacheEntry(ViewType value, IndexType id)
        : value(value)
        , id(id)
    {}

    operator ViewType() const noexcept { return value; }
    friend bool operator==(const StorageCacheEntry &first, const StorageCacheEntry &second)
    {
        return first.id == second.id && first.value == second.value;
    }

public:
    Type value;
    IndexType id;
};

} // namespace QmlDesigner