-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatchFile.h
35 lines (27 loc) · 1.18 KB
/
PatchFile.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
#ifndef PATCHFILE_H
#define PATCHFILE_H
#include <vector>
#include <string>
class PatchFile
{
private:
static const char SYMBOL_NEW_LINE;
static const char SYMBOL_EDIT_LINE;
static const char SYMBOL_DELETE_LINE;
std::vector<std::string> vecFileOld, vecFileNew;
std::vector<long long> vecHashOld, vecHashNew;
void printHelp();
void printUseHelp();
bool fileExists(const std::string& filename);
long long calcStringHash(std::string &str);
std::string prepareFileRow(char operation, int row, std::string text);
std::vector<std::string> calcMinPrescription(int stOldPos, int enOldPos, int stNewPos, int enNewPos);
std::vector<int> calcLastRowDistanceInverse(int stOldPos, int enOldPos, int stNewPos, int enNewPos);
std::vector<int> calcLastRowDistance(int stOldPos, int enOldPos, int stNewPos, int enNewPos);
public:
PatchFile();
int startPatchUseCMD(int argc, char* argv[]);
bool createPatch(const std::string& fileNameOld, const std::string& fileNameNew, const std::string& fileNamePatch);
bool mergePatch(const std::string& fileNameOld, const std::string& fileNamePatch, const std::string& fileNameNew);
};
#endif