class
#include <muu/string_param.h>
string_param A move-only string type-eraser capable of representing any UTF string.
Constructors, destructors, conversion operators
- operator bool() const explicit noexcept
- Returns true if the string_
param contains a value of non-zero length. -
template <typename T>string_param(T&& string_viewable) noexcept
- Constructs a non-owning string_
param from a string-viewable object. -
string_param(string_
param&& other) noexcept - Move constructor.
- ~string_param() noexcept
- Destructor.
Public functions
- auto empty() const -> bool noexcept
- Returns true if the string_
param does not contain a value, or it has a length of zero. -
auto operator=(string_
param&& rhs) -> string_ param& noexcept - Move-assignment operator.
- auto owning() const -> bool noexcept
- Returns true if the string_
param is not empty and owns the payload string (rather than simply being a view). -
auto trim() & -> string_
param& noexcept - Trims leading and trailing whitespace from the payload string.
-
auto trim() && -> string_
param&& noexcept - Trims leading and trailing whitespace from the payload string (rvalue overload).
char16_t
- operator std::u16string() && noexcept
- Moves the string_
param's payload into a std:: u16string. - operator std::u16string_view() const & noexcept
- Returns a std::
u16string_view of the string_ param's payload. - operator std::u16string_view() const && explicit noexcept
- Returns a std::
u16string_view of the string_ param's payload (rvalue overload). -
string_param(std::
u16string_view str) noexcept - Constructs a non-owning string_
param from a UTF-16 string view. -
string_param(const std::
u16string& str) noexcept - Constructs a non-owning string_
param from a UTF-16 string. - string_param(const char16_t* str, size_t len) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-16 string and a length. - string_param(const char16_t* str) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-16 string. -
string_param(std::
u16string&& str) noexcept - Constructs an owning string_
param from a UTF-16 string.
char32_t
- operator std::u32string() && noexcept
- Moves the string_
param's payload into a std:: u32string. - operator std::u32string_view() const & noexcept
- Returns a std::
u32string_view of the string_ param's payload. - operator std::u32string_view() const && explicit noexcept
- Returns a std::
u32string_view of the string_ param's payload (rvalue overload). -
string_param(std::
u32string_view str) noexcept - Constructs a non-owning string_
param from a UTF-32 string view. -
string_param(const std::
u32string& str) noexcept - Constructs a non-owning string_
param from a UTF-32 string. - string_param(const char32_t* str, size_t len) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-32 string and a length. - string_param(const char32_t* str) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-32 string. -
string_param(std::
u32string&& str) noexcept - Constructs an owning string_
param from a UTF-32 string.
char8_t
- operator std::u8string() && noexcept
- Moves the string_
param's payload into a std:: u8string. - operator std::u8string_view() const & noexcept
- Returns a std::
u8string_view of the string_ param's payload. - operator std::u8string_view() const && explicit noexcept
- Returns a std::
u8string_view of the string_ param's payload (rvalue overload). -
string_param(std::
u8string_view str) noexcept - Constructs a non-owning string_
param from a UTF-8 string view. -
string_param(const std::
u8string& str) noexcept - Constructs a non-owning string_
param from a UTF-8 string. - string_param(const char8_t* str, size_t len) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-8 string and a length. - string_param(const char8_t* str) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-8 string. -
string_param(std::
u8string&& str) noexcept - Constructs an owning string_
param from a UTF-8 string.
char
- operator std::string() && noexcept
- Moves the string_
param's payload into a std:: string. - operator std::string_view() const & noexcept
- Returns a std::
string_view of the string_ param's payload. - operator std::string_view() const && explicit noexcept
- Returns a std::
string_view of the string_ param's payload (rvalue overload). - string_param() noexcept
- Constructs an empty string_
param. -
string_param(std::
string_view str) noexcept - Constructs a non-owning string_
param from a UTF-8 string view. -
string_param(const std::
string& str) noexcept - Constructs a non-owning string_
param from a UTF-8 string. - string_param(const char* str, size_t len) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-8 string and a length. - string_param(const char* str) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF-8 string. -
string_param(std::
string&& str) noexcept - Constructs an owning string_
param from a UTF-8 string.
wchar_t
- operator std::wstring() && noexcept
- Moves the string_
param's payload into a std:: wstring. - operator std::wstring_view() const & noexcept
- Returns a std::
wstring_view of the string_ param's payload. - operator std::wstring_view() const && explicit noexcept
- Returns a std::
wstring_view of the string_ param's payload (rvalue overload). -
string_param(std::
wstring_view str) noexcept - Constructs a non-owning string_
param from a UTF wide string view. -
string_param(const std::
wstring& str) noexcept - Constructs a non-owning string_
param from a UTF wide string. - string_param(const wchar_t* str, size_t len) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF wide string and a length. - string_param(const wchar_t* str) noexcept
- Constructs a non-owning string_
param from a pointer to a UTF wide string. -
string_param(std::
wstring&& str) noexcept - Constructs an owning string_
param from a UTF wide string.
Friends
-
template <typename Char, typename Traits>auto operator<<(std::
basic_ostream<Char, Traits>& lhs, const string_ param& rhs) -> std:: basic_ostream<Char, Traits>& - Writes the string_
param to a text stream.