30 #ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H 31 #define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1 33 #if __cplusplus < 201103L 47 #if __cplusplus == 201402L 51 #if defined(_WIN32) && !defined(__CYGWIN__) 52 # define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 56 namespace std _GLIBCXX_VISIBILITY(default)
58 _GLIBCXX_BEGIN_NAMESPACE_VERSION
60 namespace experimental
66 _GLIBCXX_BEGIN_NAMESPACE_CXX11
68 #if __cplusplus == 201402L 69 using std::experimental::basic_string_view;
70 #elif __cplusplus > 201402L 71 using std::basic_string_view;
82 template<
typename _CharT,
83 typename _Ch =
typename remove_const<_CharT>::type>
84 using __is_encoded_char
85 = __or_<is_same<_Ch, char>,
87 #ifdef _GLIBCXX_USE_CHAR8_T 93 template<
typename _Iter,
94 typename _Iter_traits = std::iterator_traits<_Iter>>
95 using __is_path_iter_src
96 = __and_<__is_encoded_char<typename _Iter_traits::value_type>,
98 typename _Iter_traits::iterator_category>>;
100 template<
typename _Iter>
101 static __is_path_iter_src<_Iter>
102 __is_path_src(_Iter,
int);
104 template<
typename _CharT,
typename _Traits,
typename _Alloc>
105 static __is_encoded_char<_CharT>
108 #if __cplusplus >= 201402L 109 template<
typename _CharT,
typename _Traits>
110 static __is_encoded_char<_CharT>
111 __is_path_src(
const basic_string_view<_CharT, _Traits>&,
int);
114 template<
typename _Unknown>
116 __is_path_src(
const _Unknown&, ...);
118 template<
typename _Tp1,
typename _Tp2>
119 struct __constructible_from;
121 template<
typename _Iter>
122 struct __constructible_from<_Iter, _Iter>
123 : __is_path_iter_src<_Iter>
126 template<
typename _Source>
127 struct __constructible_from<_Source, void>
128 : decltype(__is_path_src(std::declval<_Source>(), 0))
131 template<
typename _Tp1,
typename _Tp2 = void,
132 typename _Tp1_nocv =
typename remove_cv<_Tp1>::type,
133 typename _Tp1_noptr =
typename remove_pointer<_Tp1>::type>
134 using _Path =
typename 136 __not_<is_void<_Tp1_noptr>>,
137 __constructible_from<_Tp1, _Tp2>>::value,
140 template<
typename _Source>
142 _S_range_begin(_Source __begin) {
return __begin; }
144 struct __null_terminated { };
146 template<
typename _Source>
147 static __null_terminated
148 _S_range_end(_Source) {
return {}; }
150 template<
typename _CharT,
typename _Traits,
typename _Alloc>
153 {
return __str.
data(); }
155 template<
typename _CharT,
typename _Traits,
typename _Alloc>
158 {
return __str.
data() + __str.
size(); }
160 #if __cplusplus >= 201402L 161 template<
typename _CharT,
typename _Traits>
163 _S_range_begin(
const basic_string_view<_CharT, _Traits>& __str)
164 {
return __str.data(); }
166 template<
typename _CharT,
typename _Traits>
168 _S_range_end(
const basic_string_view<_CharT, _Traits>& __str)
169 {
return __str.data() + __str.size(); }
172 template<
typename _Tp,
173 typename _Iter = decltype(_S_range_begin(std::declval<_Tp>())),
174 typename _Val =
typename std::iterator_traits<_Iter>::value_type>
180 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 181 typedef wchar_t value_type;
182 static constexpr value_type preferred_separator = L
'\\';
184 typedef char value_type;
185 static constexpr value_type preferred_separator =
'/';
196 : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
198 if (_M_type == _Type::_Multi)
204 : _M_pathname(std::move(__source))
205 { _M_split_cmpts(); }
207 template<
typename _Source,
208 typename _Require = _Path<_Source>>
209 path(_Source
const& __source)
210 : _M_pathname(_S_convert(_S_range_begin(__source),
211 _S_range_end(__source)))
212 { _M_split_cmpts(); }
214 template<
typename _InputIterator,
215 typename _Require = _Path<_InputIterator, _InputIterator>>
216 path(_InputIterator __first, _InputIterator __last)
217 : _M_pathname(_S_convert(__first, __last))
218 { _M_split_cmpts(); }
220 template<
typename _Source,
221 typename _Require = _Path<_Source>,
222 typename _Require2 = __value_type_is_char<_Source>>
223 path(_Source
const& __source,
const locale& __loc)
224 : _M_pathname(_S_convert_loc(_S_range_begin(__source),
225 _S_range_end(__source), __loc))
226 { _M_split_cmpts(); }
228 template<
typename _InputIterator,
229 typename _Require = _Path<_InputIterator, _InputIterator>,
230 typename _Require2 = __value_type_is_char<_InputIterator>>
231 path(_InputIterator __first, _InputIterator __last,
const locale& __loc)
232 : _M_pathname(_S_convert_loc(__first, __last, __loc))
233 { _M_split_cmpts(); }
239 path& operator=(
const path& __p) =
default;
240 path& operator=(
path&& __p) noexcept;
244 template<
typename _Source>
246 operator=(_Source
const& __source)
247 {
return *
this =
path(__source); }
249 template<
typename _Source>
251 assign(_Source
const& __source)
252 {
return *
this =
path(__source); }
254 template<
typename _InputIterator>
255 _Path<_InputIterator, _InputIterator>&
256 assign(_InputIterator __first, _InputIterator __last)
257 {
return *
this =
path(__first, __last); }
261 path& operator/=(
const path& __p) {
return _M_append(__p._M_pathname); }
263 template <
class _Source>
265 operator/=(_Source
const& __source)
266 {
return append(__source); }
268 template<
typename _Source>
270 append(_Source
const& __source)
272 return _M_append(_S_convert(_S_range_begin(__source),
273 _S_range_end(__source)));
276 template<
typename _InputIterator>
277 _Path<_InputIterator, _InputIterator>&
278 append(_InputIterator __first, _InputIterator __last)
279 {
return _M_append(_S_convert(__first, __last)); }
285 path& operator+=(
const value_type* __x);
286 path& operator+=(value_type __x);
287 #if __cplusplus >= 201402L 288 path& operator+=(basic_string_view<value_type> __x);
291 template<
typename _Source>
293 operator+=(_Source
const& __x) {
return concat(__x); }
295 template<
typename _CharT>
296 _Path<_CharT*, _CharT*>&
297 operator+=(_CharT __x);
299 template<
typename _Source>
301 concat(_Source
const& __x)
302 {
return *
this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); }
304 template<
typename _InputIterator>
305 _Path<_InputIterator, _InputIterator>&
306 concat(_InputIterator __first, _InputIterator __last)
307 {
return *
this += _S_convert(__first, __last); }
311 void clear() noexcept { _M_pathname.
clear(); _M_split_cmpts(); }
313 path& make_preferred();
314 path& remove_filename();
315 path& replace_filename(
const path& __replacement);
316 path& replace_extension(
const path& __replacement =
path());
318 void swap(
path& __rhs) noexcept;
322 const string_type& native()
const noexcept {
return _M_pathname; }
323 const value_type* c_str()
const noexcept {
return _M_pathname.
c_str(); }
324 operator string_type()
const {
return _M_pathname; }
326 template<
typename _CharT,
typename _Traits = std::
char_traits<_CharT>,
327 typename _Allocator = std::allocator<_CharT>>
329 string(
const _Allocator& __a = _Allocator())
const;
332 #if _GLIBCXX_USE_WCHAR_T 335 #ifdef _GLIBCXX_USE_CHAR8_T 336 __attribute__((__abi_tag__(
"__u8")))
337 std::u8string u8string()
const;
340 #endif // _GLIBCXX_USE_CHAR8_T 345 template<
typename _CharT,
typename _Traits = std::
char_traits<_CharT>,
346 typename _Allocator = std::allocator<_CharT>>
348 generic_string(
const _Allocator& __a = _Allocator())
const;
351 #if _GLIBCXX_USE_WCHAR_T 354 #ifdef _GLIBCXX_USE_CHAR8_T 355 __attribute__((__abi_tag__(
"__u8")))
356 std::u8string generic_u8string()
const;
359 #endif // _GLIBCXX_USE_CHAR8_T 365 int compare(
const path& __p)
const noexcept;
367 int compare(
const value_type* __s)
const;
368 #if __cplusplus >= 201402L 369 int compare(
const basic_string_view<value_type> __s)
const;
374 path root_name()
const;
375 path root_directory()
const;
376 path root_path()
const;
377 path relative_path()
const;
378 path parent_path()
const;
379 path filename()
const;
381 path extension()
const;
385 _GLIBCXX_NODISCARD
bool empty()
const noexcept {
return _M_pathname.
empty(); }
386 bool has_root_name()
const;
387 bool has_root_directory()
const;
388 bool has_root_path()
const;
389 bool has_relative_path()
const;
390 bool has_parent_path()
const;
391 bool has_filename()
const;
392 bool has_stem()
const;
393 bool has_extension()
const;
394 bool is_absolute()
const;
395 bool is_relative()
const {
return !is_absolute(); }
405 template<
typename _InputIterator,
406 typename _Traits = std::iterator_traits<_InputIterator>,
408 =
typename std::remove_cv<typename _Traits::value_type>::type>
410 _S_string_from_iter(_InputIterator __source)
413 for (_CharT __ch = *__source; __ch != _CharT(); __ch = *++__source)
419 enum class _Type : unsigned char {
420 _Multi, _Root_name, _Root_dir, _Filename
423 path(
string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
425 __glibcxx_assert(!empty());
426 __glibcxx_assert(_M_type != _Type::_Multi);
429 enum class _Split { _Stem, _Extension };
433 if (!_M_pathname.
empty() && !_S_is_dir_sep(_M_pathname.
back())
434 && !__str.
empty() && !_S_is_dir_sep(__str.
front()))
435 _M_pathname += preferred_separator;
436 _M_pathname += __str;
443 template<
typename _CharT>
447 _S_convert(value_type* __src, __null_terminated)
451 _S_convert(
const value_type* __src, __null_terminated)
454 template<
typename _Iter>
456 _S_convert(_Iter __first, _Iter __last)
458 using __value_type =
typename std::iterator_traits<_Iter>::value_type;
459 return _Cvt<typename remove_cv<__value_type>::type>::
460 _S_convert(__first, __last);
463 template<
typename _InputIterator>
465 _S_convert(_InputIterator __src, __null_terminated)
467 auto __s = _S_string_from_iter(__src);
468 return _S_convert(__s.c_str(), __s.c_str() + __s.size());
472 _S_convert_loc(
const char* __first,
const char* __last,
475 template<
typename _Iter>
477 _S_convert_loc(_Iter __first, _Iter __last,
const std::locale& __loc)
480 return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc);
483 template<
typename _InputIterator>
485 _S_convert_loc(_InputIterator __src, __null_terminated,
488 const std::string __s = _S_string_from_iter(__src);
489 return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc);
492 static bool _S_is_dir_sep(value_type __ch)
494 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 495 return __ch == L
'/' || __ch == preferred_separator;
501 void _M_split_cmpts();
503 void _M_add_root_name(
size_t __n);
504 void _M_add_root_dir(
size_t __pos);
505 void _M_add_filename(
size_t __pos,
size_t __n);
510 using _List = _GLIBCXX_STD_C::vector<_Cmpt>;
512 _Type _M_type = _Type::_Multi;
515 inline void swap(
path& __lhs,
path& __rhs) noexcept { __lhs.swap(__rhs); }
517 size_t hash_value(
const path& __p) noexcept;
520 inline bool operator<(
const path& __lhs,
const path& __rhs) noexcept
521 {
return __lhs.compare(__rhs) < 0; }
524 inline bool operator<=(
const path& __lhs,
const path& __rhs) noexcept
525 {
return !(__rhs < __lhs); }
528 inline bool operator>(
const path& __lhs,
const path& __rhs) noexcept
529 {
return __rhs < __lhs; }
532 inline bool operator>=(
const path& __lhs,
const path& __rhs) noexcept
533 {
return !(__lhs < __rhs); }
536 inline bool operator==(
const path& __lhs,
const path& __rhs) noexcept
537 {
return __lhs.compare(__rhs) == 0; }
540 inline bool operator!=(
const path& __lhs,
const path& __rhs) noexcept
541 {
return !(__lhs == __rhs); }
546 path __result(__lhs);
552 template<
typename _CharT,
typename _Traits>
554 operator<<(basic_ostream<_CharT, _Traits>& __os,
const path& __p)
556 auto __tmp = __p.string<_CharT, _Traits>();
557 using __quoted_string
559 __os << __quoted_string{__tmp, _CharT(
'"'), _CharT(
'\\')};
564 template<
typename _CharT,
typename _Traits>
569 using __quoted_string
571 if (__is >> __quoted_string{ __tmp, _CharT(
'"'), _CharT(
'\\') })
572 __p = std::move(__tmp);
578 template<
typename _InputIterator>
580 u8path(_InputIterator __first, _InputIterator __last)
582 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 584 std::codecvt_utf8_utf16<path::value_type> __cvt;
587 const char*
const __ptr = __u8str.
data();
588 if (__str_codecvt_in_all(__ptr, __ptr + __u8str.size(), __tmp, __cvt))
589 return path{ __tmp };
590 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
591 "Cannot convert character sequence",
592 std::make_error_code(errc::illegal_byte_sequence)));
594 return path{ __first, __last };
600 template<
typename _Source>
604 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 605 std::string __s = path::_S_string_from_iter(__source);
606 return filesystem::u8path(__s.data(), __s.data() + __s.size());
608 return path{ __source };
615 filesystem_error(
const string& __what_arg,
error_code __ec)
618 filesystem_error(
const string& __what_arg,
const path& __p1,
622 filesystem_error(
const string& __what_arg,
const path& __p1,
624 :
system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2)
629 const path& path1() const noexcept {
return _M_path1; }
630 const path& path2() const noexcept {
return _M_path2; }
631 const char* what() const noexcept {
return _M_what.c_str(); }
641 struct path::_Cmpt : path
643 _Cmpt(string_type __s, _Type __t,
size_t __pos)
644 : path(
std::move(__s), __t), _M_pos(__pos) { }
646 _Cmpt() : _M_pos(-1) { }
653 struct path::_Cvt<path::value_type>
655 template<
typename _Iter>
657 _S_convert(_Iter __first, _Iter __last)
658 {
return string_type{__first, __last}; }
661 template<
typename _CharT>
664 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 666 _S_wconvert(
const char* __f,
const char* __l,
true_type)
669 const auto& __cvt = std::use_facet<_Cvt>(
std::locale{});
671 if (__str_codecvt_in_all(__f, __l, __wstr, __cvt))
673 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
674 "Cannot convert character sequence",
675 std::make_error_code(errc::illegal_byte_sequence)));
679 _S_wconvert(
const _CharT* __f,
const _CharT* __l,
false_type)
681 #ifdef _GLIBCXX_USE_CHAR8_T 682 if constexpr (is_same<_CharT, char8_t>::value)
683 return _S_wconvert((
const char*)__f, (
const char*)__l,
true_type());
687 struct _UCvt :
std::codecvt<_CharT, char, std::mbstate_t>
690 if (__str_codecvt_out_all(__f, __l, __str, __cvt))
692 const char* __f2 = __str.
data();
693 const char* __l2 = __f2 + __str.size();
694 std::codecvt_utf8_utf16<wchar_t> __wcvt;
696 if (__str_codecvt_in_all(__f2, __l2, __wstr, __wcvt))
699 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
700 "Cannot convert character sequence",
701 std::make_error_code(errc::illegal_byte_sequence)));
706 _S_convert(
const _CharT* __f,
const _CharT* __l)
708 return _S_wconvert(__f, __l, is_same<_CharT, char>{});
712 _S_convert(
const _CharT* __f,
const _CharT* __l)
714 #ifdef _GLIBCXX_USE_CHAR8_T 715 if constexpr (is_same<_CharT, char8_t>::value)
716 return string_type(__f, __l);
720 struct _UCvt :
std::codecvt<_CharT, char, std::mbstate_t>
723 if (__str_codecvt_out_all(__f, __l, __str, __cvt))
725 #ifdef _GLIBCXX_USE_CHAR8_T 728 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
729 "Cannot convert character sequence",
730 std::make_error_code(errc::illegal_byte_sequence)));
735 _S_convert(_CharT* __f, _CharT* __l)
737 return _S_convert(const_cast<const _CharT*>(__f),
738 const_cast<const _CharT*>(__l));
741 template<
typename _Iter>
743 _S_convert(_Iter __first, _Iter __last)
746 return _S_convert(__str.data(), __str.data() + __str.size());
749 template<
typename _Iter,
typename _Cont>
751 _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first,
752 __gnu_cxx::__normal_iterator<_Iter, _Cont> __last)
753 {
return _S_convert(__first.base(), __last.base()); }
760 using difference_type = std::ptrdiff_t;
766 iterator() : _M_path(
nullptr), _M_cur(), _M_at_end() { }
775 iterator operator++(
int) {
auto __tmp = *
this; ++*
this;
return __tmp; }
778 iterator operator--(
int) {
auto __tmp = *
this; --*
this;
return __tmp; }
781 {
return __lhs._M_equals(__rhs); }
784 {
return !__lhs._M_equals(__rhs); }
789 iterator(
const path* __path, path::_List::const_iterator __iter)
790 : _M_path(__path), _M_cur(__iter), _M_at_end()
794 : _M_path(__path), _M_cur(), _M_at_end(__at_end)
800 path::_List::const_iterator _M_cur;
806 path::operator=(
path&& __p) noexcept
808 _M_pathname = std::move(__p._M_pathname);
809 _M_cmpts = std::move(__p._M_cmpts);
810 _M_type = __p._M_type;
816 path::operator=(string_type&& __source)
817 {
return *
this =
path(std::move(__source)); }
820 path::assign(string_type&& __source)
821 {
return *
this = path(std::move(__source)); }
824 path::operator+=(
const path& __p)
826 return operator+=(__p.native());
830 path::operator+=(
const string_type& __x)
838 path::operator+=(
const value_type* __x)
846 path::operator+=(value_type __x)
853 #if __cplusplus >= 201402L 855 path::operator+=(basic_string_view<value_type> __x)
857 _M_pathname.
append(__x.data(), __x.size());
863 template<
typename _CharT>
864 inline path::_Path<_CharT*, _CharT*>&
865 path::operator+=(_CharT __x)
868 return concat(__addr, __addr + 1);
872 path::make_preferred()
874 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 876 preferred_separator);
881 inline void path::swap(path& __rhs) noexcept
883 _M_pathname.swap(__rhs._M_pathname);
884 _M_cmpts.swap(__rhs._M_cmpts);
885 std::swap(_M_type, __rhs._M_type);
888 template<
typename _CharT,
typename _Traits,
typename _Allocator>
892 if (is_same<_CharT, value_type>::value)
893 return { _M_pathname.
begin(), _M_pathname.
end(), __a };
895 using _WString = basic_string<_CharT, _Traits, _Allocator>;
897 const value_type* __first = _M_pathname.
data();
898 const value_type* __last = __first + _M_pathname.
size();
900 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 901 using _CharAlloc = __alloc_rebind<_Allocator, char>;
902 using _String = basic_string<char, char_traits<char>, _CharAlloc>;
906 codecvt_utf8_utf16<value_type> __cvt;
907 _String __u8str{_CharAlloc{__a}};
908 if (__str_codecvt_out_all(__first, __last, __u8str, __cvt))
913 operator()(
const _String& __from, _String&,
true_type)
917 operator()(
const _String& __from, _WString& __to,
false_type)
919 #ifdef _GLIBCXX_USE_CHAR8_T 920 if constexpr (is_same<_CharT, char8_t>::value)
922 __to.assign(__from.begin(), __from.end());
929 struct _UCvt :
std::codecvt<_CharT, char, std::mbstate_t>
931 const char* __f = __from.data();
932 const char* __l = __f + __from.size();
933 if (__str_codecvt_in_all(__f, __l, __to, __cvt))
939 _WString __wstr(__a);
940 if (
auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{}))
944 #ifdef _GLIBCXX_USE_CHAR8_T 945 if constexpr (is_same<_CharT, char8_t>::value)
946 return _WString(__first, __last, __a);
950 struct _UCvt :
std::codecvt<_CharT, char, std::mbstate_t> { } __cvt;
951 _WString __wstr(__a);
952 if (__str_codecvt_in_all(__first, __last, __wstr, __cvt))
956 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
957 "Cannot convert character sequence",
958 std::make_error_code(errc::illegal_byte_sequence)));
962 path::string()
const {
return string<char>(); }
964 #if _GLIBCXX_USE_WCHAR_T 966 path::wstring()
const {
return string<wchar_t>(); }
969 #ifdef _GLIBCXX_USE_CHAR8_T 971 path::u8string()
const {
return string<char8_t>(); }
974 path::u8string()
const 976 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 979 std::codecvt_utf8_utf16<value_type> __cvt;
980 const value_type* __first = _M_pathname.
data();
981 const value_type* __last = __first + _M_pathname.
size();
982 if (__str_codecvt_out_all(__first, __last, __str, __cvt))
984 _GLIBCXX_THROW_OR_ABORT(filesystem_error(
985 "Cannot convert character sequence",
986 std::make_error_code(errc::illegal_byte_sequence)));
991 #endif // _GLIBCXX_USE_CHAR8_T 994 path::u16string()
const {
return string<char16_t>(); }
997 path::u32string()
const {
return string<char32_t>(); }
999 #ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS 1000 template<
typename _CharT,
typename _Traits,
typename _Allocator>
1002 path::generic_string(
const _Allocator& __a)
const 1003 {
return string<_CharT, _Traits, _Allocator>(__a); }
1006 path::generic_string()
const {
return string(); }
1008 #if _GLIBCXX_USE_WCHAR_T 1010 path::generic_wstring()
const {
return wstring(); }
1013 #ifdef _GLIBCXX_USE_CHAR8_T 1014 inline std::u8string
1015 path::generic_u8string()
const {
return u8string(); }
1018 path::generic_u8string()
const {
return u8string(); }
1022 path::generic_u16string()
const {
return u16string(); }
1025 path::generic_u32string()
const {
return u32string(); }
1029 path::compare(
const string_type& __s)
const {
return compare(path(__s)); }
1032 path::compare(
const value_type* __s)
const {
return compare(path(__s)); }
1034 #if __cplusplus >= 201402L 1036 path::compare(basic_string_view<value_type> __s)
const 1037 {
return compare(path(__s)); }
1041 path::filename()
const {
return empty() ? path() : *--end(); }
1046 auto ext = _M_find_extension();
1047 if (ext.first && ext.second != 0)
1048 return path{ext.first->substr(0, ext.second)};
1053 path::extension()
const 1055 auto ext = _M_find_extension();
1057 return path{ext.first->substr(ext.second)};
1062 path::has_stem()
const 1064 auto ext = _M_find_extension();
1065 return ext.first && ext.second != 0;
1069 path::has_extension()
const 1071 auto ext = _M_find_extension();
1076 path::is_absolute()
const 1078 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS 1079 return has_root_name() && has_root_directory();
1081 return has_root_directory();
1085 inline path::iterator
1088 if (_M_type == _Type::_Multi)
1089 return iterator(
this, _M_cmpts.
begin());
1090 return iterator(
this,
false);
1093 inline path::iterator
1096 if (_M_type == _Type::_Multi)
1097 return iterator(
this, _M_cmpts.
end());
1098 return iterator(
this,
true);
1101 inline path::iterator&
1102 path::iterator::operator++()
1104 __glibcxx_assert(_M_path !=
nullptr);
1105 if (_M_path->_M_type == _Type::_Multi)
1107 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.
end());
1112 __glibcxx_assert(!_M_at_end);
1118 inline path::iterator&
1119 path::iterator::operator--()
1121 __glibcxx_assert(_M_path !=
nullptr);
1122 if (_M_path->_M_type == _Type::_Multi)
1124 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin());
1129 __glibcxx_assert(_M_at_end);
1135 inline path::iterator::reference
1136 path::iterator::operator*()
const 1138 __glibcxx_assert(_M_path !=
nullptr);
1139 if (_M_path->_M_type == _Type::_Multi)
1141 __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end());
1148 path::iterator::_M_equals(iterator __rhs)
const 1150 if (_M_path != __rhs._M_path)
1152 if (_M_path ==
nullptr)
1154 if (_M_path->_M_type == path::_Type::_Multi)
1155 return _M_cur == __rhs._M_cur;
1156 return _M_at_end == __rhs._M_at_end;
1160 _GLIBCXX_END_NAMESPACE_CXX11
1165 _GLIBCXX_END_NAMESPACE_VERSION
1170 #endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
static const size_type npos
Value returned by various member functions when they fail.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
ISO C++ entities toplevel namespace is std.
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
A string of char.
Primary class template codecvt.NB: Generic, mostly useless implementation.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
const _CharT * data() const noexcept
Return const pointer to contents.
basic_string & append(const basic_string &__str)
Append a string to this string.
Template class basic_ostream.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
void push_back(_CharT __c)
Append a single character.
An iterator for the components of a path.
_GLIBCXX_NODISCARD bool empty() const noexcept
Template class basic_istream.
Thrown to indicate error code of underlying system.
iterator begin() noexcept
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
void replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__old_value, const _Tp &__new_value)
Replace each occurrence of one value in a sequence with another value.
_GLIBCXX20_CONSTEXPR complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
Class codecvt<wchar_t, char, mbstate_t> specialization.
path u8path(_InputIterator __first, _InputIterator __last)
Create a path from a UTF-8-encoded sequence of char.
Managing sequences of characters and character-like objects.
Struct holding two objects of arbitrary type.
Bidirectional iterators support a superset of forward iterator operations.
Struct for delimited strings.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
Define a member typedef type only if a boolean constant is true.