File indexing completed on 2024-04-28 04:36:31

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andrea s Pakulat <apaku@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "launchconfigurationtype.h"
0008 
0009 #include "ilauncher.h"
0010 
0011 namespace KDevelop
0012 {
0013 
0014 class LaunchConfigurationTypePrivate
0015 {
0016 public:
0017     QList<ILauncher*> starters;
0018 };
0019 
0020 LaunchConfigurationType::LaunchConfigurationType()
0021     : d_ptr(new LaunchConfigurationTypePrivate)
0022 {
0023 }
0024 
0025 LaunchConfigurationType::~LaunchConfigurationType()
0026 {
0027     Q_D(LaunchConfigurationType);
0028 
0029     qDeleteAll(d->starters);
0030 }
0031 
0032 
0033 void LaunchConfigurationType::addLauncher( ILauncher* starter )
0034 {
0035     Q_D(LaunchConfigurationType);
0036 
0037     if( !d->starters.contains( starter ) )
0038     {
0039         d->starters.append( starter );
0040     }
0041 }
0042 void LaunchConfigurationType::removeLauncher( ILauncher* starter )
0043 {
0044     Q_D(LaunchConfigurationType);
0045 
0046     d->starters.removeAll( starter );
0047 }
0048 
0049 QList<ILauncher*> LaunchConfigurationType::launchers() const
0050 {
0051     Q_D(const LaunchConfigurationType);
0052 
0053     return d->starters;
0054 }
0055 
0056 ILauncher* LaunchConfigurationType::launcherForId(const QString& id) const
0057 {
0058     Q_D(const LaunchConfigurationType);
0059 
0060     for (ILauncher* l : qAsConst(d->starters)) {
0061         if( l->id() == id ) {
0062            return l;
0063         }
0064     }
0065     return nullptr;
0066 }
0067 
0068 }
0069 
0070 #include "moc_launchconfigurationtype.cpp"