Debian Codegraph @

CodeLite/compiler_command_line_parser.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : compiler_command_line_parser.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
26 #ifndef COMMANDLINEPARSER_H
27 #define COMMANDLINEPARSER_H
28
29 #include "codelite_exports.h"
30 #include <set>
31 #include <wx/arrstr.h>
32 #include <wx/filename.h>
33 #include <wx/string.h>
34
35 class WXDLLIMPEXP_CL CompilerCommandLineParser
36 {
37 public:
38 typedef std::set<wxString> Set_t;
39
40 protected:
41 wxArrayString m_includes;
42 wxArrayString m_macros;
43 wxArrayString m_macrosWithPrefix;
44 wxArrayString m_includesWithPrefix;
45 wxArrayString m_framworks;
46 wxArrayString m_sysroots; // -isysroot
47 wxString m_standard;
48 wxArrayString m_otherOptions;
49
50 int m_argc;
51 char** m_argv;
52 wxString m_diretory;
53 wxString m_pchFile;
54
55 protected:
56 void AddIncludesFromFile(const wxFileName& includeFile);
57
58 public:
59 CompilerCommandLineParser(const wxString& cmdline, const wxString& workingDirectory = wxEmptyString);
60 virtual ~CompilerCommandLineParser();
61
62 wxString GetCompileLine() const;
63 void MakeAbsolute(const wxString& path);
64 const wxString& GetStandard() const { return m_standard; }
65
66 wxString GetStandardWithPrefix() const;
67
68 const wxArrayString& GetSysroots() const { return m_sysroots; }
69 const wxArrayString& GetOtherOptions() const { return m_otherOptions; }
70 const wxArrayString& GetFramworks() const { return m_framworks; }
71 const wxString& GetPchFile() const { return m_pchFile; }
72 void SetArgc(int argc) { this->m_argc = argc; }
73 void SetArgv(char** argv) { this->m_argv = argv; }
74 void SetIncludes(const wxArrayString& includes) { this->m_includes = includes; }
75 void SetMacros(const wxArrayString& macros) { this->m_macros = macros; }
76 const wxArrayString& GetIncludes() const { return m_includes; }
77 const wxArrayString& GetMacros() const { return m_macros; }
78 char** GetArgv() { return m_argv; }
79
80 int GetArgc() const { return m_argc; }
81 const wxString& GetDiretory() const { return m_diretory; }
82 const wxArrayString& GetIncludesWithPrefix() const { return m_includesWithPrefix; }
83 const wxArrayString& GetMacrosWithPrefix() const { return m_macrosWithPrefix; }
84 };
85
86 #endif // COMMANDLINEPARSER_H