-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilediff.h
More file actions
63 lines (51 loc) · 1.54 KB
/
filediff.h
File metadata and controls
63 lines (51 loc) · 1.54 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
#ifndef FILEDIFF_H
#define FILEDIFF_H
#include<vector>
#include<QString>
#include<cmath>
#include<QDebug>
//将要比较的对象,由两部分组成一个是行号 一个是文本
class FileDiffItem
{
public:
FileDiffItem();
FileDiffItem(const int &num,const QString &str);
int lineindicator;
int lineindicator2;
QChar operate;
QString text;
};
struct point
{
point():x(0),y(0){}
point(int X,int Y):x(X),y(Y){}
int x;
int y;
};
bool operator ==(const FileDiffItem &a,const FileDiffItem &b);
bool operator !=(const FileDiffItem &a,const FileDiffItem &b);
bool operator ==(const point &a,const point &b);
bool operator !=(const point &a,const point &b);
int index(int k);
struct snake
{
snake():start(),mid(),end(){}
point start;
point mid;
point end;
};
struct diffresult
{
std::vector<std::vector<snake>>visited;
std::vector<snake>answer;
};
std::vector<std::vector<int> > createv(const std::vector<FileDiffItem>&from,const std::vector<FileDiffItem>&to, std::vector<std::vector<snake> > &visited);
std::vector<snake> createpath(const std::vector<FileDiffItem>&from,const std::vector<FileDiffItem>&to,std::vector<std::vector<int>>&v,std::vector<std::vector<snake>>&visited);
std::vector<FileDiffItem> operateProcess(const std::vector<FileDiffItem>&from,const std::vector<FileDiffItem>&to,const std::vector<snake>&answer);
class FileDiff
{
public:
FileDiff();
std::vector<FileDiffItem> Prepare(const std::vector<FileDiffItem>&from,const std::vector<FileDiffItem>&to);
};
#endif // FILEDIFF_H