CCL 0.1 Beta API Reference

Table of Contents


All Packages

CCL IO
CCL Core
CCL Unicode

All Classes

All Free Functions

template <
    unicode_string InputString
>
std::string
to_string (
    const InputString& s
)

Converts the given string to a std::string.

Parameters:
  • s:
std::u16string
to_u16string (
    const std::string& s
)

Converts the given string to a std::u16string.

Parameters:
  • s:
template <
    unicode_string InputString
>
std::u16string
to_u16string (
    const InputString& s
)

Converts the given string to a std::u16string.

Parameters:
  • s:
std::u32string
to_u32string (
    const std::string& s
)

Converts the given string to a std::u32string.

Parameters:
  • s:
template <
    unicode_string InputString
>
std::u32string
to_u32string (
    const InputString& s
)

Converts the given string to a std::u32string.

Parameters:
  • s:
std::u8string
to_u8string (
    const std::string& s
)

Converts the given string to a std::u8string.

Parameters:
  • s:
template <
    unicode_string InputString
>
std::u8string
to_u8string (
    const InputString& s
)

Converts the given string to a std::u8string.

Parameters:
  • s:
template <
    raii_unicode_string OutputString,
    unicode_string InputString
>
OutputString
convert_string (
    const InputString& s
)

Converts the given string to the requested Unicode string type.

Parameters:
  • s:
template <
    raii_unicode_string 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.

template <
    raii_unicode_string 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.

template <
    raii_unicode_string 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.

void
insert_code_point (
    std::u16string& s,
    char32_t code_point,
    std::u16string::size_type index
)

Inserts the given code point into the given string at the given index.

Parameters:
  • s:
  • code_point:

    The code point to insert.

  • index:

    The index of the string at which to insert the code point.

void
insert_code_point (
    std::u32string& s,
    char32_t code_point,
    std::u32string::size_type index
)

Inserts the given code point into the given string at the given index.

Parameters:
  • s:
  • code_point:

    The code point to insert.

  • index:

    The index of the string at which to insert the code point.

void
insert_code_point (
    std::u8string& s,
    char32_t code_point,
    std::u8string::size_type index
)

Inserts the given code point into the given string at the given index.

Parameters:
  • s:
  • code_point:

    The code point to insert.

  • index:

    The index of the string at which to insert the code point.

template <
    unicode_string Input
>
bool
parse_bool (
    Input input,
    const bool_format& format
)

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

template <
    std::floating_point Output,
    unicode_string 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.

template <
    std::integral Output,
    unicode_string 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.

template <
    typename InputResource,
    writable_unicode_string T
>
text_input_stream<InputResource>&
operator >> (
    text_input_stream<InputResource>& stream,
    T& target
)

Reads a Unicode string with the text input stream.

Parameters:
  • stream:

    The text input stream to read with.

  • target:

    The object to store the read data in.

template <
    typename InputResource,
    std::floating_point T
>
text_input_stream<InputResource>&
operator >> (
    text_input_stream<InputResource>& stream,
    T& target
)

Reads a floating-point value with the text input stream.

Parameters:
  • stream:

    The text input stream to read with.

  • target:

    The object to store the read data in.

template <
    typename InputResource,
    std::integral T
>
text_input_stream<InputResource>&
operator >> (
    text_input_stream<InputResource>& stream,
    T& target
)

Reads an integral value with the text input stream.

Parameters:
  • stream:

    The text input stream to read with.

  • target:

    The object to store the read data in.

constexpr
std::endian
get_opposite_endianness (
    std::endian endianness
)
noexcept

Returns the endianness opposite to the endianness provided. For example, the opposite of std::endian::big is std::endian::little and vice-versa.

Parameters:
  • endianness:

    The endianness to get the opposite of.

std::size_t
string_size (
    const char* s
)
noexcept

Returns the number of characters in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::string& s
)
noexcept

Returns the number of characters in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const char16_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const char32_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const char8_t* s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u16string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u16string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u32string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u32string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u8string& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
std::size_t
string_size (
    const std::u8string_view& s
)
noexcept

Returns the number of code units in the given string.

Parameters:
  • s:
template <
    std::integral T
>
unsigned int
count_digits (
    T integer,
    T radix
)
noexcept

Returns the number of digits in the input integer.

Parameters:
  • integer:

    The integer to count digits in.

  • radix:

    The radix of the integer to count digits in.

template <
    unicode_string ContentString,
    unicode_string Substring
>
bool
ends_with (
    const ContentString& content,
    const Substring& substring
)
noexcept

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

Parameters:
  • content:

    The string to look at the end of.

  • substring:

    The substring to look for.

template <
    unicode_string ContentString,
    unicode_string Substring
>
bool
starts_with (
    const ContentString& content,
    const Substring& substring
)
noexcept

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

Parameters:
  • content:

    The string to look at the start of.

  • substring:

    The substring to look for.

template <
    std::floating_point T1,
    std::floating_point T2
>
bool
cmp_equal (
    T1 value1,
    T2 value2,
    unsigned int relevant_decimal_places
)
noexcept

Returns true if the v1 and v2 floating-point values are equal up to the given number of decimal places. For example, 1.123 and 1.124 are equal up to two decimal places because they both end in .12, but they are not equal up to three decimal places because one ends in .123 and the other ends in .124, where the third decimal digit of each number is different.

Parameters:
  • value1:

    The first value to consider in the comparison.

  • value2:

    The second value to consider in the comparison.

  • relevant_decimal_places:

    The number of decimal places that matter in the comparison.

template <
    std::floating_point T1,
    std::floating_point T2
>
bool
cmp_not_equal (
    T1 value1,
    T2 value2,
    int relevant_decimal_places
)
noexcept

Returns true if the v1 and v2 floating-point values are not equal up to the given number of decimal places. This is implemented as the negation of the result of calling cmp_equal with the same arguments.

Parameters:
  • value1:

    The first value to consider in the comparison.

  • value2:

    The second value to consider in the comparison.

  • relevant_decimal_places:

    The number of decimal places that matter in the comparison.

void
invert_endianness (
    std::byte* data,
    std::size_t byte_count
)
noexcept

Reverses the order of the bytes in the data array.

Parameters:
  • data:

    The array of bytes to reverse.

  • byte_count:

    The number of bytes in the array.

template <
    unicode_string 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:
template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const std::u16string& source
)

Writes a UTF-16 string with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const std::u32string& source
)

Writes a UTF-32 string with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const std::u8string& source
)

Writes a UTF-8 string with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource,
    std::floating_point T
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    T source
)

Writes a floating-point value with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const std::string& source
)

Writes a string with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource,
    std::integral T
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    T source
)

Writes an integral value with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename InputResource
>
text_input_stream<InputResource>&
operator >> (
    text_input_stream<InputResource>& stream,
    bool& target
)

Reads a bool value with the text input stream.

Parameters:
  • stream:

    The text input stream to read with.

  • target:

    The object to store the read data in.

template <
    typename InputResource
>
text_input_stream<InputResource>&
operator >> (
    text_input_stream<InputResource>& stream,
    char32_t& target
)

Reads a code point with the text input stream.

Parameters:
  • stream:

    The text input stream to read with.

  • target:

    The object to store the read data in.

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.

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.

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.

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.

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.

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.

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.

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.

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.

constexpr
bool
is_whitespace (
    char32_t code_point
)
noexcept

Returns true if the given code point represents a whitespace character, and false if it does not.

Parameters:
  • code_point:

    The code point to examine.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const char8_t* source
)

Writes a UTF-8 code unit with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    char source
)

Writes a char value with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    char32_t source
)

Writes a code point with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    const char* source
)

Writes a string with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.

template <
    typename OutputResource
>
text_output_stream<OutputResource>&
operator << (
    text_output_stream<OutputResource>& stream,
    bool source
)

Writes bool value with the text output stream.

Parameters:
  • stream:

    The text output stream to write with.

  • source:

    The object to write.



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 2022.