28 #ifndef BSL_CHAR_TRAITS_HPP 29 #define BSL_CHAR_TRAITS_HPP 49 template<
typename CharT>
50 class char_traits final
82 [[nodiscard]]
static constexpr
bool 97 [[nodiscard]]
static constexpr
bool 166 [[nodiscard]]
static constexpr
char_type const *
185 return static_cast<char_type>(c);
199 return static_cast<bsl::intmax>(c);
213 [[nodiscard]]
static constexpr
bool 216 if ((eof() == c1) && (eof() == c2)) {
220 return eq(to_char_type(c1), to_char_type(c2));
248 if (!eq_int_type(e, eof())) {
static constexpr char_type const * find(char_type const *const p, bsl::uintmax const count, char_type const &ch) noexcept
Returns a pointer to the first occurrence of "ch" in "p".
Definition: char_traits.hpp:167
static constexpr bool lt(char_type const a, char_type const b) noexcept
Returns true if "a" < "b".
Definition: char_traits.hpp:98
static constexpr bsl::uintmax length(char_type const *const s) noexcept
Returns the length of the provided string.
Definition: char_traits.hpp:146
static constexpr bool eq_int_type(bsl::intmax const c1, bsl::intmax const c2) noexcept
Checks whether two values of type int_type are equal.
Definition: char_traits.hpp:214
static constexpr bsl::intmax not_eof(bsl::intmax const e) noexcept
Returns e if e is not EOF, otherwise returns 0.
Definition: char_traits.hpp:246
::intmax_t intmax
defines a signed integer with the maximum possible size
Definition: cstdint.hpp:95
constexpr bsl::int32 builtin_strncmp(cstr_type const lhs, cstr_type const rhs, bsl::uintmax const count) noexcept
Same as std::strncmp with parameter checks. If lhs, rhs are a nullptr, or count is 0,...
Definition: cstring.hpp:132
static constexpr bsl::intmax to_int_type(char_type const c) noexcept
Converts a value of char_type to bsl::intmax.
Definition: char_traits.hpp:197
static constexpr char_type to_char_type(bsl::intmax const c) noexcept
Converts a value of bsl::intmax to char_type. If there is no equivalent value (such as when c is a co...
Definition: char_traits.hpp:183
static constexpr bsl::int32 compare(char_type const *const s1, char_type const *const s2, bsl::uintmax const count) noexcept
Compares two strings. Returns negative value if s1 appears before s2 in lexicographical order....
Definition: char_traits.hpp:125
::int32_t int32
defines an 32bit signed integer
Definition: cstdint.hpp:40
char char_type
Standard Char Type.
Definition: char_type.hpp:41
static constexpr bsl::intmax eof() noexcept
Returns the value of EOF.
Definition: char_traits.hpp:231
constexpr cstr_type builtin_strnchr(cstr_type const str, char_type const ch, bsl::uintmax const count) noexcept
Same as std::strnchr with parameter checks. If str is a nullptr, or count is 0, this function returns...
Definition: cstring.hpp:176
constexpr bsl::uintmax builtin_strlen(cstr_type const str) noexcept
Same as std::strlen with parameter checks. If str is a nullptr, this returns 0.
Definition: cstring.hpp:154
static constexpr bool eq(char_type const a, char_type const b) noexcept
Returns true if "a" == "b".
Definition: char_traits.hpp:83
::uintmax_t uintmax
defines a unsigned integer with the maximum possible size
Definition: cstdint.hpp:97