-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathposition.h
More file actions
51 lines (34 loc) · 793 Bytes
/
position.h
File metadata and controls
51 lines (34 loc) · 793 Bytes
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
#ifndef POSITION
#define POSITION
#include <iostream>
using namespace std;
class Pos{
public :
Pos();
Pos(int nextRow,string token,int nextPos);
int getRow();
int getPos();
string getToken();
friend ostream& operator<< (ostream& out,const Pos p);
private:
int Next;
int Row;
string _token;
};
#endif // POSITION
Pos::Pos():Next(0),Row(0),_token(""){ }
Pos::Pos(int nextRow, string token, int nextPos):Next(nextPos),Row(nextRow){
_token.append(token);
}
int Pos::getRow(){
return Row;
}
int Pos::getPos(){
return Next;
}
string Pos::getToken(){
return _token;
}
ostream& operator<< (ostream& out,const Pos p){
out<<"Row:"<<p.Row<<" "<<p._token<<" pos:"<<p.Next<<endl;
}