QuickCppLib 0.10
Eliminate all the tedious hassle when making state-of-the-art C++ 14 - 23 libraries!
Loading...
Searching...
No Matches
quickcpplib::_xxx::algorithm::string Namespace Reference

Functions

template<class Char>
std::basic_string< Char > tolower (std::basic_string< Char > s)
 Returns an all lower case edition of the input string. i18n aware.
template<class Char>
std::basic_string< Char > toupper (std::basic_string< Char > s)
 Returns an all upper case edition of the input string. i18n aware.
template<class CharType, class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true, typename std::enable_if<(!std::is_const< CharType >::value), bool >::type = true>
size_t to_hex_string (CharType *out, size_t outlen, const T *_in, size_t inlen)
 Converts a number to a hex string. Out buffer can be same as in buffer.
template<class CharType, class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true, typename std::enable_if<(!std::is_const< CharType >::value), bool >::type = true>
size_t to_hex_string (span::span< CharType > out, const span::span< T > in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true>
std::string to_hex_string (span::span< T > in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true>
std::string to_hex_string (const T *in, size_t len)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T, class CharType, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true, typename std::enable_if<(!std::is_const< T >::value), bool >::type = true>
size_t from_hex_string (T *out, size_t outlen, const CharType *in, size_t inlen)
 Converts a hex string to a number. Out buffer can be same as in buffer.

Function Documentation

◆ tolower()

template<class Char>
std::basic_string< Char > quickcpplib::_xxx::algorithm::string::tolower ( std::basic_string< Char > s)

Returns an all lower case edition of the input string. i18n aware.

54 {
55 auto &f = std::use_facet<std::ctype<Char>>(std::locale());
56 std::transform(s.begin(), s.end(), s.begin(), [&](Char c) { return f.tolower(c); });
57 return s;
58 }

◆ toupper()

template<class Char>
std::basic_string< Char > quickcpplib::_xxx::algorithm::string::toupper ( std::basic_string< Char > s)

Returns an all upper case edition of the input string. i18n aware.

62 {
63 auto &f = std::use_facet<std::ctype<Char>>(std::locale());
64 std::transform(s.begin(), s.end(), s.begin(), [&](Char c) { return f.toupper(c); });
65 return s;
66 }

◆ to_hex_string() [1/3]

template<class CharType, class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true, typename std::enable_if<(!std::is_const< CharType >::value), bool >::type = true>
size_t quickcpplib::_xxx::algorithm::string::to_hex_string ( span::span< CharType > out,
const span::span< T > in )
inline

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

122 {
123 return to_hex_string(out.data(), out.size(), in.data(), in.size());
124 }
size_t to_hex_string(CharType *out, size_t outlen, const T *_in, size_t inlen)
Converts a number to a hex string. Out buffer can be same as in buffer.
Definition string.hpp:87

◆ to_hex_string() [2/3]

template<class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true>
std::string quickcpplib::_xxx::algorithm::string::to_hex_string ( span::span< T > in)
inline

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

129 {
130 std::string out(in.size() * 2, ' ');
131 to_hex_string(const_cast<char *>(out.data()), out.size(), in.data(), in.size());
132 return out;
133 }

◆ to_hex_string() [3/3]

template<class T, typename std::enable_if<(sizeof(T)==1), bool >::type = true, typename std::enable_if<(std::is_trivially_copyable< T >::value), bool >::type = true>
std::string quickcpplib::_xxx::algorithm::string::to_hex_string ( const T * in,
size_t len )
inline

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

138 {
139 std::string out(len * 2, ' ');
140 to_hex_string(const_cast<char *>(out.data()), out.size(), in, len);
141 return out;
142 }
EXECINFO_DECL _Check_return_ _In_ size_t len
Definition execinfo_win64.h:55