CCL 0.2 Beta API Reference
Unicode Package

Table of Contents


Classes

Free Functions

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
std::string
to_string (
    const InputString& s
)

Converts the given string to a std::string.

Parameters:
  • s:

    The string to convert to std::string.

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
std::u16string
to_u16string (
    const InputString& s
)

Converts the given string to a std::u16string.

Parameters:
  • s:

    The string to convert to std::u16string.

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
std::u32string
to_u32string (
    const InputString& s
)

Converts the given string to a std::u32string.

Parameters:
  • s:

    The string to convert to std::u32string.

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
std::u8string
to_u8string (
    const InputString& s
)

Converts the given string to a std::u8string.

Parameters:
  • s:

    The string to convert to std::u8string.

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
std::wstring
to_wstring (
    const InputString& s
)

Converts the given string to a std::wstring.

Parameters:
  • s:

    The string to convert to std::wstring.

<cmp/unicode/algorithms.hpp>
template <
    writable_raii_text_object OutputString,
    text_object InputString
>
OutputString
convert_string (
    const InputString& s
)

Converts the given string to the requested string type.

Parameters:
  • s:

    The string to convert.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const char* s
)
noexcept

Returns the number of characters in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::string& s
)
noexcept

Returns the number of characters in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::string_view& s
)
noexcept

Returns the number of characters in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const char16_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const char32_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const char8_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u16string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u16string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u32string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u32string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u8string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::u8string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::wstring& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const std::wstring_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
std::size_t
string_size (
    const wchar_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:

    The string to get the size of.

<cmp/unicode/algorithms.hpp>
template <
    text_object ContentString,
    text_object Substring
>
bool
ends_with (
    const ContentString& content,
    const Substring& substring
)
noexcept

Returns true if the content string ends with the contents of substring.

Parameters:
  • content:

    The string to look at the end of.

  • substring:

    The substring to look for.

<cmp/unicode/algorithms.hpp>
template <
    text_object ContentString,
    text_object Substring
>
bool
starts_with (
    const ContentString& content,
    const Substring& substring
)
noexcept

Returns true if the content string starts with the contents of substring.

Parameters:
  • content:

    The string to look at the start of.

  • substring:

    The substring to look for.

<cmp/unicode/algorithms.hpp>
template <
    text_object InputString
>
typename by_code_point<value_type_t<InputString>>::const_iterator
validate_string (
    const InputString& s
)
noexcept

Validates the given string and returns a by_code_point constant iterator just past the last valid code point, which is the end iterator if the entire string is valid.

Parameters:
  • s:

    The string to validate.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_surrogate (
    char16_t code_unit
)
noexcept

Returns true if the given UTF-16 code unit is a surrogate. Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-16 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_leading_surrogate (
    char16_t code_unit
)
noexcept

Returns true if the given UTF-16 code unit is a leading surrogate (meaning the first code unit of a surrogate pair). Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-16 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_trailing_surrogate (
    char16_t code_unit
)
noexcept

Returns true if the given UTF-16 code unit is a trailing surrogate (meaning the last code unit of a surrogate pair). Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-16 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_leading_byte (
    char8_t code_unit
)
noexcept

Returns true if the given UTF-8 code unit is a leading byte (meaning that it marks the beginning of a sequence of code units). Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-8 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_trailing_byte (
    char8_t code_unit
)
noexcept

Returns true if the given UTF-8 code unit is a trailing byte (meaning that it follows a leading byte). Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-8 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_standalone_byte (
    char8_t code_unit
)
noexcept

Returns true if the given UTF-8 code unit is standalone (meaning that it stands on its own and is not part of a sequence of code units). Otherwise, returns false.

Parameters:
  • code_unit:

    The UTF-8 code unit to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_radix_digit (
    char32_t character,
    unsigned int radix
)
noexcept

Returns true if the given character represents a digit in the number system with the given radix. Otherwise, returns false. For example, '7' is a valid base-8 digit, 'F' is a valid base-16 digit, 'G' is a valid base-17 digit, and so on.

Parameters:
  • character:

    The character (code point) to examine.

  • radix:

    The radix to consider.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_code_point_valid (
    char32_t code_point
)
noexcept

Returns true if the given code point is valid. Otherwise, returns false.

Parameters:
  • code_point:

    The code point to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
fits_in_7_bits (
    char32_t code_point
)
noexcept

Returns true if the given code point fits in 7 bits. Otherwise, returns false.

Parameters:
  • code_point:

    The code point to examine.

<cmp/unicode/examiners.hpp>
constexpr
bool
is_whitespace (
    char32_t code_point
)
noexcept

Returns true if the given code point represents a whitespace character. Otherwise, returns false.

Parameters:
  • code_point:

    The code point to examine.

<cmp/unicode/formatters.hpp>
template <
    writable_raii_text_object Output
>
Output
format_bool (
    bool input,
    const bool_format& format
)

Formats the given bool value with the given bool format and returns the formatted string.

<cmp/unicode/formatters.hpp>
template <
    writable_raii_text_object Output,
    std::floating_point Input
>
Output
format_floating_point (
    Input input,
    const floating_point_format& format
)

Formats the given floating-point value with the given floating-point format and returns the formatted string.

<cmp/unicode/formatters.hpp>
template <
    writable_raii_text_object Output,
    std::integral Input
>
Output
format_integer (
    Input input,
    const integer_format& format
)

Formats the given integer value with the given integer format and returns the formatted string.

<cmp/unicode/parsers.hpp>
template <
    std::floating_point Output,
    text_object Input
>
Output
parse_floating_point (
    const Input& input,
    const floating_point_format& format
)

Parses the input string and returns the corresponding floating-point value. The input string is expected to conform to the given floating-point format. If it doesn't, a parse_failed exception is thrown.

<cmp/unicode/parsers.hpp>
template <
    text_object Input
>
bool
parse_bool (
    Input input,
    const bool_format& format
)

Parses the input string and returns the corresponding bool value. The input string is expected to conform to the given bool format. If it doesn't, a parse_failed exception is thrown.

<cmp/unicode/parsers.hpp>
template <
    std::integral Output,
    text_object Input
>
Output
parse_integer (
    const Input& input,
    const integer_format& format
)

Parses the input string and returns the corresponding integer value. The input string is expected to conform to the given integer format. If it doesn't, a parse_failed exception is thrown.



Copyright © 2022-2025 Daniel T. McGinnis

CCL was first published in 2022, and is still actively maintained.

This website was first published in 2022, and is still actively maintained.

This specific web page was first published in 2023.