-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyzeFP.hpp
130 lines (106 loc) · 3.02 KB
/
analyzeFP.hpp
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include "EuroScopePlugIn.h"
#include <sstream>
#include <iostream>
#include <string>
#include "Constant.hpp"
#include <fstream>
#include <vector>
#include <map>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#define MY_PLUGIN_NAME "VFPC"
#define MY_PLUGIN_VERSION "2.0.9"
#define MY_PLUGIN_DEVELOPER "Jan Fries, Hendrik Peter, Sven Czarnian"
#define MY_PLUGIN_COPYRIGHT "GPL v3"
#define MY_PLUGIN_VIEW_AVISO "Vatsim FlightPlan Checker"
#define PLUGIN_WELCOME_MESSAGE "Willkommen beim Vatsim Flugplan-RFL checker"
using namespace std;
using namespace boost;
using namespace rapidjson;
using namespace EuroScopePlugIn;
class CVFPCPlugin :
public EuroScopePlugIn::CPlugIn
{
public:
CVFPCPlugin();
virtual ~CVFPCPlugin();
virtual void getSids();
virtual vector<string> validizeSid(CFlightPlan flightPlan);
virtual void OnFunctionCall(int FunctionId, const char * ItemString, POINT Pt, RECT Area);
//Define OnGetTagItem function
virtual void OnGetTagItem(CFlightPlan FlightPlan,
CRadarTarget RadarTarget,
int ItemCode,
int TagData,
char sItemString[16],
int* pColorCode,
COLORREF* pRGB,
double* pFontSize);
template <typename Out>
void split(const string& s, char delim, Out result) {
istringstream iss(s);
string item;
while (getline(iss, item, delim)) {
*result++ = item;
}
}
vector<string> split(const string& s, char delim) {
vector<string> elems;
split(s, delim, back_inserter(elems));
return elems;
}
string destArrayContains(const Value& a, string s) {
for (SizeType i = 0; i < a.Size(); i++) {
string test = a[i].GetString();
SizeType x = static_cast<rapidjson::SizeType>(s.rfind(test, 0));
if (s.rfind(a[i].GetString(), 0) != -1)
return a[i].GetString();
}
return "";
}
bool arrayContains(const Value& a, string s) {
for (SizeType i = 0; i < a.Size(); i++) {
if (a[i].GetString() == s)
return true;
}
return false;
}
bool arrayContains(const Value& a, char s) {
for (SizeType i = 0; i < a.Size(); i++) {
if (a[i].GetString()[0] == s)
return true;
}
return false;
}
string arrayToString(const Value& a, char delimiter) {
string s;
for (SizeType i = 0; i < a.Size(); i++) {
s += a[i].GetString()[0];
if (i != a.Size() - 1)
s += delimiter;
}
return s;
}
bool routeContains(string s, const Value& a) {
for (SizeType i = 0; i < a.Size(); i++) {
bool dd = contains(s, a[i].GetString());
if (contains(s, a[i].GetString()))
return true;
}
return false;
}
virtual void OnFlightPlanDisconnect(CFlightPlan FlightPlan);
virtual bool OnCompileCommand(const char * sCommandLine);
virtual void debugMessage(string type, string message);
virtual void sendMessage(string type, string message);
virtual void sendMessage(string message);
virtual void checkFPDetail();
virtual string getFails(vector<string> messageBuffer);
virtual void OnTimer(int Count);
protected:
Document config;
map<string, rapidjson::SizeType> airports;
};