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 <QHash>
14
15#include <memory>
16#include <vector>
17
18namespace PhosphorLayout {
19
45class PHOSPHORLAYOUTAPI_EXPORT LayoutSourceBundle
46{
47public:
50
54 LayoutSourceBundle& operator=(LayoutSourceBundle&&) noexcept;
55
66 void addFactory(std::unique_ptr<ILayoutSourceFactory> factory);
67
77 void build();
78
117 void buildFromRegistered(const FactoryContext& ctx);
118
121 CompositeLayoutSource* composite() const
122 {
123 return m_composite.get();
124 }
125
144 ILayoutSource* source(const QString& name) const;
145
146private:
147 std::vector<std::unique_ptr<ILayoutSourceFactory>> m_factories;
148 std::vector<std::unique_ptr<ILayoutSource>> m_sources;
154 std::vector<QString> m_sourceNames;
160 QHash<QString, std::size_t> m_sourceIndex;
166 std::unique_ptr<CompositeLayoutSource> m_composite;
167};
168
169} // 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:37
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:46
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