LMMS
Loading...
Searching...
No Matches
water::CharacterFunctions Class Reference

#include <CharacterFunctions.h>

Classes

struct  HexParser

Static Public Member Functions

static water_uchar toUpperCase (water_uchar character) noexcept
static water_uchar toLowerCase (water_uchar character) noexcept
static bool isUpperCase (water_uchar character) noexcept
static bool isLowerCase (water_uchar character) noexcept
static bool isWhitespace (char character) noexcept
static bool isWhitespace (water_uchar character) noexcept
static bool isDigit (char character) noexcept
static bool isDigit (water_uchar character) noexcept
static bool isLetter (char character) noexcept
static bool isLetter (water_uchar character) noexcept
static bool isLetterOrDigit (char character) noexcept
static bool isLetterOrDigit (water_uchar character) noexcept
static bool isPrintable (char character) noexcept
static bool isPrintable (water_uchar character) noexcept
static int getHexDigitValue (water_uchar digit) noexcept
static water_uchar getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept
template<typename CharPointerType>
static double readDoubleValue (CharPointerType &text) noexcept
template<typename CharPointerType>
static double getDoubleValue (CharPointerType text) noexcept
template<typename IntType, typename CharPointerType>
static IntType getIntValue (const CharPointerType text) noexcept
template<typename CharPointerType>
static size_t lengthUpTo (CharPointerType text, const size_t maxCharsToCount) noexcept
template<typename CharPointerType>
static size_t lengthUpTo (CharPointerType start, const CharPointerType end) noexcept
template<typename DestCharPointerType, typename SrcCharPointerType>
static void copyAll (DestCharPointerType &dest, SrcCharPointerType src) noexcept
template<typename DestCharPointerType, typename SrcCharPointerType>
static size_t copyWithDestByteLimit (DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
template<typename DestCharPointerType, typename SrcCharPointerType>
static void copyWithCharLimit (DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept
static int compare (water_uchar char1, water_uchar char2) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int compare (CharPointerType1 s1, CharPointerType2 s2) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int compareUpTo (CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
static int compareIgnoreCase (water_uchar char1, water_uchar char2) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int compareIgnoreCase (CharPointerType1 s1, CharPointerType2 s2) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int compareIgnoreCaseUpTo (CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int indexOf (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static CharPointerType1 find (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
template<typename CharPointerType>
static CharPointerType find (CharPointerType textToSearch, const water_uchar charToLookFor) noexcept
template<typename CharPointerType1, typename CharPointerType2>
static int indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2 needle) noexcept
template<typename Type>
static int indexOfChar (Type text, const water_uchar charToFind) noexcept
template<typename Type>
static int indexOfCharIgnoreCase (Type text, water_uchar charToFind) noexcept
template<typename Type>
static Type findEndOfWhitespace (Type text) noexcept
template<typename Type, typename BreakType>
static Type findEndOfToken (Type text, const BreakType breakCharacters, const Type quoteCharacters)

Static Private Member Functions

static double mulexp10 (const double value, int exponent) noexcept

Detailed Description

A collection of functions for manipulating characters and character strings.

Most of these methods are designed for internal use by the String and CharPointer classes, but some of them may be useful to call directly.

See also
String, CharPointer_UTF8, CharPointer_UTF16, CharPointer_UTF32

Member Function Documentation

◆ compare() [1/2]

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::compare ( CharPointerType1 s1,
CharPointerType2 s2 )
inlinestaticnoexcept

Compares two null-terminated character strings.

◆ compare() [2/2]

int water::CharacterFunctions::compare ( water_uchar char1,
water_uchar char2 )
inlinestaticnoexcept

Compares two characters.

◆ compareIgnoreCase() [1/2]

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::compareIgnoreCase ( CharPointerType1 s1,
CharPointerType2 s2 )
inlinestaticnoexcept

Compares two null-terminated character strings, using a case-independant match.

◆ compareIgnoreCase() [2/2]

int water::CharacterFunctions::compareIgnoreCase ( water_uchar char1,
water_uchar char2 )
inlinestaticnoexcept

Compares two characters, using a case-independant match.

◆ compareIgnoreCaseUpTo()

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::compareIgnoreCaseUpTo ( CharPointerType1 s1,
CharPointerType2 s2,
int maxChars )
inlinestaticnoexcept

Compares two null-terminated character strings, using a case-independent match.

◆ compareUpTo()

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::compareUpTo ( CharPointerType1 s1,
CharPointerType2 s2,
int maxChars )
inlinestaticnoexcept

Compares two null-terminated character strings, up to a given number of characters.

◆ copyAll()

template<typename DestCharPointerType, typename SrcCharPointerType>
void water::CharacterFunctions::copyAll ( DestCharPointerType & dest,
SrcCharPointerType src )
inlinestaticnoexcept

Copies null-terminated characters from one string to another.

◆ copyWithCharLimit()

template<typename DestCharPointerType, typename SrcCharPointerType>
void water::CharacterFunctions::copyWithCharLimit ( DestCharPointerType & dest,
SrcCharPointerType src,
int maxChars )
inlinestaticnoexcept

Copies characters from one string to another, up to a null terminator or a given maximum number of characters.

◆ copyWithDestByteLimit()

template<typename DestCharPointerType, typename SrcCharPointerType>
size_t water::CharacterFunctions::copyWithDestByteLimit ( DestCharPointerType & dest,
SrcCharPointerType src,
size_t maxBytesToWrite )
inlinestaticnoexcept

Copies characters from one string to another, up to a null terminator or a given byte size limit.

◆ find() [1/2]

template<typename CharPointerType>
CharPointerType water::CharacterFunctions::find ( CharPointerType textToSearch,
const water_uchar charToLookFor )
inlinestaticnoexcept

Returns a pointer to the first occurrence of a substring in a string. If the substring is not found, this will return a pointer to the string's null terminator.

◆ find() [2/2]

template<typename CharPointerType1, typename CharPointerType2>
CharPointerType1 water::CharacterFunctions::find ( CharPointerType1 textToSearch,
const CharPointerType2 substringToLookFor )
inlinestaticnoexcept

Returns a pointer to the first occurrence of a substring in a string. If the substring is not found, this will return a pointer to the string's null terminator.

◆ findEndOfToken()

template<typename Type, typename BreakType>
Type water::CharacterFunctions::findEndOfToken ( Type text,
const BreakType breakCharacters,
const Type quoteCharacters )
inlinestatic

Returns a pointer to the first character in the string which is found in the breakCharacters string.

◆ findEndOfWhitespace()

template<typename Type>
Type water::CharacterFunctions::findEndOfWhitespace ( Type text)
inlinestaticnoexcept

Returns a pointer to the first non-whitespace character in a string. If the string contains only whitespace, this will return a pointer to its null terminator.

◆ getDoubleValue()

template<typename CharPointerType>
double water::CharacterFunctions::getDoubleValue ( CharPointerType text)
inlinestaticnoexcept

Parses a character string, to read a floating-point value.

◆ getHexDigitValue()

int water::CharacterFunctions::getHexDigitValue ( water_uchar digit)
staticnoexcept

Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit.

◆ getIntValue()

template<typename IntType, typename CharPointerType>
IntType water::CharacterFunctions::getIntValue ( const CharPointerType text)
inlinestaticnoexcept

Parses a character string, to read an integer value.

◆ getUnicodeCharFromWindows1252Codepage()

water_uchar water::CharacterFunctions::getUnicodeCharFromWindows1252Codepage ( uint8 windows1252Char)
staticnoexcept

Converts a byte of Windows 1252 codepage to unicode.

◆ indexOf()

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::indexOf ( CharPointerType1 textToSearch,
const CharPointerType2 substringToLookFor )
inlinestaticnoexcept

Finds the character index of a given substring in another string. Returns -1 if the substring is not found.

◆ indexOfChar()

template<typename Type>
int water::CharacterFunctions::indexOfChar ( Type text,
const water_uchar charToFind )
inlinestaticnoexcept

Finds the character index of a given character in another string. Returns -1 if the character is not found.

◆ indexOfCharIgnoreCase()

template<typename Type>
int water::CharacterFunctions::indexOfCharIgnoreCase ( Type text,
water_uchar charToFind )
inlinestaticnoexcept

Finds the character index of a given character in another string, using a case-independent match. Returns -1 if the character is not found.

◆ indexOfIgnoreCase()

template<typename CharPointerType1, typename CharPointerType2>
int water::CharacterFunctions::indexOfIgnoreCase ( CharPointerType1 haystack,
const CharPointerType2 needle )
inlinestaticnoexcept

Finds the character index of a given substring in another string, using a case-independent match. Returns -1 if the substring is not found.

◆ isDigit() [1/2]

bool water::CharacterFunctions::isDigit ( char character)
staticnoexcept

Checks whether a character is a digit.

◆ isDigit() [2/2]

bool water::CharacterFunctions::isDigit ( water_uchar character)
staticnoexcept

Checks whether a character is a digit.

◆ isLetter() [1/2]

bool water::CharacterFunctions::isLetter ( char character)
staticnoexcept

Checks whether a character is alphabetic.

◆ isLetter() [2/2]

bool water::CharacterFunctions::isLetter ( water_uchar character)
staticnoexcept

Checks whether a character is alphabetic.

◆ isLetterOrDigit() [1/2]

bool water::CharacterFunctions::isLetterOrDigit ( char character)
staticnoexcept

Checks whether a character is alphabetic or numeric.

◆ isLetterOrDigit() [2/2]

bool water::CharacterFunctions::isLetterOrDigit ( water_uchar character)
staticnoexcept

Checks whether a character is alphabetic or numeric.

◆ isLowerCase()

bool water::CharacterFunctions::isLowerCase ( water_uchar character)
staticnoexcept

Checks whether a unicode character is lower-case.

◆ isPrintable() [1/2]

bool water::CharacterFunctions::isPrintable ( char character)
staticnoexcept

Checks whether a character is a printable character, i.e. alphabetic, numeric, a punctuation character or a space.

◆ isPrintable() [2/2]

bool water::CharacterFunctions::isPrintable ( water_uchar character)
staticnoexcept

Checks whether a character is a printable character, i.e. alphabetic, numeric, a punctuation character or a space.

◆ isUpperCase()

bool water::CharacterFunctions::isUpperCase ( water_uchar character)
staticnoexcept

Checks whether a unicode character is upper-case.

◆ isWhitespace() [1/2]

bool water::CharacterFunctions::isWhitespace ( char character)
staticnoexcept

Checks whether a character is whitespace.

◆ isWhitespace() [2/2]

bool water::CharacterFunctions::isWhitespace ( water_uchar character)
staticnoexcept

Checks whether a character is whitespace.

◆ lengthUpTo() [1/2]

template<typename CharPointerType>
size_t water::CharacterFunctions::lengthUpTo ( CharPointerType start,
const CharPointerType end )
inlinestaticnoexcept

Counts the number of characters in a given string, stopping if the count exceeds a specified end-pointer.

◆ lengthUpTo() [2/2]

template<typename CharPointerType>
size_t water::CharacterFunctions::lengthUpTo ( CharPointerType text,
const size_t maxCharsToCount )
inlinestaticnoexcept

Counts the number of characters in a given string, stopping if the count exceeds a specified limit.

◆ mulexp10()

double water::CharacterFunctions::mulexp10 ( const double value,
int exponent )
staticprivatenoexcept

◆ readDoubleValue()

template<typename CharPointerType>
double water::CharacterFunctions::readDoubleValue ( CharPointerType & text)
inlinestaticnoexcept

Parses a character string to read a floating-point number. Note that this will advance the pointer that is passed in, leaving it at the end of the number.

◆ toLowerCase()

water_uchar water::CharacterFunctions::toLowerCase ( water_uchar character)
staticnoexcept

Converts a character to lower-case.

◆ toUpperCase()

water_uchar water::CharacterFunctions::toUpperCase ( water_uchar character)
staticnoexcept

Converts a character to upper-case.


The documentation for this class was generated from the following files: