Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
outputproducerregistry.cpp
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
include
"outputproducerregistry.h"
5
6
#
include
"outputproducer.h"
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
\class OutputProducerRegistry
12
\internal
13
\brief Singleton registry for discovering output producers by format.
14
15
\sa OutputProducer, Generator
16
*/
17
18
/*!
19
Returns the singleton registry instance.
20
*/
21
OutputProducerRegistry
&
OutputProducerRegistry
::
instance
()
22
{
23
static
OutputProducerRegistry
registry;
24
return
registry;
25
}
26
27
/*!
28
Registers \a producer with this registry.
29
30
The producer is indexed by its format() identifier, which is
31
case-sensitive (see OutputProducer::format()). If a producer
32
with the same format is already registered, it will be replaced.
33
34
The format identifier must remain constant for the lifetime of
35
the producer; changing it after registration may prevent successful
36
unregistration.
37
38
\sa unregisterProducer()
39
*/
40
void
OutputProducerRegistry
::
registerProducer
(
OutputProducer
*producer)
41
{
42
if
(!producer)
43
return
;
44
45
m_producers.insert(producer->format(), producer);
46
}
47
48
/*!
49
Unregisters \a producer from this registry.
50
51
The producer is only removed if it is currently the registered
52
producer for its format. This prevents a replaced producer from
53
accidentally unregistering its replacement during destruction.
54
55
\sa registerProducer()
56
*/
57
void
OutputProducerRegistry
::
unregisterProducer
(
OutputProducer
*producer)
58
{
59
if
(!producer)
60
return
;
61
62
auto
it = m_producers.find(producer->format());
63
if
(it != m_producers.end() && it.value() == producer)
64
m_producers.erase(it);
65
}
66
67
/*!
68
Returns the producer registered for \a format, or nullptr if none.
69
The \a format comparison is case-sensitive.
70
*/
71
OutputProducer
*
OutputProducerRegistry
::producerForFormat(
const
QString &format)
const
72
{
73
return
m_producers.value(format,
nullptr
);
74
}
75
76
/*!
77
Returns all registered producers in unspecified order.
78
*/
79
QList
<
OutputProducer
*>
OutputProducerRegistry
::
allProducers
()
const
80
{
81
return
m_producers.values();
82
}
83
84
QT_END_NAMESPACE
OutputProducerRegistry
Singleton registry for discovering output producers by format.
Definition
outputproducerregistry.h:16
OutputProducerRegistry::registerProducer
void registerProducer(OutputProducer *producer)
Registers producer with this registry.
Definition
outputproducerregistry.cpp:40
OutputProducerRegistry::unregisterProducer
void unregisterProducer(OutputProducer *producer)
Unregisters producer from this registry.
Definition
outputproducerregistry.cpp:57
OutputProducerRegistry::allProducers
QList< OutputProducer * > allProducers() const
Returns all registered producers in unspecified order.
Definition
outputproducerregistry.cpp:79
OutputProducerRegistry::instance
static OutputProducerRegistry & instance()
Returns the singleton registry instance.
Definition
outputproducerregistry.cpp:21
OutputProducer
Interface for documentation output producers.
Definition
outputproducer.h:34
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qttools
src
qdoc
qdoc
src
qdoc
outputproducerregistry.cpp
Generated on
for Qt by
1.18.0