OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::basic_string_path Class Reference

Basic class storing paths made of string elements. More...

#include <eagine/string_path.hpp>

Public Types

using value_type = string_view
 The element value type.
 
using size_type = span_size_t
 The element count type.
 
using iterator = string_list::iterator< const char * >
 Iterator type.
 
using reverse_iterator = string_list::rev_iterator< const char * >
 Reverse iterator type.
 

Public Member Functions

 basic_string_path () noexcept=default
 Default constructor. Creates an empty path. More...
 
 basic_string_path (basic_string_path &&) noexcept=default
 Move constructor.
 
 basic_string_path (const basic_string_path &)=default
 Copy constructor.
 
auto operator= (basic_string_path &&) noexcept -> basic_string_path &=default
 Move assignment operator.
 
auto operator= (const basic_string_path &) -> basic_string_path &=default
 Copy assignment operator.
 
 basic_string_path (string_view path, EAGINE_TAG_TYPE(split_by), string_view sep)
 Construction from a path string and a separator string.
 
 basic_string_path (span< const string_view > names)
 Construction from a list of path element names.
 
template<std::size_t N>
 basic_string_path (const std::array< string_view, N > &names)
 Construction from a list of path element names.
 
template<typename... Str>
 basic_string_path (EAGINE_TAG_TYPE(from_pack), string_view name, const Str &... names)
 Construction from a pack of path element names.
 
auto empty () const noexcept -> bool
 Indicates if this path is empty. More...
 
void clear () noexcept
 Clears this path. More...
 
auto size () const noexcept -> size_type
 Returns the number of elements in this path. More...
 
void reserve_bytes (size_type s)
 Reserves the specified number of bytes in the storage.
 
auto front () const noexcept -> string_view
 Returns the element at the front of the path.
 
auto back () const noexcept -> string_view
 Returns the element at the back of the path.
 
void push_back (string_view name)
 Appends a new element with the specified name to the end. More...
 
void pop_back ()
 Removes a single element from the end of this path. More...
 
auto begin () const noexcept -> iterator
 Returns an iterator pointing to the start of the path. More...
 
auto end () const noexcept -> iterator
 Returns an iterator pointing past the end of the path. More...
 
auto rbegin () const noexcept -> reverse_iterator
 Returns a reverse iterator pointing to the end of the path. More...
 
auto rend () const noexcept -> reverse_iterator
 Returns an iterator pointing past the start of the path. More...
 
template<typename Func >
void for_each_elem (Func func) const
 Calls the specified function for each element of this path.
 
template<typename Func >
void rev_for_each_elem (Func func) const
 Calls the specified function for each element in reverse order.
 
auto as_string (string_view sep, bool trail_sep) const -> std::string
 Returns this path as string with elements separated by sep.
 
auto block () noexcept -> memory::const_block
 Returns a block covering the internal representation of this path.
 

Friends

auto operator== (const basic_string_path &a, const basic_string_path &b) noexcept
 Equality comparison.
 
auto operator!= (const basic_string_path &a, const basic_string_path &b) noexcept
 Non-equality comparison.
 
auto operator< (const basic_string_path &a, const basic_string_path &b) noexcept
 Less-than comparison.
 
auto operator<= (const basic_string_path &a, const basic_string_path &b) noexcept
 Less-equal comparison.
 
auto operator> (const basic_string_path &a, const basic_string_path &b) noexcept
 Greater-than comparison.
 
auto operator>= (const basic_string_path &a, const basic_string_path &b) noexcept
 Greater-equal comparison.
 
auto operator+ (const basic_string_path &a, const basic_string_path &b) noexcept
 Concatenates two paths.
 

Detailed Description

Basic class storing paths made of string elements.

Efficiently stores a sequence of string elements in a single block of memory.

Examples
eagine/string_path.cpp.

Constructor & Destructor Documentation

◆ basic_string_path()

eagine::basic_string_path::basic_string_path ( )
defaultnoexcept

Default constructor. Creates an empty path.

Postcondition
empty()

Member Function Documentation

◆ begin()

auto eagine::basic_string_path::begin ( ) const -> iterator
inlinenoexcept

Returns an iterator pointing to the start of the path.

See also
end
rbegin

◆ clear()

void eagine::basic_string_path::clear ( )
inlinenoexcept

Clears this path.

See also
empty

◆ empty()

auto eagine::basic_string_path::empty ( ) const -> bool
inlinenoexcept

Indicates if this path is empty.

See also
size
clear

Referenced by begin(), end(), rbegin(), and rend().

◆ end()

auto eagine::basic_string_path::end ( ) const -> iterator
inlinenoexcept

Returns an iterator pointing past the end of the path.

See also
begin
rend

◆ pop_back()

void eagine::basic_string_path::pop_back ( )
inline

Removes a single element from the end of this path.

See also
push_back

◆ push_back()

void eagine::basic_string_path::push_back ( string_view  name)
inline

Appends a new element with the specified name to the end.

See also
pop_back

◆ rbegin()

auto eagine::basic_string_path::rbegin ( ) const -> reverse_iterator
inlinenoexcept

Returns a reverse iterator pointing to the end of the path.

See also
rend
begin

◆ rend()

auto eagine::basic_string_path::rend ( ) const -> reverse_iterator
inlinenoexcept

Returns an iterator pointing past the start of the path.

See also
rbegin
end

◆ size()

auto eagine::basic_string_path::size ( ) const -> size_type
inlinenoexcept

Returns the number of elements in this path.

See also
empty
Examples
eagine/string_path.cpp.

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).