LLFIO v2.00
Loading...
Searching...
No Matches
llfio_v2_xxx::path_view_component Class Reference

An iterated part of a path_view. More...

#include "path_view.hpp"

Inheritance diagram for llfio_v2_xxx::path_view_component:
llfio_v2_xxx::path_view

Classes

class  rendered_path
 

Public Types

enum  format : uint8_t {
  unknown , native_format , generic_format , auto_format ,
  binary_format
}
 How to interpret separators. More...
 
enum  termination { zero_terminated , not_zero_terminated }
 The zero termination to use. More...
 
using size_type = filesystem::path::string_type::size_type
 The size type.
 
using byte = llfio_v2_xxx ::byte
 Character type for passthrough input.
 
using char16_t = detail::char16_t
 
template<class T >
using default_rendered_path_deleter = std::default_delete< T >
 The default deleter to use.
 
template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size>
using zero_terminated_rendered_path = rendered_path< termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size >
 Convenience type alias.
 
template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size>
using not_zero_terminated_rendered_path = rendered_path< termination::not_zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size >
 Convenience type alias.
 

Public Member Functions

constexpr path_view_component () noexcept
 Constructs an empty path view component (DEVIATES from P1030, is not trivial due to C++ 14 compatibility)
 
constexpr path_view_component (path_view_component p, format fmt) noexcept
 Constructs a path view component identical to the input, except with different format interpretation.
 
 path_view_component (const filesystem::path &v, format fmt=auto_format) noexcept
 
template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr path_view_component (const std::basic_string< Char > &v, format fmt=binary_format) noexcept
 
constexpr path_view_component (const char *b, size_t l, enum termination zt, format fmt=binary_format) noexcept
 
constexpr path_view_component (const wchar_t *b, size_t l, enum termination zt, format fmt=binary_format) noexcept
 
constexpr path_view_component (const char8_t *b, size_t l, enum termination zt, format fmt=binary_format) noexcept
 
constexpr path_view_component (const char16_t *b, size_t l, enum termination zt, format fmt=binary_format) noexcept
 
constexpr path_view_component (const byte *b, size_t l, enum termination zt) noexcept
 
template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr path_view_component (const Char *s, format fmt=binary_format) noexcept
 
constexpr path_view_component (const byte *s) noexcept
 
template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr path_view_component (basic_string_view< Char > v, enum termination zt, format fmt=binary_format) noexcept
 
constexpr path_view_component (span< const byte > v, enum termination zt) noexcept
 
template<class It , class End , typename std::enable_if<(is_source_chartype_acceptable< typename It::value_type >), bool >::type = true, typename std::enable_if<(is_source_chartype_acceptable< typename End::value_type >), bool >::type = true>
constexpr path_view_component (It b, End e, enum termination zt, format fmt=binary_format) noexcept
 
template<class It , class End , typename std::enable_if<(is_source_chartype_acceptable< std::decay_t< It > >), bool >::type = true, typename std::enable_if<(is_source_chartype_acceptable< std::decay_t< End > >), bool >::type = true>
constexpr path_view_component (It *b, End *e, enum termination zt, format fmt=binary_format) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class It , class End , typename std::enable_if<(std::is_same< typename It::value_type, byte >::value), bool >::type = true, typename std::enable_if<(std::is_same< typename End::value_type, byte >::value), bool >::type = true>
constexpr path_view_component (It b, End e, enum termination zt) noexcept
 
template<class It , class End , typename std::enable_if<(std::is_same< std::decay_t< It >, byte >::value), bool >::type = true, typename std::enable_if<(std::is_same< std::decay_t< End >, byte >::value), bool >::type = true>
constexpr path_view_component (It *b, End *e, enum termination zt) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 path_view_component (const path_view_component &)=default
 
 path_view_component (path_view_component &&)=default
 
path_view_componentoperator= (const path_view_component &)=default
 
path_view_componentoperator= (path_view_component &&)=default
 
const byte_raw_data () const noexcept
 
constexpr void swap (path_view_component &o) noexcept
 Swap the view with another.
 
constexpr bool empty () const noexcept
 True if empty.
 
constexpr size_t native_size () const noexcept
 Returns the size of the view in characters.
 
constexpr format formatting () const noexcept
 How path separators shall be interpreted.
 
constexpr bool has_null_termination () const noexcept
 True if input is declared to be null terminated.
 
constexpr enum termination termination () const noexcept
 The zero termination during construction.
 
constexpr bool has_stem () const noexcept
 True if stem() returns a non-empty path.
 
constexpr bool has_extension () const noexcept
 True if extension() returns a non-empty path.
 
constexpr bool contains_glob () const noexcept
 True if the view contains any of the characters *, ?, (POSIX only: [ or ]).
 
constexpr path_view_component stem () const noexcept
 Returns a view of the filename without any file extension.
 
constexpr path_view_component extension () const noexcept
 Returns a view of the file extension part of this view.
 
filesystem::path path () const
 Return the path view as a path. Allocates and copies memory!
 
template<class T = typename filesystem::path::value_type, class Deleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
constexpr int compare (path_view_component p, const std::locale &loc) const
 
template<class T = typename filesystem::path::value_type, class Deleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
constexpr int compare (path_view_component p) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<enum path_view_component::termination ZeroTermination, class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size > render (path_view_component view, Args &&...args) const
 Convenience function.
 
template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size > render_null_terminated (Args &&...args) const
 Convenience function.
 
template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< termination::not_zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size > render_unterminated (Args &&...args) const
 Convenience function.
 

Static Public Attributes

static constexpr auto preferred_separator = filesystem::path::preferred_separator
 The preferred separator type.
 
template<class Char >
static constexpr bool is_source_chartype_acceptable = detail::is_source_chartype_acceptable<Char>::value
 
template<class Char >
static constexpr bool is_source_acceptable = detail::is_source_acceptable<Char>::value
 
static constexpr size_t default_internal_buffer_size = 1024
 The default internal buffer size used by rendered_path.
 

Friends

class path_view
 
template<enum path_view_component::termination ZeroTermination, class T , class Deleter , size_t _internal_buffer_size, typename std::enable_if<(is_source_acceptable< T >), bool >::type >
class rendered_path
 
constexpr bool llfio_v2_xxx::operator== (path_view_component x, path_view_component y) noexcept
 
constexpr bool llfio_v2_xxx::operator!= (path_view_component x, path_view_component y) noexcept
 
constexpr bool llfio_v2_xxx ::operator< (path_view_component x, path_view_component y) noexcept
 
constexpr size_t hash_value (path_view_component x) noexcept
 Hashes a path_view_component.
 
template<class F >
constexpr auto llfio_v2_xxx::visit (path_view_component view, F &&f)
 
template<class F >
constexpr auto llfio_v2_xxx::visit (F &&f, path_view_component view)
 
std::ostream & llfio_v2_xxx ::operator<< (std::ostream &s, const path_view_component &v)
 

Detailed Description

An iterated part of a path_view.

Member Enumeration Documentation

◆ format

How to interpret separators.

Enumerator
native_format 

Separate at the native path separator only.

generic_format 

Separate at the generic path separator only.

auto_format 

Separate at both the native and generic path separators.

binary_format 

Do not separate at any path separator.

313 {
314 unknown,
315 native_format, //!< Separate at the native path separator only.
316 generic_format, //!< Separate at the generic path separator only.
317 auto_format, //!< Separate at both the native and generic path separators.
318 binary_format //!< Do not separate at any path separator.
319 };
@ generic_format
Separate at the generic path separator only.
Definition path_view.hpp:316
@ binary_format
Do not separate at any path separator.
Definition path_view.hpp:318
@ auto_format
Separate at both the native and generic path separators.
Definition path_view.hpp:317
@ native_format
Separate at the native path separator only.
Definition path_view.hpp:315

◆ termination

The zero termination to use.

Enumerator
zero_terminated 

The input is zero terminated, or requested output ought to be zero terminated.

not_zero_terminated 

The input is not zero terminated, or requested output ought to not be zero terminated.

323 {
324 zero_terminated, //!< The input is zero terminated, or requested output ought to be zero terminated.
325 not_zero_terminated, //!< The input is not zero terminated, or requested output ought to not be zero terminated.
326 };
@ not_zero_terminated
The input is not zero terminated, or requested output ought to not be zero terminated.
Definition path_view.hpp:325
@ zero_terminated
The input is zero terminated, or requested output ought to be zero terminated.
Definition path_view.hpp:324

Constructor & Destructor Documentation

◆ path_view_component() [1/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( )
inlineconstexprnoexcept

Constructs an empty path view component (DEVIATES from P1030, is not trivial due to C++ 14 compatibility)

355 : _zero_terminated(false)
356 , _passthrough(false)
357 , _char(false)
358 , _wchar(false)
359 , _utf8(false)
360 , _utf16(false)
361 , _reserved1(0)
362 {
363 } // NOLINT

◆ path_view_component() [2/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( path_view_component  p,
format  fmt 
)
inlineconstexprnoexcept

Constructs a path view component identical to the input, except with different format interpretation.

366 : _charstr(p._charstr)
367 , _length(p._length)
368 , _zero_terminated(p._zero_terminated)
369 , _passthrough(p._passthrough)
370 , _char(p._char)
371 , _wchar(p._wchar)
372 , _utf8(p._utf8)
373 , _utf16(p._utf16)
374 , _reserved1(p._reserved1)
375 , _format(fmt)
376 {
377 }

◆ path_view_component() [3/17]

llfio_v2_xxx::path_view_component::path_view_component ( const filesystem::path &  v,
format  fmt = auto_format 
)
inlinenoexcept

Implicitly constructs a path view from a path. The input path MUST continue to exist for this view to be valid (DEVIATES from P1030 due to filesystem::path not exposing its path formatting).

382 : path_view_component(v.native().c_str(), v.native().size(), zero_terminated, fmt)
383 {
384 }
constexpr path_view_component() noexcept
Constructs an empty path view component (DEVIATES from P1030, is not trivial due to C++ 14 compatibil...
Definition path_view.hpp:354

◆ path_view_component() [4/17]

template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( const std::basic_string< Char > &  v,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a basic string if the character type is one of char, wchar_t, char8_t or char16_t.

391 : path_view_component(v.data(), v.size(), zero_terminated, fmt)
392 {
393 }

◆ path_view_component() [5/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const char *  b,
size_t  l,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a lengthed array of one of char, wchar_t, char8_t or char16_t. The input string MUST continue to exist for this view to be valid.

398 : _charstr((l == 0) ? nullptr : b)
399 , _length((l == 0) ? 0 : l)
400 , _zero_terminated((l == 0) ? false : (zt == zero_terminated))
401 , _passthrough(false)
402 , _char((l == 0) ? false : true)
403 , _wchar(false)
404 , _utf8(false)
405 , _utf16(false)
406 , _reserved1(0)
407 , _format(fmt)
408 {
409 }

◆ path_view_component() [6/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const wchar_t *  b,
size_t  l,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a lengthed array of one of char, wchar_t, char8_t or char16_t. The input string MUST continue to exist for this view to be valid.

414 : _wcharstr((l == 0) ? nullptr : b)
415 , _length((l == 0) ? 0 : l)
416 , _zero_terminated((l == 0) ? false : (zt == zero_terminated))
417 , _passthrough(false)
418 , _char(false)
419 , _wchar((l == 0) ? false : true)
420 , _utf8(false)
421 , _utf16(false)
422 , _reserved1(0)
423 , _format(fmt)
424 {
425 }

◆ path_view_component() [7/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const char8_t *  b,
size_t  l,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a lengthed array of one of char, wchar_t, char8_t or char16_t. The input string MUST continue to exist for this view to be valid.

430 : _char8str((l == 0) ? nullptr : b)
431 , _length((l == 0) ? 0 : l)
432 , _zero_terminated((l == 0) ? false : (zt == zero_terminated))
433 , _passthrough(false)
434 , _char(false)
435 , _wchar(false)
436 , _utf8((l == 0) ? false : true)
437 , _utf16(false)
438 , _reserved1(0)
439 , _format(fmt)
440 {
441 }

◆ path_view_component() [8/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const char16_t *  b,
size_t  l,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a lengthed array of one of char, wchar_t, char8_t or char16_t. The input string MUST continue to exist for this view to be valid.

446 : _char16str((l == 0) ? nullptr : b)
447 , _length((l == 0) ? 0 : l)
448 , _zero_terminated((l == 0) ? false : (zt == zero_terminated))
449 , _passthrough(false)
450 , _char(false)
451 , _wchar(false)
452 , _utf8(false)
453 , _utf16((l == 0) ? false : true)
454 , _reserved1(0)
455 , _format(fmt)
456 {
457 }

◆ path_view_component() [9/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const byte b,
size_t  l,
enum termination  zt 
)
inlineconstexprnoexcept

Constructs from a lengthed array of byte. The input array MUST continue to exist for this view to be valid.

462 : _bytestr((l == 0) ? nullptr : b)
463 , _length((l == 0) ? 0 : l)
464 , _zero_terminated((l == 0) ? false : (zt == zero_terminated))
465 , _passthrough((l == 0) ? false : true)
466 , _char(false)
467 , _wchar(false)
468 , _utf8(false)
469 , _utf16(false)
470 , _reserved1(0)
471 , _format(binary_format)
472 {
473 }

◆ path_view_component() [10/17]

template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( const Char *  s,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Implicitly constructs a path view from a zero terminated pointer to a character array, which must be one of char, wchar_t, char8_t or char16_t. The input string MUST continue to exist for this view to be valid.

482 : path_view_component(s, detail::constexpr_strlen(s), zero_terminated, fmt)
483 {
484 }

◆ path_view_component() [11/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( const byte s)
inlineconstexprnoexcept

Implicitly constructs a path view from a zero terminated pointer to byte array. The input array MUST continue to exist for this view to be valid.

489 : path_view_component(s, detail::constexpr_strlen(s), zero_terminated)
490 {
491 }

◆ path_view_component() [12/17]

template<class Char , typename std::enable_if<(is_source_chartype_acceptable< Char >), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( basic_string_view< Char >  v,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from a basic string view if the character type is one of char, wchar_t, char8_t or char16_t.

499 : path_view_component(v.data(), v.size(), zt, fmt)
500 {
501 }

◆ path_view_component() [13/17]

constexpr llfio_v2_xxx::path_view_component::path_view_component ( span< const byte v,
enum termination  zt 
)
inlineconstexprnoexcept

Constructs from a span<const byte>.

505 : path_view_component(v.data(), v.size(), zt)
506 {
507 }

◆ path_view_component() [14/17]

template<class It , class End , typename std::enable_if<(is_source_chartype_acceptable< typename It::value_type >), bool >::type = true, typename std::enable_if<(is_source_chartype_acceptable< typename End::value_type >), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( It  b,
End  e,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

Constructs from an iterator sequence if the iterator is contiguous, if its value type is one of char, wchar_t, char8_t or char16_t.

(DEVIATES from P1030, cannot detect contiguous iterator in SFINAE in C++ 14)

518 : path_view_component(addressof(*b), e - b, zt, fmt)
519 {
520 }

◆ path_view_component() [15/17]

template<class It , class End , typename std::enable_if<(is_source_chartype_acceptable< std::decay_t< It > >), bool >::type = true, typename std::enable_if<(is_source_chartype_acceptable< std::decay_t< End > >), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( It *  b,
End *  e,
enum termination  zt,
format  fmt = binary_format 
)
inlineconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

526 : path_view_component(b, e - b, zt, fmt)
527 {
528 }

◆ path_view_component() [16/17]

template<class It , class End , typename std::enable_if<(std::is_same< typename It::value_type, byte >::value), bool >::type = true, typename std::enable_if<(std::is_same< typename End::value_type, byte >::value), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( It  b,
End  e,
enum termination  zt 
)
inlineconstexprnoexcept

Constructs from an iterator sequence if the iterator is contiguous, if its value type is byte.

(DEVIATES from P1030, cannot detect contiguous iterator in SFINAE in C++ 14)

538 : path_view_component(addressof(*b), e - b, zt, binary_format)
539 {
540 }

◆ path_view_component() [17/17]

template<class It , class End , typename std::enable_if<(std::is_same< std::decay_t< It >, byte >::value), bool >::type = true, typename std::enable_if<(std::is_same< std::decay_t< End >, byte >::value), bool >::type = true>
constexpr llfio_v2_xxx::path_view_component::path_view_component ( It *  b,
End *  e,
enum termination  zt 
)
inlineconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

546 : path_view_component(b, e - b, zt, binary_format)
547 {
548 }

Member Function Documentation

◆ _raw_data()

const byte * llfio_v2_xxx::path_view_component::_raw_data ( ) const
inlinenoexcept
683{ return _bytestr; }

◆ compare() [1/2]

template<class T = typename filesystem::path::value_type, class Deleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
constexpr int llfio_v2_xxx::path_view_component::compare ( path_view_component  p) const
inlineconstexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

891 {
892 return _invoke(
893 [&](const auto &self)
894 {
895 return p._invoke(
896 [&](const auto &other)
897 { return _compare<T, Deleter, _internal_buffer_size>(self, termination(), other, p.termination(), nullptr); });
898 });
899 }
termination
The zero termination to use.
Definition path_view.hpp:323

◆ compare() [2/2]

template<class T = typename filesystem::path::value_type, class Deleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
constexpr int llfio_v2_xxx::path_view_component::compare ( path_view_component  p,
const std::locale &  loc 
) const
inlineconstexpr

Compares the two path views for equivalence or ordering using T as the destination encoding, if necessary.

If the source encodings of the two path views are compatible, a lexicographical comparison is performed. If they are incompatible, either or both views are converted to the destination encoding using rendered_path<T, Delete, _internal_buffer_size>, and then a lexicographical comparison is performed.

This can, for obvious reasons, be expensive. It can also throw exceptions, as rendered_path does.

If the destination encoding is byte, memcmp() is used, and rendered_path is never invoked as the two sources are byte compared directly.

877 {
878 return _invoke(
879 [&](const auto &self)
880 {
881 return p._invoke(
882 [&](const auto &other)
883 { return _compare<T, Deleter, _internal_buffer_size>(self, termination(), other, p.termination(), &loc); });
884 });
885 }

◆ contains_glob()

constexpr bool llfio_v2_xxx::path_view_component::contains_glob ( ) const
inlineconstexprnoexcept

True if the view contains any of the characters *, ?, (POSIX only: [ or ]).

720 {
721 return _invoke(
722 [](const auto &v)
723 {
724 using value_type = typename std::remove_reference<decltype(*v.data())>::type;
725#ifdef _WIN32
726 const value_type *tofind = (sizeof(value_type) > 1) ? (const value_type *) L"*?" : (const value_type *) "*?";
727#else
728 const value_type *tofind = (sizeof(value_type) > 1) ? (const value_type *) L"*?[]" : (const value_type *) "*?[]";
729#endif
730 return string_view::npos != v.find_first_of(tofind);
731 });
732 }

◆ empty()

constexpr bool llfio_v2_xxx::path_view_component::empty ( ) const
inlineconstexprnoexcept

True if empty.

694{ return _length == 0; }

◆ extension()

constexpr path_view_component llfio_v2_xxx::path_view_component::extension ( ) const
inlineconstexprnoexcept

Returns a view of the file extension part of this view.

751 {
752 auto self = _filename();
753 return self._invoke(
754 [this](const auto &v)
755 {
756 auto dot_idx = v.rfind('.');
757 if(_npos == dot_idx || dot_idx == 0 || (dot_idx == 1 && v[dot_idx - 1] == '.'))
758 {
759 return path_view_component();
760 }
761 return path_view_component(v.data() + dot_idx, v.size() - dot_idx, termination());
762 });
763 }

◆ formatting()

constexpr format llfio_v2_xxx::path_view_component::formatting ( ) const
inlineconstexprnoexcept

How path separators shall be interpreted.

703{ return _format; }

◆ has_extension()

constexpr bool llfio_v2_xxx::path_view_component::has_extension ( ) const
inlineconstexprnoexcept

True if extension() returns a non-empty path.

716{ return !extension().empty(); }
constexpr path_view_component extension() const noexcept
Returns a view of the file extension part of this view.
Definition path_view.hpp:750
constexpr bool empty() const noexcept
True if empty.
Definition path_view.hpp:694

◆ has_null_termination()

constexpr bool llfio_v2_xxx::path_view_component::has_null_termination ( ) const
inlineconstexprnoexcept

True if input is declared to be null terminated.

706{ return _zero_terminated; }

◆ has_stem()

constexpr bool llfio_v2_xxx::path_view_component::has_stem ( ) const
inlineconstexprnoexcept

True if stem() returns a non-empty path.

714{ return !stem().empty(); }
constexpr path_view_component stem() const noexcept
Returns a view of the filename without any file extension.
Definition path_view.hpp:735

◆ native_size()

constexpr size_t llfio_v2_xxx::path_view_component::native_size ( ) const
inlineconstexprnoexcept

Returns the size of the view in characters.

698 {
699 return _invoke([](const auto &v) { return v.size(); });
700 }

◆ path()

filesystem::path llfio_v2_xxx::path_view_component::path ( ) const
inline

Return the path view as a path. Allocates and copies memory!

837 {
838 return _invoke(
839 [&](const auto &v)
840 {
841 return _path_from_char_array(v,
842 [](format f) -> filesystem::path::format
843 {
844 switch(f)
845 {
847 return filesystem::path::format::generic_format;
849 return filesystem::path::format::native_format;
850 default:
851 return filesystem::path::format::auto_format;
852 }
853 }(formatting()));
854 });
855 }
format
How to interpret separators.
Definition path_view.hpp:313
constexpr format formatting() const noexcept
How path separators shall be interpreted.
Definition path_view.hpp:703

◆ render()

template<enum path_view_component::termination ZeroTermination, class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size > llfio_v2_xxx::path_view_component::render ( path_view_component  view,
Args &&...  args 
) const
inline

Convenience function.

1610 {
1611 return rendered_path<ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size>(view,
1612 std::forward<Args>(args)...);
1613 }

◆ render_null_terminated()

template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size > llfio_v2_xxx::path_view_component::render_null_terminated ( Args &&...  args) const
inline

Convenience function.

1625 {
1626 return rendered_path<termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>(
1627 *this, std::forward<Args>(args)...);
1628 }

◆ render_unterminated()

template<class T = typename filesystem::path::value_type, class AllocatorOrDeleter = default_rendered_path_deleter<T[]>, size_t _internal_buffer_size = default_internal_buffer_size, class... Args, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true, typename = decltype( std::is_constructible<rendered_path<termination::zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>, path_view_component, Args...>::value )>
rendered_path< termination::not_zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size > llfio_v2_xxx::path_view_component::render_unterminated ( Args &&...  args) const
inline

Convenience function.

1640 {
1641 return rendered_path<termination::not_zero_terminated, T, AllocatorOrDeleter, _internal_buffer_size>(
1642 *this, std::forward<Args>(args)...);
1643 }

◆ stem()

constexpr path_view_component llfio_v2_xxx::path_view_component::stem ( ) const
inlineconstexprnoexcept

Returns a view of the filename without any file extension.

736 {
737 auto self = _filename();
738 return self._invoke(
739 [self](const auto &v)
740 {
741 auto dot_idx = v.rfind('.');
742 if(_npos == dot_idx || dot_idx == 0 || (dot_idx == 1 && v[dot_idx - 1] == '.'))
743 {
744 return self;
745 }
746 return path_view_component(v.data(), dot_idx, not_zero_terminated);
747 });
748 }

◆ swap()

constexpr void llfio_v2_xxx::path_view_component::swap ( path_view_component o)
inlineconstexprnoexcept

Swap the view with another.

687 {
688 path_view_component x = *this;
689 *this = o;
690 o = x;
691 }

◆ termination()

constexpr enum termination llfio_v2_xxx::path_view_component::termination ( ) const
inlineconstexprnoexcept

The zero termination during construction.

709 {
710 return _zero_terminated ? zero_terminated : not_zero_terminated;
711 }

Friends And Related Symbol Documentation

◆ hash_value

constexpr size_t hash_value ( path_view_component  x)
friend

Hashes a path_view_component.

1938{
1939 return view._invoke(
1940 [](auto sv) -> size_t
1941 {
1942 // std::hash isn't available for all kinds of string view on older compilers :(
1943 const auto hash =
1944 QUICKCPPLIB_NAMESPACE::algorithm::hash::fast_hash::hash((const char *) sv.data(), sv.size() * sizeof(*sv.data()));
1945 return *(size_t *) &hash;
1946 });
1947}

Member Data Documentation

◆ _bytestr

const byte* llfio_v2_xxx::path_view_component::_bytestr {nullptr}
335{nullptr};

◆ is_source_acceptable

template<class Char >
constexpr bool llfio_v2_xxx::path_view_component::is_source_acceptable = detail::is_source_acceptable<Char>::value
staticconstexpr

True if path views can be constructed from this source. i.e. is_source_chartype_acceptable, or is byte

◆ is_source_chartype_acceptable

template<class Char >
constexpr bool llfio_v2_xxx::path_view_component::is_source_chartype_acceptable = detail::is_source_chartype_acceptable<Char>::value
staticconstexpr

True if path views can be constructed from this character type. i.e. is one of char, wchar_t, char8_t, char16_t


The documentation for this class was generated from the following file: