libs/pigment

KoColorTransformationFactoryRegistry.cpp

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "KoColorTransformationFactoryRegistry.h"
00021 
00022 #include "KoColorTransformationFactory.h"
00023 
00024 struct KoColorTransformationFactoryRegistry::Private {
00025     static KoColorTransformationFactoryRegistry* s_registry;
00026 };
00027 
00028 KoColorTransformationFactoryRegistry* KoColorTransformationFactoryRegistry::Private::s_registry = 0;
00029 
00030 KoColorTransformationFactoryRegistry::KoColorTransformationFactoryRegistry() : d(new Private)
00031 {
00032 
00033 }
00034 
00035 KoColorTransformationFactoryRegistry::~KoColorTransformationFactoryRegistry()
00036 {
00037     delete d;
00038 }
00039 
00040 
00041 void KoColorTransformationFactoryRegistry::addColorTransformationFactory(KoColorTransformationFactory* factory)
00042 {
00043     instance()->add(factory);
00044 }
00045 
00046 void KoColorTransformationFactoryRegistry::removeColorTransformationFactory(KoColorTransformationFactory* factory)
00047 {
00048     instance()->remove(factory->id());
00049 }
00050 
00051 KoColorTransformationFactoryRegistry* KoColorTransformationFactoryRegistry::instance()
00052 {
00053     if (Private::s_registry == 0) {
00054         Private::s_registry = new KoColorTransformationFactoryRegistry();
00055     }
00056     return Private::s_registry;
00057 }