File indexing completed on 2024-05-12 15:59:35

0001 /*
0002  *  SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #include "KoColorTransformationFactoryRegistry.h"
0008 
0009 #include "KoColorTransformationFactory.h"
0010 
0011 struct Q_DECL_HIDDEN KoColorTransformationFactoryRegistry::Private {
0012     static KoColorTransformationFactoryRegistry* s_registry;
0013 };
0014 
0015 KoColorTransformationFactoryRegistry* KoColorTransformationFactoryRegistry::Private::s_registry = 0;
0016 
0017 KoColorTransformationFactoryRegistry::KoColorTransformationFactoryRegistry() : d(new Private)
0018 {
0019 
0020 }
0021 
0022 KoColorTransformationFactoryRegistry::~KoColorTransformationFactoryRegistry()
0023 {
0024     qDeleteAll(doubleEntries());
0025     qDeleteAll(values());
0026     delete d;
0027 }
0028 
0029 
0030 void KoColorTransformationFactoryRegistry::addColorTransformationFactory(KoColorTransformationFactory* factory)
0031 {
0032     instance()->add(factory);
0033 }
0034 
0035 void KoColorTransformationFactoryRegistry::removeColorTransformationFactory(KoColorTransformationFactory* factory)
0036 {
0037     instance()->remove(factory->id());
0038 }
0039 
0040 KoColorTransformationFactoryRegistry* KoColorTransformationFactoryRegistry::instance()
0041 {
0042     if (Private::s_registry == 0) {
0043         Private::s_registry = new KoColorTransformationFactoryRegistry();
0044     }
0045     return Private::s_registry;
0046 }