Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
strings.cc File Reference
#include "strings.hh"
#include "internal.hh"
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <libintl.h>
#include <iconv.h>
#include <errno.h>
#include <algorithm>
#include <glib.h>
#include "testing.hh"

Go to the source code of this file.

Namespaces

namespace  Ase
 The Anklang C++ API namespace.
 

Macros

#define STACK_BUFFER_SIZE
 

Functions

unichar Ase::Unicode::tolower (unichar uc)
 
unichar Ase::Unicode::toupper (unichar uc)
 
unichar Ase::Unicode::totitle (unichar uc)
 
String Ase::string_multiply (const String &s, uint64 count)
 Reproduce a string s for count times.
 
String Ase::string_to_identifier (const String &input)
 Force lower case, alphanumerics + underscore and non-digit start.
 
String Ase::string_canonify (const String &string, const String &valid_chars, const String &substitute)
 
bool Ase::string_is_canonified (const String &string, const String &valid_chars)
 Check if string_canonify() would modify string.
 
const StringAse::string_set_a2z ()
 Returns a string containing all of a-z.
 
const StringAse::string_set_A2Z ()
 Returns a string containing all of A-Z.
 
const StringAse::string_set_ascii_alnum ()
 Returns a string containing all of 0-9, A-Z and a-z.
 
bool Ase::string_is_ascii_alnum (const String &str)
 
String Ase::string_tolower (const String &str)
 Convert all string characters into Unicode lower case characters.
 
bool Ase::string_islower (const String &str)
 Check if all string characters are Unicode lower case characters.
 
String Ase::string_toupper (const String &str)
 Convert all string characters into Unicode upper case characters.
 
bool Ase::string_isupper (const String &str)
 Check if all string characters are Unicode upper case characters.
 
String Ase::string_totitle (const String &str)
 Convert all string characters into Unicode title characters.
 
String Ase::string_capitalize (const String &str, size_t maxn, bool rest_tolower)
 Capitalize words, so the first letter is upper case, the rest lower case.
 
String Ase::string_normalize_nfc (const String &src)
 Yield normalized composed UTF-8 string.
 
String Ase::string_normalize_nfd (const String &src)
 Yield normalized decomposed UTF-8 string.
 
String Ase::string_normalize_nfkc (const String &src)
 Formatting stripped normalized composed UTF-8 string.
 
String Ase::string_normalize_nfkd (const String &src)
 Formatting stripped normalized decomposed UTF-8 string.
 
String Ase::string_casefold (const String &src)
 Yield UTF-8 string useful for case insensitive comparisons.
 
int Ase::string_cmp (const String &s1, const String &s2)
 Like strcmp(3) for UTF-8 strings.
 
int Ase::string_casecmp (const String &s1, const String &s2)
 Like strcasecmp(3) for UTF-8 strings.
 
String Ase::string_vprintf (const char *format, va_list vargs)
 Formatted printing ala vprintf() into a String, using the POSIX/C locale.
 
String Ase::string_locale_vprintf (const char *format, va_list vargs)
 Formatted printing like string_vprintf using the current locale.
 
StringS Ase::string_split (const String &string, const String &splitter, size_t maxn)
 
StringS Ase::string_split_any (const String &string, const String &splitchars, size_t maxn)
 
StringS Ase::strings_version_sort (const StringS &strings, bool reverse)
 
void Ase::strings_version_sort (StringS *strings, bool reverse)
 
void Ase::string_vector_erase_empty (StringS &svector)
 Remove empty elements from a string vector.
 
void Ase::string_vector_lstrip (StringS &svector)
 Left-strip all elements of a string vector, see string_lstrip().
 
void Ase::string_vector_rstrip (StringS &svector)
 Right-strip all elements of a string vector, see string_rstrip().
 
void Ase::string_vector_strip (StringS &svector)
 Strip all elements of a string vector, see string_strip().
 
String Ase::string_join (const String &junctor, const StringS &strvec)
 
bool Ase::string_to_bool (const String &string, bool fallback)
 
bool Ase::cstring_to_bool (const char *string, bool fallback)
 
const charAse::strrstr (const char *haystack, const char *needle)
 
const charAse::string_find_word (const char *haystack, const char *word)
 Find occurance of word in haystack.
 
String Ase::string_from_bool (bool value)
 Convert a boolean value into a string.
 
uint64 Ase::string_to_uint (const String &string, size_t *consumed, uint base)
 Parse a string into a 64bit unsigned integer, optionally specifying the expected number base.
 
String Ase::string_from_uint (uint64 value)
 Convert a 64bit unsigned integer into a string.
 
bool Ase::string_has_int (const String &string)
 Checks if a string contains a digit, optionally preceeded by whitespaces.
 
int64 Ase::string_to_int (const String &string, size_t *consumed, uint base)
 Parse a string into a 64bit integer, optionally specifying the expected number base.
 
String Ase::string_from_int (int64 value)
 Convert a 64bit signed integer into a string.
 
long double Ase::posix_locale_strtold (const char *nptr, char **endptr)
 Parse a double from a string ala strtod(), trying locale specific characters and POSIX/C formatting.
 
long double Ase::current_locale_strtold (const char *nptr, char **endptr)
 Parse a double from a string ala strtod(), trying locale specific characters and POSIX/C formatting.
 
long double Ase::string_to_long_double (const String &string)
 Parse a long double from a string, trying locale specific characters and POSIX/C formatting.
 
long double Ase::string_to_long_double (const char *dblstring, const char **endptr)
 Similar to string_to_long_double(const String&), but returns the first failing character position in endptr.
 
double Ase::string_to_double (const String &string)
 Parse a double from a string, trying locale specific characters and POSIX/C formatting.
 
double Ase::string_to_double (const char *dblstring, const char **endptr)
 Similar to string_to_double(const String&), but returns the first failing character position in endptr.
 
String Ase::string_from_float (float value)
 Convert a float into a string, using the POSIX/C locale.
 
String Ase::string_from_double (double value)
 Convert a double into a string, using the POSIX/C locale.
 
String Ase::string_from_long_double (long double value)
 Convert a long double into a string, using the POSIX/C locale.
 
std::vector< doubleAse::string_to_double_vector (const String &string)
 Parse a string into a list of doubles, expects ';' as delimiter.
 
String Ase::string_from_double_vector (const std::vector< double > &dvec, const String &delim)
 Construct a string out of all double values passed in dvec, separated by delim.
 
double Ase::string_to_seconds (const String &string, double fallback)
 Parse string into seconds.
 
String Ase::string_from_errno (int errno_val)
 Returns a String describing the passed in errno value, similar to strerror().
 
bool Ase::string_is_uuid (const String &uuid_string)
 Returns whether uuid_string contains a properly formatted UUID string.
 
int Ase::string_cmp_uuid (const String &uuid_string1, const String &uuid_string2)
 Returns whether uuid_string1 compares smaller (-1), equal (0) or greater (+1) to uuid_string2.
 
bool Ase::string_startswith (const String &string, const String &fragment)
 Returns whether string starts with fragment.
 
bool Ase::string_startswith (const String &string, const StringS &fragments)
 Returns whether string starts with any element of fragments.
 
bool Ase::string_endswith (const String &string, const String &fragment)
 Returns whether string ends with fragment.
 
bool Ase::string_endswith (const String &string, const StringS &fragments)
 Returns whether string ends with any element of fragments.
 
bool Ase::string_match_identifier_tail (const String &ident, const String &tail)
 Variant of string_match_identifier() that matches tail against ident at word boundary.
 
bool Ase::string_match_identifier (const String &ident1, const String &ident2)
 Check equality of strings canonicalized to "[0-9a-z_]+".
 
String Ase::string_from_pretty_function_name (const char *cxx_pretty_function)
 
String Ase::string_url_decode (const String &urlstr, const bool form_url_encoded)
 Decode URL %-sequences in a string, decode '+' if form_url_encoded.
 
String Ase::string_url_encode (const String &rawstr, const bool form_url_encoded)
 Encode special characters to URL %-sequences, encode space as '+' if form_url_encoded.
 
String Ase::string_to_cescape (const String &str)
 
String Ase::string_to_cquote (const String &str)
 Returns a string as C string including double quotes.
 
String Ase::string_from_cquote (const String &input)
 Parse a possibly quoted C string into regular string.
 
String Ase::string_lstrip (const String &input)
 Strip whitespaces from the left of a string.
 
String Ase::string_rstrip (const String &input)
 Strip whitespaces from the right of a string.
 
String Ase::string_strip (const String &input)
 Strip whitespaces from the left and right of a string.
 
String Ase::string_replace (const String &input, const String &marker, const String &replacement, size_t maxn)
 Replace substring marker in input with replacement, at most maxn times.
 
String Ase::string_substitute_char (const String &input, const char match, const char subst)
 Replace all occouranes of match in input with subst.
 
String Ase::string_to_hex (const String &input)
 Convert bytes in string input to hexadecimal numbers.
 
String Ase::string_hexdump (const void *addr, size_t length, size_t initial_offset)
 
void Ase::memset4 (uint32 *mem, uint32 filler, uint length)
 Fill a memory area with a 32-bit quantitiy.
 
String Ase::string_vector_find (const StringS &svector, const String &prefix, const String &fallback)
 
String Ase::string_vector_find_value (const StringS &svector, const String &prefix, const String &fallback)
 
StringS Ase::cstrings_to_vector (const char *s,...)
 Construct a StringS from a NULL terminated list of string arguments.
 
String Ase::kvpair_key (const String &key_value_pair)
 
String Ase::kvpair_value (const String &key_value_pair)
 
String Ase::kvpairs_fetch (const StringS &kvs, const String &key, bool casesensitive)
 
ssize_t Ase::kvpairs_search (const StringS &kvs, const String &k, const bool casesensitive)
 
bool Ase::kvpairs_assign (StringS &kvs, const String &key_value_pair, bool casesensitive)
 
std::string_view Ase::string_option_find_value (const char *string, const char *feature, const char *fallback, const char *denied, bool matchallnone)
 Low level option search, avoids dynamic allocations.
 
String Ase::string_option_find (const String &optionlist, const String &feature, const String &fallback)
 Retrieve the option value from an options list separated by ':' or ';' or fallback.
 
bool Ase::string_option_check (const String &optionlist, const String &feature)
 Check if an option is set/unset in an options list string.
 
bool Ase::text_convert (const String &to_charset, String &output_string, const String &from_charset, const String &input_string, const String &fallback_charset, const String &output_mark)
 
const charAse::strerror (int errno_num)
 Get POSIX locale strerror.
 
const charAse::strerror ()
 

Macro Definition Documentation

◆ STACK_BUFFER_SIZE

#define STACK_BUFFER_SIZE

Definition at line 273 of file strings.cc.

Function Documentation

◆ tolower()

unichar Ase::Unicode::tolower ( unichar  uc)
extern

Definition at line 17 of file strings.cc.

◆ totitle()

unichar Ase::Unicode::totitle ( unichar  uc)
extern

Definition at line 19 of file strings.cc.

◆ toupper()

unichar Ase::Unicode::toupper ( unichar  uc)
extern

Definition at line 18 of file strings.cc.