-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.h
More file actions
100 lines (72 loc) · 1.76 KB
/
parser.h
File metadata and controls
100 lines (72 loc) · 1.76 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
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
//
// Created by adi on 04/07/19.
//
#ifndef VECTORPARSER_PARSER_H
#define VECTORPARSER_PARSER_H
#include <map>
#include <vector>
struct dirVec{
dirVec(double x, double y, double z);
dirVec() = default;
void printInfo();
double x;
double y;
double z;
};
struct point{
point(double x, double y, double z);
point() = default;
dirVec minus(point b);
void printInfo();
double x;
double y;
double z;
};
struct vec{
vec(point a, point b);
//vec(double x, double y, double z);
vec(dirVec dirP, point a);
vec() = default;
void printInfo();
point center;
dirVec dir;
};
struct plane{
plane(point a, point ac, point c);
plane(vec b, vec c, point a);
plane(vec a, point b);
void printInfo();
point center;
vec dir1;
vec dir2;
};
struct line{
line(int lineNum, std::string lineVal);
int lineNum;
std::string lineVal;
};
class parser {
public:
bool readLine(line l);
private:
point makePoint(std::string line);
void addPoint(std::string l);
vec makeVector(std::string l);
void addVector(std::string line);
// vec makeVectorTest(std::string l);
void addDirVec(std::string line);
dirVec makeDirVec(std::string line);
int count(std::string l, std::string regex);
void error(std::string errMsg);
std::string replace(std::string newS,std::string oldS,std::string p);
std::vector<std::string> seperateArgs(std::string l);
void displayAll();
int currentLineNum;
std::string currentLineVal;
bool err = false;
std::map <std::string, point> points;
std::map <std::string, dirVec> dirVecs;
std::map <std::string, vec> vecs;
std::map <std::string, plane> planes;
};
#endif //VECTORPARSER_PARSER_H