36#if defined(_MSC_VER) || defined(__MINGW32__)
38 static constexpr value_type windows_separator =
L'\\';
39 static constexpr value_type posix_separator =
L'/';
40 static constexpr value_type preferred_separator = windows_separator;
41 static constexpr value_type alternate_separator = posix_separator;
42 static constexpr const value_type* separators =
L"/\\";
44 using value_type =
char;
45 static constexpr value_type windows_separator =
'\\';
46 static constexpr value_type posix_separator =
'/';
47 static constexpr value_type preferred_separator = posix_separator;
48 static constexpr value_type alternate_separator = windows_separator;
49 static constexpr const value_type* separators =
"/\\";
51 using string_type = std::basic_string<value_type>;
56 using iterator = string_type::iterator;
57 using const_iterator = string_type::const_iterator;
61 static const size_type npos =
static_cast<size_type
>(-1);
70 iterator begin() {
return _string.begin(); }
71 iterator end() {
return _string.end(); }
72 const_iterator begin()
const {
return _string.begin(); }
73 const_iterator end()
const {
return _string.end(); }
76 Path& assign(
const std::string&
str);
78 Path& assign(
const std::wstring&
str);
79 Path& assign(
const wchar_t*
str);
82 Path& operator=(
const std::string&
str) {
return assign(
str); }
83 Path& operator=(
const char*
str) {
return assign(
str); }
84 Path& operator=(
const std::wstring&
str) {
return assign(
str); }
85 Path& operator=(
const wchar_t*
str) {
return assign(
str); }
87 int compare(
const Path&
rhs)
const {
return _string.compare(
rhs._string); }
88 int compare(size_type
pos, size_type n,
const Path&
rhs)
const {
return _string.compare(
pos, n,
rhs._string); }
95 bool operator==(
const Path&
rhs)
const {
return compare(
rhs) == 0; }
96 bool operator!=(
const Path&
rhs)
const {
return compare(
rhs) != 0; }
105 explicit operator bool()
const noexcept {
return !_string.empty(); }
106 bool empty()
const {
return _string.empty(); }
107 size_type size()
const {
return _string.size(); }
108 size_type length()
const {
return _string.size(); }
110 inline std::string string()
const
113 convert_utf(_string, dest);
116 inline std::wstring wstring()
const
119 convert_utf(_string, dest);
123 inline const string_type& native()
const noexcept {
return _string; }
124 inline operator const string_type&()
const noexcept {
return _string; }
125 inline const value_type* c_str()
const noexcept {
return _string.c_str(); }
126#if defined(__MINGW32__)
127 inline operator const value_type*()
const noexcept
129 return _string.c_str();
139 void clear()
noexcept { _string.clear(); }
140 void swap(
Path&
rhs)
noexcept {
return _string.swap(
rhs._string); }
152 _string.push_back(
c);
165 Path substr(size_type
pos, size_type
len = Path::npos)
const {
return Path(_string.substr(
pos,
len)); }
167 size_type find(
const Path& s, size_type pos = 0)
const {
return _string.find(s._string, pos); }
168 size_type find(
const char* s, size_type pos = 0)
const {
return _string.find(convert_utf<string_type>(s), pos); }
169 size_type find(
const wchar_t* s, size_type pos = 0)
const {
return _string.find(convert_utf<string_type>(s), pos); }
171 size_type find_first_of(
const Path& s, size_type pos = 0)
const {
return _string.find_first_of(s._string, pos); }
172 size_type find_first_of(
const char* s, size_type pos = 0)
const {
return find_first_of(convert_utf<string_type>(s), pos); }
173 size_type find_first_of(
const char c, size_type pos = 0)
const {
return find_first_of(convert_utf<string_type>(c), pos); }
174 size_type find_first_of(
const wchar_t* s, size_type pos = 0)
const {
return find_first_of(convert_utf<string_type>(s), pos); }
175 size_type find_first_of(
const wchar_t c, size_type pos = 0)
const {
return find_first_of(convert_utf<string_type>(c), pos); }
177 size_type find_last_of(
const Path& s, size_type pos = npos)
const {
return _string.find_last_of(s._string, pos); }
178 size_type find_last_of(
const char* s, size_type pos = npos)
const {
return find_last_of(convert_utf<string_type>(s), pos); }
179 size_type find_last_of(
const char c, size_type pos = npos)
const {
return find_last_of(convert_utf<string_type>(c), pos); }
180 size_type find_last_of(
const wchar_t* s, size_type pos = npos)
const {
return find_last_of(convert_utf<string_type>(s), pos); }
181 size_type find_last_of(
const wchar_t c, size_type pos = npos)
const {
return find_last_of(convert_utf<string_type>(c), pos); }
183 Path& replace(size_type pos, size_type n,
const Path& str);
184 Path& replace(size_type pos, size_type n,
const std::string& str);
185 Path& replace(size_type pos, size_type n,
const std::wstring& str);
186 Path& replace(size_type pos, size_type n,
const char* str);
187 Path& replace(size_type pos, size_type n,
const wchar_t* str);
189 Path& erase(
size_t pos = 0,
size_t len = Path::npos);
191 FileType type()
const;
193 Path lexically_normal()
const;