~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/include/compilerfactory.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
4
 */
 
5
 
 
6
#ifndef COMPILERFACTORY_H
 
7
#define COMPILERFACTORY_H
 
8
 
 
9
#ifndef CB_PRECOMP
 
10
    #include <wx/arrstr.h> // WX_DEFINE_ARRAY
 
11
    #include "compiler.h" // Compiler
 
12
#endif
 
13
 
 
14
#include "settings.h"
 
15
 
 
16
class Compiler;
 
17
 
 
18
// Well, not really a factory ;)
 
19
 
 
20
WX_DEFINE_ARRAY(Compiler*, CompilersArray);
 
21
 
 
22
class DLLIMPORT CompilerFactory
 
23
{
 
24
    public:
 
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);
 
33
 
 
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);
 
38
 
 
39
        /// @return true if the specified compiler ID is valid, false if not.
 
40
        static bool IsValidCompilerID(const wxString& id){ return GetCompilerIndex(id) != -1; }
 
41
 
 
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);
 
46
 
 
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);
 
59
 
 
60
        static void SaveSettings();
 
61
        static void LoadSettings();
 
62
 
 
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);
 
68
 
 
69
        static Compiler* SelectCompilerUI(const wxString& message = _("Select compiler"), const wxString& preselectedID = wxEmptyString);
 
70
    private:
 
71
        static CompilersArray Compilers;
 
72
        static Compiler* s_DefaultCompiler;
 
73
};
 
74
 
 
75
#endif // COMPILERFACTORY_H