xapian-core  2.2.0
Xapian::C Namespace Reference

Functions associated with handling single-byte characters. More...

Functions

bool isdigit (char ch)
 Like std::isdigit() but always uses the C locale.
bool isxdigit (char ch)
 Like std::isxdigit() but always uses the C locale.
bool isupper (char ch)
 Like std::isupper() but always uses the C locale.
bool islower (char ch)
 Like std::islower() but always uses the C locale.
bool isalpha (char ch)
 Like std::isalpha() but always uses the C locale.
bool isalnum (char ch)
 Like std::isalnum() but always uses the C locale.
bool isspace (char ch)
 Like std::isspace() but always uses the C locale.
char tolower (char ch)
 Like std::tolower() but always uses the C locale.
char toupper (char ch)
 Like std::toupper() but always uses the C locale.
int hex_digit (char ch)
 Convert an ASCII hex digit to its numeric value.
unsigned char hex_decode (char ch1, char ch2)
 Decode a pair of ASCII hex digits to an ASCII character.

Detailed Description

Functions associated with handling single-byte characters.

Most of the functions in this namespace work like the standard C library function with the same name, except they aren't affected by the current locale - they work as if the locale is set to "C", so e.g. isalpha() only returns true for ASCII letters. They work for characters in ASCII and character sets where ASCII is a subset (such as iso-8859-1 and UTF-8).

Other differences to the standard C library versions are that they handle signed char values as well as unsigned, and have a suitable signature for using as a predicate with C++ standard library functions such as find_if().

Since
Xapian 2.2.0.

Function Documentation

◆ hex_decode()

unsigned char Xapian::C::hex_decode ( char ch1,
char ch2 )
inline

Decode a pair of ASCII hex digits to an ASCII character.

E.g. hex_decode('4', 'A') gives '\x4A' which is 'J'.

If Xapian::C::isxdigit(ch1) isn't true then ch1 is treated as '0', and similarly for ch2.

References hex_digit().

◆ hex_digit()

int Xapian::C::hex_digit ( char ch)
inline

Convert an ASCII hex digit to its numeric value.

E.g. hex_decode('A', 'A') gives 10.

If Xapian::C::isxdigit(ch) isn't true then ch is treated as '0'.

Referenced by hex_decode().