File indexing completed on 2024-05-12 04:39:39

0001 /*
0002     SPDX-FileCopyrightText: 2014 Sergey Kalinichev <kalinichev.so.0@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef ICOMPILERFACTORY_H
0008 #define ICOMPILERFACTORY_H
0009 
0010 #include "icompiler.h"
0011 
0012 class CompilerProvider;
0013 
0014 /// Interface that represents a factory for creating compilers
0015 class ICompilerFactory
0016 {
0017 public:
0018     virtual QString name() const = 0;
0019 
0020     ///@return new compiler
0021     ///@see ICompiler
0022     virtual CompilerPointer createCompiler( const QString& name, const QString& path, bool editable = true ) const = 0;
0023 
0024     /**
0025      * registers default compilers for the @p provider
0026      * E.g. for gcc default compilers could be "gcc c99" and "gcc c++11"
0027      */
0028     virtual void registerDefaultCompilers(CompilerProvider* provider) const = 0;
0029 
0030     /** @returns whether @p path is a compiler supported by the factory */
0031     virtual bool isSupported(const KDevelop::Path &path) const = 0;
0032 
0033     virtual ~ICompilerFactory() = default;
0034 };
0035 
0036 using CompilerFactoryPointer = QSharedPointer<ICompilerFactory>;
0037 
0038 #endif // ICOMPILERFACTORY_H