Class of view of strings.
More...
#include <stat_bench/util/string_view.h>
|
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.
|
|
Class of view of strings.
Definition at line 34 of file string_view.h.
◆ StringView() [1/4]
stat_bench::util::StringView::StringView |
( |
const char * | data, |
|
|
std::size_t | size ) |
|
inlineconstexprnoexcept |
Constructor.
- Parameters
-
[in] | data | Pointer to the string. |
[in] | size | Size 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
-
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
-
Definition at line 64 of file string_view.h.
◆ at()
auto stat_bench::util::StringView::at |
( |
std::size_t | index | ) |
const -> char |
|
inlinenodiscard |
Get a character in the string.
- Parameters
-
[in] | index | Index 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
-
true | This string is empty. |
false | This 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] | pos | Index 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: