1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2007-2014 Christian Schoenebeck * |
* Copyright (C) 2007-2017 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
50 |
Path(); |
Path(); |
51 |
|
|
52 |
/** |
/** |
53 |
* Creates a path object according to the local system's path conventions. |
* Creates a Path object according to the local system's path conventions. |
54 |
* @see fromPosix(), fromWindows(), fromDbPath() |
* That means to construct this Path object it uses fromPosix() on POSIX |
55 |
|
* compliant systems (i.e. Linux, Mac) and fromWindows() on Windows systems. |
56 |
|
* |
57 |
|
* If you have no information in which file system encoding the path string |
58 |
|
* was encoded as, then rather use fromUnknownFS() instead. |
59 |
|
* |
60 |
|
* @see fromUnknownFS(), fromPosix(), fromWindows(), fromDbPath() |
61 |
*/ |
*/ |
62 |
Path(std::string path); |
Path(std::string path); |
63 |
|
|
78 |
void setDrive(const char& Drive); |
void setDrive(const char& Drive); |
79 |
|
|
80 |
/** |
/** |
81 |
|
* Returns file system path of this Path object as String in correct |
82 |
|
* encoding as expected by the local file system calls. Essentially that |
83 |
|
* means this software returns toWindows() on Windows systems, toPosix() |
84 |
|
* on POSIX compliant systems like Linux and Mac. |
85 |
|
*/ |
86 |
|
std::string toNativeFSPath() const; |
87 |
|
|
88 |
|
/** |
89 |
* Convert this Path into the correct encoding as expected by POSIX |
* Convert this Path into the correct encoding as expected by POSIX |
90 |
* compliant system calls. |
* compliant system calls. |
91 |
|
* |
92 |
|
* @see toNativeFSPath() |
93 |
*/ |
*/ |
94 |
std::string toPosix() const; |
std::string toPosix() const; |
95 |
|
|
108 |
/** |
/** |
109 |
* Convert this Path into the correct encoding as expected by Windows |
* Convert this Path into the correct encoding as expected by Windows |
110 |
* operating systems. |
* operating systems. |
111 |
|
* |
112 |
|
* @see toNativeFSPath() |
113 |
*/ |
*/ |
114 |
std::string toWindows() const; |
std::string toWindows() const; |
115 |
|
|
124 |
Path operator+(const Path* p); |
Path operator+(const Path* p); |
125 |
|
|
126 |
/** |
/** |
127 |
|
* Attempts to auto detect the file system the supplied filename string |
128 |
|
* was encoded for, and then creates and returns a corresponding Path |
129 |
|
* object. This method only auto detects file system encodings of Windows |
130 |
|
* and POSIX (i.e. Linux and Mac). This method does @b NOT detect any other |
131 |
|
* encodings like DB path for example. |
132 |
|
*/ |
133 |
|
static Path fromUnknownFS(std::string path); |
134 |
|
|
135 |
|
/** |
136 |
* Create a Path object from a POSIX path / filename string. |
* Create a Path object from a POSIX path / filename string. |
137 |
*/ |
*/ |
138 |
static Path fromPosix(std::string path); |
static Path fromPosix(std::string path); |
152 |
* this path in abstract/raw form. This is the last name in |
* this path in abstract/raw form. This is the last name in |
153 |
* the path's name sequence. |
* the path's name sequence. |
154 |
*/ |
*/ |
155 |
std::string getName(); |
std::string getName() const; |
156 |
|
|
157 |
/** |
/** |
158 |
* Returns the name of the file or directory |
* Returns the name of the file or directory |
177 |
* Returns the last name in the path's name sequence |
* Returns the last name in the path's name sequence |
178 |
* of this path with the file extension stripped off. |
* of this path with the file extension stripped off. |
179 |
*/ |
*/ |
180 |
std::string getBaseName(); |
std::string getBaseName() const; |
181 |
|
|
182 |
/** |
/** |
183 |
* Returns the last name in the path's name sequence |
* Returns the last name in the path's name sequence |