Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
LayoutSourceBundle.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <phosphorlayoutapi_export.h>
7
12
13#include <PhosphorRegistry/Registry.h>
14
15#include <QHash>
16
17#include <memory>
18#include <vector>
19
20namespace PhosphorLayout {
21
47class PHOSPHORLAYOUTAPI_EXPORT LayoutSourceBundle
48{
49public:
52
56 LayoutSourceBundle& operator=(LayoutSourceBundle&&) noexcept;
57
68 void addFactory(std::unique_ptr<ILayoutSourceFactory> factory);
69
81 void build();
82
121 void buildFromRegistered(const FactoryContext& ctx);
122
125 CompositeLayoutSource* composite() const
126 {
127 return m_composite.get();
128 }
129
148 ILayoutSource* source(const QString& name) const;
149
150private:
159 std::unique_ptr<PhosphorRegistry::Registry<ILayoutSourceFactory>> m_factoryRegistry;
160 std::vector<std::unique_ptr<ILayoutSource>> m_sources;
166 QHash<QString, std::size_t> m_sourceIndex;
172 std::unique_ptr<CompositeLayoutSource> m_composite;
173};
174
175} // namespace PhosphorLayout
Aggregates multiple ILayoutSource implementations behind one ILayoutSource interface.
Definition CompositeLayoutSource.h:39
Service registry passed to a layout-source-provider builder so it can pull whatever registries / depe...
Definition LayoutSourceProviderRegistry.h:66
Abstract factory for an ILayoutSource implementation.
Definition ILayoutSourceFactory.h:46
Abstract producer of LayoutPreview values.
Definition ILayoutSource.h:48
Owning bundle that assembles a list of ILayoutSourceFactory instances into a single CompositeLayoutSo...
Definition LayoutSourceBundle.h:48
LayoutSourceBundle(LayoutSourceBundle &&) noexcept
LayoutSourceBundle(const LayoutSourceBundle &)=delete
LayoutSourceBundle & operator=(const LayoutSourceBundle &)=delete
ILayoutSource * source(const QString &name) const
Borrowed access to the source produced by the factory whose name() matches name.
Definition AlgorithmMetadata.h:10