2
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3
* http://www.gnu.org/licenses/lgpl-3.0.html
6
#ifndef COMPILERFACTORY_H
7
#define COMPILERFACTORY_H
10
#include <wx/arrstr.h> // WX_DEFINE_ARRAY
11
#include "compiler.h" // Compiler
18
// Well, not really a factory ;)
20
WX_DEFINE_ARRAY(Compiler*, CompilersArray);
22
class DLLIMPORT CompilerFactory
25
/// @return the number of registered compilers.
26
static size_t GetCompilersCount();
27
/// @return the compiler by an index.
28
static Compiler* GetCompiler(size_t index);
29
/// @return the compiler by a name (ID). *Not* the compiler's title...
30
static Compiler* GetCompiler(const wxString& id);
31
/// @return the compiler by title.
32
static Compiler* GetCompilerByName(const wxString& title);
34
/// @return the compiler's index from its id. Returns -1 if it doesn't exist.
35
static int GetCompilerIndex(const wxString& id);
36
/// @return the compiler's index. Returns -1 if it doesn't exist.
37
static int GetCompilerIndex(Compiler* compiler);
39
/// @return true if the specified compiler ID is valid, false if not.
40
static bool IsValidCompilerID(const wxString& id){ return GetCompilerIndex(id) != -1; }
42
/// @return true if compiler ID @c id inherits, directly or indirectly, from compiler ID @c from_id.
43
static bool CompilerInheritsFrom(const wxString& id, const wxString& from_id);
44
/// @return true if @c compiler inherits, directly or indirectly, from compiler ID @c from_id.
45
static bool CompilerInheritsFrom(Compiler* compiler, const wxString& from_id);
47
/// Register a supported (builtin) compiler.
48
static void RegisterCompiler(Compiler* compiler);
49
/// Register all user-defined compiler copies.
50
static void RegisterUserCompilers();
51
/// Create a copy of a compiler.
52
static Compiler* CreateCompilerCopy(Compiler* compiler, const wxString& newName);
53
/// Remove a compiler.
54
static void RemoveCompiler(Compiler* compiler);
55
/// Unregister all compilers.
56
static void UnregisterCompilers();
57
/// get the version number as string for the compiler with the specified index
58
static wxString GetCompilerVersionString(const wxString& Id);
60
static void SaveSettings();
61
static void LoadSettings();
63
static const wxString& GetDefaultCompilerID();
64
static Compiler* GetDefaultCompiler();
65
static void SetDefaultCompiler(size_t index);
66
static void SetDefaultCompiler(const wxString& id);
67
static void SetDefaultCompiler(Compiler* compiler);
69
static Compiler* SelectCompilerUI(const wxString& message = _("Select compiler"), const wxString& preselectedID = wxEmptyString);
71
static CompilersArray Compilers;
72
static Compiler* s_DefaultCompiler;
75
#endif // COMPILERFACTORY_H