/
Path.h
53 lines (39 loc) · 1.11 KB
/
Path.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef PATH_H_
#define PATH_H_
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#ifdef _WIN32
#include <direct.h>
#endif
#include "Directory.h"
#include "Filename.h"
struct Path
{
Directory dir;
Filename file;
std::string type;
Path();
Path(const Directory &Dir, const Filename &File);
void set_file_path_from(const std::string &s);
std::istream& read_file_path_from(std::istream &is);
std::string str() const;
std::string comparableStr() const;
//returns whether first file was modified after second file
bool modified_after(const Path &path2) const;
bool removePath() const;
bool ensurePathExists() const;
Path getInfoPath() const;
};
//outputs path (quoted if it contains spaces)
std::ostream& operator<<(std::ostream &os, const Path &path);
//equality relation
bool operator==(const Path &path1, const Path &path2);
//inequality relation
bool operator!=(const Path &path1, const Path &path2);
//less than relation
bool operator<(const Path &path1, const Path &path2);
#endif //PATH_H_