Krita Source Code Documentation
Loading...
Searching...
No Matches
KisResourcesInterface_p.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KisResourcesInterface_P_H
7#define KisResourcesInterface_P_H
8
9#include "kritaresources_export.h"
11#include <unordered_map>
12#include <memory>
13
14#include <QReadWriteLock>
15#include <QReadLocker>
16#include <QWriteLocker>
17
18#include "kis_assert.h"
19
22
23#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
24namespace std
25{
26 template<> struct hash<QString>
27 {
28 std::size_t operator()(const QString &s) const noexcept {
29 return qHash(s);
30 }
31 };
32}
33#endif
34
35class KRITARESOURCES_EXPORT KisResourcesInterfacePrivate
36{
37public:
38 mutable std::unordered_map<QString,
39 std::unique_ptr<
41 mutable QReadWriteLock lock;
42
44 auto it = this->sourceAdapters.find(type);
45 if (it != this->sourceAdapters.end()) {
46 KIS_ASSERT(bool(it->second));
47
48 return it->second.get();
49 }
50
51 return nullptr;
52 }
53
55};
56
57#endif // KisResourcesInterface_P_H
uint qHash(const KoInputDevice &key)
KisResourcesInterface::ResourceSourceAdapter * findExistingSource(const QString &type) const
std::unordered_map< QString, std::unique_ptr< KisResourcesInterface::ResourceSourceAdapter > > sourceAdapters
#define KIS_ASSERT(cond)
Definition kis_assert.h:33