cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
stat_bench::util::StringView Class Reference

Class of view of strings. More...

#include <stat_bench/util/string_view.h>

+ Collaboration diagram for stat_bench::util::StringView:

Public Member Functions

constexpr StringView () noexcept
 Constructor of an empty string.
 
constexpr StringView (const char *data, std::size_t size) noexcept
 Constructor.
 
 StringView (const char *str) noexcept
 Constructor of implicit conversion from raw string literals.
 
 StringView (const std::string &str) noexcept
 Constructor of implicit conversion from std::string objects.
 
auto at (std::size_t index) const -> char
 Get a character in the string.
 
constexpr auto data () const noexcept -> const char *
 Get the pointer to the string.
 
constexpr auto empty () const noexcept -> bool
 Check whether this string is empty.
 
constexpr auto size () const noexcept -> std::size_t
 Get the size of the string.
 
auto substr (std::size_t pos) const -> StringView
 Get a part of the string.
 

Detailed Description

Class of view of strings.

Definition at line 34 of file string_view.h.

Constructor & Destructor Documentation

◆ StringView() [1/4]

stat_bench::util::StringView::StringView ( const char * data,
std::size_t size )
inlineconstexprnoexcept

Constructor.

Parameters
[in]dataPointer to the string.
[in]sizeSize of the string.

Definition at line 42 of file string_view.h.

◆ StringView() [2/4]

stat_bench::util::StringView::StringView ( )
inlineconstexprnoexcept

Constructor of an empty string.

Definition at line 48 of file string_view.h.

◆ StringView() [3/4]

stat_bench::util::StringView::StringView ( const std::string & str)
inlinenoexcept

Constructor of implicit conversion from std::string objects.

Parameters
[in]strString.

Definition at line 55 of file string_view.h.

◆ StringView() [4/4]

stat_bench::util::StringView::StringView ( const char * str)
inlinenoexcept

Constructor of implicit conversion from raw string literals.

Parameters
[in]strString.

Definition at line 64 of file string_view.h.

Member Function Documentation

◆ at()

auto stat_bench::util::StringView::at ( std::size_t index) const -> char
inlinenodiscard

Get a character in the string.

Parameters
[in]indexIndex of the character to get.
Returns
Character.

Definition at line 102 of file string_view.h.

◆ data()

auto stat_bench::util::StringView::data ( ) const -> const char*
inlinenodiscardconstexprnoexcept

Get the pointer to the string.

Returns
Pointer to the string.

Definition at line 73 of file string_view.h.

◆ empty()

auto stat_bench::util::StringView::empty ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether this string is empty.

Return values
trueThis string is empty.
falseThis string is not empty.

Definition at line 92 of file string_view.h.

◆ size()

auto stat_bench::util::StringView::size ( ) const -> std::size_t
inlinenodiscardconstexprnoexcept

Get the size of the string.

Returns
Size of the string.

Definition at line 82 of file string_view.h.

◆ substr()

auto stat_bench::util::StringView::substr ( std::size_t pos) const -> StringView
inlinenodiscard

Get a part of the string.

Parameters
[in]posIndex of the starting position.
Returns
Created part of the string.

Definition at line 115 of file string_view.h.


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