-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueryManager.h
84 lines (63 loc) · 2.12 KB
/
QueryManager.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#ifndef _QUERIER_QUERY_MANAGER_H
#define _QUERIER_QUERY_MANAGER_H
#include "interface/LanguageModule.h"
#include "ModuleManager.h"
#include "AppWindow.h"
#include "resource.h"
namespace querier {
class Query {
public:
Query() {};
Query(std::string, std::string, std::string);
Query(std::string, std::string, std::string, std::string);
std::string Name;
std::string Path;
std::string ModuleName;
std::string ModuleVersion;
std::string SourceFile;
std::string SourceFileContent;
std::vector<std::string> Libraries;
bool UnsavedChanges = false;
LanguageModule* QueryLanguageModule = nullptr;
path queryConfigFile();
Query LoadQueryConfigFile();
void SaveQueryConfigFile();
static Query LoadQueryConfigFile(path file);
};
class QueryManager {
public:
QueryManager(AppWindow*, ModuleManager*);
~QueryManager();
void Initialize(path, path);
std::map<std::string, Query*> Queries;
std::map<std::string, Query> get_Queries() {
std::map<std::string, Query> map;
if (Queries.size() > 0) {
for (auto q : Queries) {
map.insert({ q.first, *q.second });
}
}
return map;
}
std::vector<Query> get_QueriesV();
json get_QueriesAsJson();
path WorkingDirectory,
WorkspaceDirectory;
inline static std::string DefaultModule = "Nodejs";
inline static std::string DefaultSourceFileExtension = ".mjs";
void HandleCommand(QueryMessage*);
private:
AppWindow* m_MainWindow;
ModuleManager* m_ModuleManager;
std::vector<path> m_WorkspaceItems;
bool load_Workspace();
Query* load_Query(std::string);
Query* new_Query(std::string, std::string);
void SaveQueries();
void CleanupQueries();
};
void to_json(json& j, const Query& q);
void from_json(const json& j, Query& q);
} //namespace querier
#endif //_QUERIER_QUERY_MANAGER_H