LLFIO  v2.00
llfio_v2_xxx::path_view_component::rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size, type > Class Template Reference

#include "path_view.hpp"

Inherits llfio_v2_xxx::path_view_component::_rendered_path_base< ZeroTermination, T, bool >.

Public Types

using value_type = typename _base::value_type
 
using allocator_type = decltype(detail::is_allocator(std::declval< AllocatorOrDeleter >()))
 Type of the allocator, or void if that was not configured.
 
using deleter_type = decltype(detail::is_deleter< value_type >(std::declval< AllocatorOrDeleter >()))
 Type of the deleter, or void if that was not configured.
 
using pointer = const T *
 Type of the pointer type.
 
using const_pointer = const T *
 Type of the const pointer type.
 
using reference = const T &
 Type of the reference type.
 
using const_reference = const T &
 Type of the const reference type.
 
using iterator = typename _view_type::iterator
 Type of the iterator type.
 
using const_iterator = typename _view_type::iterator
 Type of the const iterator type.
 
using reverse_iterator = typename _view_type::reverse_iterator
 Type of the reverse iterator type.
 
using const_reverse_iterator = typename _view_type::reverse_iterator
 Type of the const reverse iterator type.
 
using size_type = typename _view_type::size_type
 Type of the size type.
 
using difference_type = typename _view_type::difference_type
 Type of the difference type.
 

Public Member Functions

template<class U , class V , typename std::enable_if<(_is_deleter_based< U >), bool >::type = true, typename = decltype( std::declval<U>()((size_t) 1) ), typename = decltype( std::declval<V>()((value_type *) nullptr) )>
 rendered_path (path_view_component view, const std::locale &loc, U &&allocate, V &&deleter=AllocatorOrDeleter(), _custom_callable_deleter_tag={})
 
template<class U , class V , typename std::enable_if<(_is_deleter_based< U >), bool >::type = true, typename = decltype( std::declval<U>()((size_t) 1) ), typename = decltype( std::declval<V>()((value_type *) nullptr) )>
 rendered_path (path_view_component view, U &&allocate, V &&deleter=AllocatorOrDeleter(), _custom_callable_deleter_tag={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 rendered_path (path_view_component view, const std::locale &loc, pmr::memory_resource &mr, _memory_resource_tag={})
 
 rendered_path (path_view_component view, pmr::memory_resource &mr, _memory_resource_tag={})
 
template<class U , typename std::enable_if<(_is_allocator_based< U >), bool >::type = true, typename = decltype( std::declval<U>().allocate((size_t) 1) )>
 rendered_path (path_view_component view, const std::locale &loc, U &&allocate, _stl_allocator_tag={})
 
template<class U , typename std::enable_if<(_is_allocator_based< U >), bool >::type = true, typename = decltype( std::declval<U>().allocate((size_t) 1) )>
 rendered_path (path_view_component view, U &&allocate, _stl_allocator_tag={})
 
 rendered_path (path_view_component view, const std::locale &loc)
 
 rendered_path (path_view_component view)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class AllocatorOrDeleter2 , size_t _internal_buffer_size2, typename std::enable_if<(!std::is_same< rendered_path, rendered_path< ZeroTermination, T, AllocatorOrDeleter2, _internal_buffer_size2 >>::value), bool >::type = true, typename std::enable_if<(std::is_constructible< AllocatorOrDeleter, AllocatorOrDeleter2 >::value), bool >::type = true>
 rendered_path (rendered_path< ZeroTermination, T, AllocatorOrDeleter2, _internal_buffer_size2 > &&o) noexcept
 Construct from a compatible rendered_path.
 
 rendered_path (const rendered_path &)=delete
 
 rendered_path (rendered_path &&o) noexcept
 
rendered_pathoperator= (const rendered_path &)=delete
 
rendered_pathoperator= (rendered_path &&o) noexcept
 
void reset ()
 Delete any held resources now.
 
value_type * release ()
 Release from ownership any resources.
 
size_t capacity () const noexcept
 The storage capacity, which may be larger than size() if the internal buffer is in use.
 
bool references_source () const noexcept
 True if this rendered path refers to the source path view.
 
const AllocatorOrDeleter & deleter () const noexcept
 Access the custom deleter instance passed to the constructor.
 
AllocatorOrDeleter & deleter () noexcept
 Access the custom deleter instance passed to the constructor.
 
pmr::memory_resource * memory_resource () noexcept
 The memory resource passed to the constructor. More...
 
const AllocatorOrDeleter & allocator () const noexcept
 Access the custom allocator instance passed to the constructor.
 
AllocatorOrDeleter & allocator () noexcept
 Access the custom allocator instance passed to the constructor. More...
 
bool operator== (const rendered_path &o) const noexcept
 True if the bits backing the rendered path are identical.
 
bool operator!= (const rendered_path &o) const noexcept
 True if the bits backing the rendered path are non-identical.
 
constexpr basic_string_view< T > as_string_view () const
 As string view.
 
constexpr iterator begin () noexcept
 Begin iteration.
 
constexpr const_iterator begin () const noexcept
 Begin iteration.
 
constexpr const_iterator cbegin () const noexcept
 Begin iteration.
 
constexpr iterator end () noexcept
 End iteration.
 
constexpr const_iterator end () const noexcept
 End iteration.
 
constexpr const_iterator cend () const noexcept
 End iteration.
 
constexpr reverse_iterator rbegin () noexcept
 Begin reverse iteration.
 
constexpr const_reverse_iterator rbegin () const noexcept
 Begin reverse iteration.
 
constexpr const_reverse_iterator crbegin () const noexcept
 Begin reverse iteration.
 
constexpr reverse_iterator rend () noexcept
 End reverse iteration.
 
constexpr const_reverse_iterator rend () const noexcept
 End reverse iteration.
 
constexpr const_reverse_iterator crend () const noexcept
 End reverse iteration.
 
constexpr reference operator[] (size_type idx) noexcept
 Access.
 
constexpr const_reference operator[] (size_type idx) const noexcept
 Access.
 
constexpr reference at (size_type idx)
 Access.
 
constexpr const_reference at (size_type idx) const
 Access.
 
constexpr reference front () noexcept
 Access.
 
constexpr const_reference front () const noexcept
 Access.
 
constexpr reference back () noexcept
 Access.
 
constexpr const_reference back () const noexcept
 Access.
 
constexpr pointer data () noexcept
 Access.
 
constexpr const_pointer data () const noexcept
 Access.
 
constexpr size_type size () const noexcept
 Size.
 
constexpr size_type length () const noexcept
 Size.
 
constexpr size_type max_size () const noexcept
 Max size.
 
constexpr bool empty () const noexcept
 Empty.
 
constexpr _view_type as_span () const noexcept
 As span.
 

Static Public Member Functions

static constexpr enum termination termination () noexcept
 The zero termination of this rendered path.
 
static constexpr size_t internal_buffer_size () noexcept
 The size of the internal buffer.
 

Protected Types

using _view_type = span< const T >
 

Protected Member Functions

constexpr basic_string_view< T > _as_string_view () const
 

Protected Attributes

_view_type _ref
 

Friends

template<class DestT , class _Deleter , size_t _internal_buffer_size_, class Char1T , class Char2T >
int path_view_component::_compare (basic_string_view< Char1T > a, enum termination a_zt, basic_string_view< Char2T > b, enum termination b_zt, const std::locale *loc) noexcept
 
size_t hash_value (const rendered_path &v) noexcept
 Returns the hash value for the bits backing the rendered path.
 

Detailed Description

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, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
class llfio_v2_xxx::path_view_component::rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size, type >

Instantiate from a path_view_component to get a path suitable for feeding to other code.

Template Parameters
TThe destination encoding required.
DeleterA custom deleter OR STL allocator for any temporary buffer.
_internal_buffer_sizeOverride the size of the internal temporary buffer, thus reducing stack space consumption (most compilers optimise away the internal temporary buffer if it can be proved it will never be used). The default is 1024 values of T.

This makes the input to the path view component into a destination format suitable for consumption by other code. If the source has the same format as the destination, and the zero termination requirements are the same, the source is used directly without memory copying nor reencoding.

If the format is compatible, but the destination requires zero termination, and the source is not zero terminated, a straight memory copy is performed into the temporary buffer.

rendered_path contains a temporary buffer sized according to the template parameter. Output below that amount involves no dynamic memory allocation. Output above that amount calls operator new[]. You can use an externally supplied larger temporary buffer to avoid dynamic memory allocation in all situations.

Constructor & Destructor Documentation

◆ rendered_path()

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, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
template<class U , class V , typename std::enable_if<(_is_deleter_based< U >), bool >::type = true, typename = decltype( std::declval<U>()((size_t) 1) ), typename = decltype( std::declval<V>()((value_type *) nullptr) )>
llfio_v2_xxx::path_view_component::rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size, type >::rendered_path ( path_view_component  view,
const std::locale &  loc,
U &&  allocate,
V &&  deleter = AllocatorOrDeleter(),
_custom_callable_deleter_tag  = {} 
)
inline

Construct, performing any reencoding or memory copying required.

Parameters
viewThe path component view to use as source.
output_zero_terminationThe zero termination in the output desired
locThe locale to use to perform reencoding.
allocateEither a callable with prototype value_type *(size_t length) which is defaulted to return static_cast<value_type *>(operator new[](length * sizeof(value_type)));, or a pmr::memory_resource *. You can return nullptr if you wish, the consumer of rendered_path will see a buffer set to nullptr.

If loc is defaulted, and an error occurs during any conversion from UTF-8 or UTF-16, an exception of system_error(errc::illegal_byte_sequence) is thrown. This is because if you tell path_view that its source is UTF-8 or UTF-16, then that must be valid UTF. If you wish to supply UTF-invalid paths (which are legal on most filesystems), use native narrow or wide encoded source, or binary.

1322  {})
1323  : _deleter1(_invoke_deleter)
1324  , _deleter1arg(&_deleter2)
1325  , _deleter2(static_cast<V &&>(deleter))
1326  {
1327  _init(view, loc, static_cast<U &&>(allocate));
1328  }
const AllocatorOrDeleter & deleter() const noexcept
Access the custom deleter instance passed to the constructor.
Definition: path_view.hpp:1470

Member Function Documentation

◆ allocator()

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, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
STL llfio_v2_xxx::path_view_component::rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size, type >::allocator ( )
inlinenoexcept

Access the custom allocator instance passed to the constructor.

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

1480 { return _deleter2; }

◆ memory_resource()

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, typename std::enable_if<(is_source_acceptable< T >), bool >::type = true>
llfio_v2_xxx::path_view_component::rendered_path< ZeroTermination, T, AllocatorOrDeleter, _internal_buffer_size, type >::memory_resource ( )
inlinenoexcept

The memory resource passed to the constructor.

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

1475 { return (pmr::memory_resource *) _deleter1arg; }

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