-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompileOptions.hpp
More file actions
71 lines (58 loc) · 1.7 KB
/
CompileOptions.hpp
File metadata and controls
71 lines (58 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef SEMANTICHIGHLIGHT_COMPILEOPTIONS_HPP
#define SEMANTICHIGHLIGHT_COMPILEOPTIONS_HPP
#include <unordered_map>
#include <vector>
#include <utility>
#include <wx/thread.h>
#include <wx/arrstr.h>
#include <wx/string.h>
#include <cbproject.h>
#include <compileoptionsbase.h>
class CompileOptions
{
public:
CompileOptions()
{
wxMutexLocker locker(mutex);
compileOptions[0] = wxArrayString();
}
void SetActiveBuildTarget(cbProject * project, ProjectBuildTarget * bt)
{
wxMutexLocker locker(mutex);
activeBuildTarget[project] = bt;
}
void SetCompileOptions(CompileOptionsBase * object, wxArrayString const& options)
{
if (!object)
return;
wxMutexLocker locker(mutex);
compileOptions[object] = options;
}
void Erase(CompileOptionsBase * object)
{
if (!object)
return;
wxMutexLocker locker(mutex);
activeBuildTarget.erase(static_cast<cbProject *>(object));
compileOptions.erase(object);
}
void Clear()
{
wxMutexLocker locker(mutex);
compileOptions.clear();
activeBuildTarget.clear();
}
bool Exists(CompileOptionsBase * object) const
{
wxMutexLocker locker(mutex);
return compileOptions.find(object) != compileOptions.end();
}
std::pair<std::vector<const char *>, std::vector<wxCharBuffer> >
GetOptions(cbProject * project);
static CompileOptions current;
private:
std::unordered_map<CompileOptionsBase *, wxArrayString> compileOptions;
std::unordered_map<cbProject *, ProjectBuildTarget *> activeBuildTarget;
mutable wxMutex mutex;
};
#endif // SEMANTICHIGHLIGHT_COMPILEOPTIONS_HPP