moving along
[vrfileman] / src / fspath.h
1 #ifndef FSPATH_H_
2 #define FSPATH_H_
3
4 char *make_abs_path(const char *s);
5
6 class FSPath {
7 private:
8         char *abs_path;
9         char *name, *suffix;
10         char *parent;
11
12         void sanitize();
13
14 public:
15         FSPath();
16         FSPath(const char *s);
17         ~FSPath();
18
19         FSPath(const FSPath &p);
20         FSPath &operator =(const FSPath &p);
21
22         FSPath(FSPath &&p);
23         FSPath &operator =(FSPath &&p);
24
25         bool set_path(const char *s);
26         const char *get_path() const;
27
28         const char *get_name() const;
29         const char *get_suffix() const;
30         const char *get_parent() const;
31
32         bool append_path(const char *s);
33
34         // does this path actually exist in the filesystem?
35         bool exists() const;
36         // true if this path exists and is a regular file
37         bool is_file() const;
38         // true if this path exists and is a directory
39         bool is_dir() const;
40         // true of this path exists and is a device file
41         bool is_dev() const;
42
43         operator const char* () const;
44 };
45
46
47 #endif  // FSPATH_H_