~ubuntu-branches/ubuntu/lucid/codelite/lucid

« back to all changes in this revision

Viewing changes to Plugin/compiler.h

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-02-10 02:27:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090210022755-m5692nfc1t5uf1w9
Tags: 1.0.2759+dfsg-0ubuntu1
* New upstream release (LP: #327216).
* debian/patches/series, debian/patches/00_fix-ia64-build.patch:
  + Dropped, applied upstream already.
* debian/patches/02_fix-desktop.patch,
  debian/patches/03_fix-sh.patch:
  + Refreshed to patch cleanly.
* debian/rules:
  + Make get-orig-source honour UPSTREAM_VERSION if set.
* debian/ctags-le.1,
  debian/codelite_indexer.1,
  debian/codelite.manpages:
  + Dropped ctags-le manpage, since ctags-le was replaced by
    codelite_indexer.
  + Added codelite_indexer manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//////////////////////////////////////////////////////////////////////////////
2
 
//////////////////////////////////////////////////////////////////////////////
3
 
//
4
 
// copyright            : (C) 2008 by Eran Ifrah
5
 
// file name            : compiler.h
6
 
//
7
 
// -------------------------------------------------------------------------
8
 
// A
9
 
//              _____           _      _     _ _
10
 
//             /  __ \         | |    | |   (_) |
11
 
//             | /  \/ ___   __| | ___| |    _| |_ ___
12
 
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
13
 
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
14
 
//              \____/\___/ \__,_|\___\_____/_|\__\___|
15
 
//
16
 
//                                                  F i l e
17
 
//
18
 
//    This program is free software; you can redistribute it and/or modify
19
 
//    it under the terms of the GNU General Public License as published by
20
 
//    the Free Software Foundation; either version 2 of the License, or
21
 
//    (at your option) any later version.
22
 
//
23
 
//////////////////////////////////////////////////////////////////////////////
24
 
//////////////////////////////////////////////////////////////////////////////
25
 
#ifndef COMPILER_H
26
 
#define COMPILER_H
27
 
 
28
 
#include "configuration_object.h"
29
 
#include "smart_ptr.h"
30
 
#include <map>
31
 
 
32
 
#ifdef WXMAKINGDLL_LE_SDK
33
 
#    define WXDLLIMPEXP_LE_SDK WXEXPORT
34
 
#elif defined(WXUSINGDLL_LE_SDK)
35
 
#    define WXDLLIMPEXP_LE_SDK WXIMPORT
36
 
#else /* not making nor using FNB as DLL */
37
 
#    define WXDLLIMPEXP_LE_SDK
38
 
#endif // WXMAKINGDLL_LE_SDK
39
 
 
40
 
/**
41
 
 * \ingroup LiteEditor
42
 
 * This class represenets a compiler entry in the configuration file
43
 
 *
44
 
 * \version 1.0
45
 
 * first version
46
 
 *
47
 
 * \date 05-25-2007
48
 
 *
49
 
 * \author Eran
50
 
 */
51
 
class WXDLLIMPEXP_LE_SDK Compiler : public ConfObject
52
 
{
53
 
public:
54
 
        enum CmpFileKind {
55
 
                CmpFileKindSource,
56
 
                CmpFileKindResource
57
 
        };
58
 
 
59
 
        struct CmpFileTypeInfo {
60
 
                wxString extension;
61
 
                wxString compilation_line;
62
 
                CmpFileKind kind;
63
 
        };
64
 
 
65
 
private:
66
 
        void AddCmpFileType(const wxString &extension, CmpFileKind type, const wxString &compile_line);
67
 
 
68
 
protected:
69
 
        wxString m_name;
70
 
        std::map<wxString, wxString> m_switches;
71
 
        std::map<wxString, Compiler::CmpFileTypeInfo> m_fileTypes;
72
 
        wxString m_objectSuffix;
73
 
    wxString m_dependSuffix;
74
 
    wxString m_preprocessSuffix;
75
 
    
76
 
        wxString m_errorPattern;
77
 
        wxString m_errorLineNubmerIndex;
78
 
        wxString m_errorFileNameIndex;
79
 
 
80
 
        wxString m_warningPattern;
81
 
        wxString m_warningLineNubmerIndex;
82
 
        wxString m_warningFileNameIndex;
83
 
 
84
 
        std::map<wxString, wxString> m_tools;
85
 
        wxString m_globalIncludePath;
86
 
        wxString m_globalLibPath;
87
 
        wxString m_pathVariable;
88
 
        bool m_generateDependeciesFile;
89
 
 
90
 
public:
91
 
        typedef std::map<wxString, wxString>::const_iterator ConstIterator;
92
 
 
93
 
        Compiler(wxXmlNode *node);
94
 
        virtual ~Compiler();
95
 
 
96
 
        wxXmlNode *ToXml() const;
97
 
 
98
 
        //iteration over switches
99
 
        Compiler::ConstIterator SwitchesBegin() const {
100
 
                return m_switches.begin();
101
 
        }
102
 
        Compiler::ConstIterator SwitchesEnd() const {
103
 
                return m_switches.end();
104
 
        }
105
 
 
106
 
        //---------------------------------------------------
107
 
        //setters/getters
108
 
        //---------------------------------------------------
109
 
        wxString GetTool(const wxString &name) const;
110
 
        void SetTool(const wxString &name, const wxString &tool) {
111
 
                m_tools[name] = tool;
112
 
        }
113
 
 
114
 
        wxString GetSwitch(const wxString &name) const;
115
 
        void SetSwitch(const wxString &name, const wxString &value) {
116
 
                m_switches[name] = value;
117
 
        }
118
 
        const wxString &GetObjectSuffix() const {
119
 
                return m_objectSuffix;
120
 
        }
121
 
        void SetObjectSuffix(const wxString &suffix) {
122
 
                m_objectSuffix = suffix;
123
 
        }
124
 
        const wxString &GetDependSuffix() const {
125
 
                return m_dependSuffix;
126
 
        }
127
 
        void SetDependSuffix(const wxString &suffix) {
128
 
                m_dependSuffix = suffix;
129
 
        }
130
 
        const wxString &GetPreprocessSuffix() const {
131
 
                return m_preprocessSuffix;
132
 
        }
133
 
        void SetPreprocessSuffix(const wxString &suffix) {
134
 
                m_preprocessSuffix = suffix;
135
 
        }
136
 
    
137
 
        void SetName(const wxString &name) {
138
 
                m_name = name;
139
 
        }
140
 
        const wxString &GetName() const {
141
 
                return m_name;
142
 
        }
143
 
        const wxString &GetErrPattern() const {
144
 
                return m_errorPattern;
145
 
        }
146
 
        const wxString &GetErrFileNameIndex() const {
147
 
                return m_errorFileNameIndex;
148
 
        }
149
 
        const wxString &GetErrLineNumberIndex() const {
150
 
                return m_errorLineNubmerIndex;
151
 
        }
152
 
        const wxString &GetWarnPattern() const {
153
 
                return m_warningPattern;
154
 
        }
155
 
        const wxString &GetWarnFileNameIndex() const {
156
 
                return m_warningFileNameIndex;
157
 
        }
158
 
        const wxString &GetWarnLineNumberIndex() const {
159
 
                return m_warningLineNubmerIndex;
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// copyright            : (C) 2008 by Eran Ifrah
 
5
// file name            : compiler.h
 
6
//
 
7
// -------------------------------------------------------------------------
 
8
// A
 
9
//              _____           _      _     _ _
 
10
//             /  __ \         | |    | |   (_) |
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|
 
15
//
 
16
//                                                  F i l e
 
17
//
 
18
//    This program is free software; you can redistribute it and/or modify
 
19
//    it under the terms of the GNU General Public License as published by
 
20
//    the Free Software Foundation; either version 2 of the License, or
 
21
//    (at your option) any later version.
 
22
//
 
23
//////////////////////////////////////////////////////////////////////////////
 
24
//////////////////////////////////////////////////////////////////////////////
 
25
#ifndef COMPILER_H
 
26
#define COMPILER_H
 
27
 
 
28
#include "configuration_object.h"
 
29
#include "smart_ptr.h"
 
30
#include <map>
 
31
 
 
32
#ifdef WXMAKINGDLL_LE_SDK
 
33
#    define WXDLLIMPEXP_LE_SDK WXEXPORT
 
34
#elif defined(WXUSINGDLL_LE_SDK)
 
35
#    define WXDLLIMPEXP_LE_SDK WXIMPORT
 
36
#else /* not making nor using FNB as DLL */
 
37
#    define WXDLLIMPEXP_LE_SDK
 
38
#endif // WXMAKINGDLL_LE_SDK
 
39
 
 
40
/**
 
41
 * \ingroup LiteEditor
 
42
 * This class represenets a compiler entry in the configuration file
 
43
 *
 
44
 * \version 1.0
 
45
 * first version
 
46
 *
 
47
 * \date 05-25-2007
 
48
 *
 
49
 * \author Eran
 
50
 */
 
51
class WXDLLIMPEXP_LE_SDK Compiler : public ConfObject
 
52
{
 
53
public:
 
54
        enum CmpFileKind {
 
55
                CmpFileKindSource,
 
56
                CmpFileKindResource
 
57
        };
 
58
 
 
59
        struct CmpFileTypeInfo {
 
60
                wxString extension;
 
61
                wxString compilation_line;
 
62
                CmpFileKind kind;
 
63
        };
 
64
        
 
65
        struct CmpCmdLineOption {
 
66
                wxString name;
 
67
                wxString help;
 
68
        };
 
69
        typedef std::map<wxString, CmpCmdLineOption> CmpCmdLineOptions;
 
70
 
 
71
private:
 
72
        void AddCmpFileType(const wxString &extension, CmpFileKind type, const wxString &compile_line);
 
73
 
 
74
protected:
 
75
        wxString m_name;
 
76
        std::map<wxString, wxString> m_switches;
 
77
        std::map<wxString, Compiler::CmpFileTypeInfo> m_fileTypes;
 
78
        CmpCmdLineOptions m_compilerOptions;
 
79
        CmpCmdLineOptions m_linkerOptions;
 
80
        wxString m_objectSuffix;
 
81
    wxString m_dependSuffix;
 
82
    wxString m_preprocessSuffix;
 
83
    
 
84
        wxString m_errorPattern;
 
85
        wxString m_errorLineNubmerIndex;
 
86
        wxString m_errorFileNameIndex;
 
87
 
 
88
        wxString m_warningPattern;
 
89
        wxString m_warningLineNubmerIndex;
 
90
        wxString m_warningFileNameIndex;
 
91
 
 
92
        std::map<wxString, wxString> m_tools;
 
93
        wxString m_globalIncludePath;
 
94
        wxString m_globalLibPath;
 
95
        wxString m_pathVariable;
 
96
        bool m_generateDependeciesFile;
 
97
 
 
98
public:
 
99
        typedef std::map<wxString, wxString>::const_iterator ConstIterator;
 
100
 
 
101
        Compiler(wxXmlNode *node);
 
102
        virtual ~Compiler();
 
103
 
 
104
        wxXmlNode *ToXml() const;
 
105
 
 
106
        //iteration over switches
 
107
        Compiler::ConstIterator SwitchesBegin() const {
 
108
                return m_switches.begin();
 
109
        }
 
110
        Compiler::ConstIterator SwitchesEnd() const {
 
111
                return m_switches.end();
 
112
        }
 
113
 
 
114
        //---------------------------------------------------
 
115
        //setters/getters
 
116
        //---------------------------------------------------
 
117
        wxString GetTool(const wxString &name) const;
 
118
        void SetTool(const wxString &name, const wxString &tool) {
 
119
                m_tools[name] = tool;
 
120
        }
 
121
 
 
122
        wxString GetSwitch(const wxString &name) const;
 
123
        void SetSwitch(const wxString &name, const wxString &value) {
 
124
                m_switches[name] = value;
 
125
        }
 
126
        const wxString &GetObjectSuffix() const {
 
127
                return m_objectSuffix;
 
128
        }
 
129
        void SetObjectSuffix(const wxString &suffix) {
 
130
                m_objectSuffix = suffix;
 
131
        }
 
132
        const wxString &GetDependSuffix() const {
 
133
                return m_dependSuffix;
 
134
        }
 
135
        void SetDependSuffix(const wxString &suffix) {
 
136
                m_dependSuffix = suffix;
 
137
        }
 
138
        const wxString &GetPreprocessSuffix() const {
 
139
                return m_preprocessSuffix;
 
140
        }
 
141
        void SetPreprocessSuffix(const wxString &suffix) {
 
142
                m_preprocessSuffix = suffix;
 
143
        }
 
144
    
 
145
        void SetName(const wxString &name) {
 
146
                m_name = name;
 
147
        }
 
148
        const wxString &GetName() const {
 
149
                return m_name;
 
150
        }
 
151
        const wxString &GetErrPattern() const {
 
152
                return m_errorPattern;
 
153
        }
 
154
        const wxString &GetErrFileNameIndex() const {
 
155
                return m_errorFileNameIndex;
 
156
        }
 
157
        const wxString &GetErrLineNumberIndex() const {
 
158
                return m_errorLineNubmerIndex;
 
159
        }
 
160
        const wxString &GetWarnPattern() const {
 
161
                return m_warningPattern;
 
162
        }
 
163
        const wxString &GetWarnFileNameIndex() const {
 
164
                return m_warningFileNameIndex;
 
165
        }
 
166
        const wxString &GetWarnLineNumberIndex() const {
 
167
                return m_warningLineNubmerIndex;
160
168
        }
161
169
 
162
170
        void SetErrPattern(const wxString &s) {
206
214
        const std::map<wxString, Compiler::CmpFileTypeInfo>& GetFileTypes() const {
207
215
                return m_fileTypes;
208
216
        }
 
217
        
 
218
        const CmpCmdLineOptions& GetCompilerOptions() const {
 
219
                return m_compilerOptions;
 
220
        }
 
221
        
 
222
        void SetCompilerOptions(const CmpCmdLineOptions& cmpOptions) {
 
223
                m_compilerOptions = cmpOptions;
 
224
        }
 
225
 
 
226
        const CmpCmdLineOptions& GetLinkerOptions() const {
 
227
                return m_linkerOptions;
 
228
        }
 
229
        
 
230
        void SetLinkerOptions(const CmpCmdLineOptions& cmpOptions) {
 
231
                m_linkerOptions = cmpOptions;
 
232
        }
209
233
 
210
234
        void SetGenerateDependeciesFile(const bool& generateDependeciesFile) {
211
235
                this->m_generateDependeciesFile = generateDependeciesFile;
217
241
};
218
242
 
219
243
typedef SmartPtr<Compiler> CompilerPtr;
220
 
#endif // COMPILER_H
 
244
#endif // COMPILER_H