JASSv2
Static Public Member Functions | Protected Types | Static Protected Attributes | List of all members
JASS::ascii Class Reference

A fast, table-driven, implementation of the C runtime library ctype routines. More...

#include <ascii.h>

Static Public Member Functions

static int isascii (uint8_t c)
 Is the given character a plain 7-bit ASCII character. More...
 
static int isalnum (uint8_t c)
 Is this character alphanumeric? More...
 
static int isalpha (uint8_t c)
 Is this character an uppercase or lowercase alphabetic? More...
 
static int iscntrl (uint8_t c)
 Is this character a control character (ASCII code 0x00-0x1F or 0x7F)? More...
 
static int isdigit (uint8_t c)
 Is this character a digit? More...
 
static int isgraph (uint8_t c)
 Is this character a graphical character (defined as printable but not space). More...
 
static int islower (uint8_t c)
 Is this character a lowercase character. More...
 
static int isprint (uint8_t c)
 Is this character a printable character (all characters greater than 0x1F, except 0x7F). More...
 
static int ispunct (uint8_t c)
 Is this character a punctuation character (a non-alphanumeric character that is printable). More...
 
static int isspace (uint8_t c)
 Is this character a space character (space, tab, vertical tab, carrage return, newline, form feed) More...
 
static int isupper (uint8_t c)
 Is this character a uppercase character. More...
 
static int isxdigit (uint8_t c)
 Is this character a hexadecimal digit. More...
 
static int isDNAbase (uint8_t c)
 Is this character a DNA base (i.e. in {a,t,c,g,A,T,C,G}) More...
 
static int isvowel (uint8_t c)
 Is this character a vowel (i.e. in {aeiouAEIOU}) More...
 
static int isvowely (uint8_t c)
 Is this character a vowel or Y (i.e. in {aeiouyAEIOUY}) More...
 
static uint8_t tolower (uint8_t c)
 Convert the uppercase character to lowercase (and leave all other characters are they are). More...
 
static uint8_t toupper (uint8_t c)
 Convert the lowercase character to uppercase (and leave all other characters are they are). More...
 
static void unittest (void)
 Unit test this class. More...
 

Protected Types

enum  {
  UPPER = 1, LOWER = 2, DIGIT = 4, CONTROL = 8,
  PUNC = 16, SPACE = 32, HEX = 64, DNA = 128,
  VOWEL = 256, VOWELY = 512, ALPHA = UPPER | LOWER, ALNUM = ALPHA | DIGIT,
  GRAPH = PUNC | UPPER | LOWER | DIGIT
}
 The enum of characteristics of an ascii character. More...
 

Static Protected Attributes

static const uint16_t ctype []
 table of characteristics about a character. ctype['x'] is "all about x".
 
static const uint8_t upper_list []
 table of uppercase values. upper_list['x'] is the uppercase of x (i.e. 'X')
 
static const uint8_t lower_list []
 table of lowercase values. lower_list['X'] is the lowercase of x (i.e. 'x')
 

Detailed Description

A fast, table-driven, implementation of the C runtime library ctype routines.

This implementation assumes the plain 7-bit ASCII as it is expected to be used alongside the Unicode equivelant. These methods can be called with 8-bit values). Because 7-bit ASCII is used its not necessary to manage locals - which also makes it faster.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

The enum of characteristics of an ascii character.

Enumerator
UPPER 

this character is an upper case character.

LOWER 

this character is a lower case character.

DIGIT 

this character is a digit.

CONTROL 

this character is a control character.

PUNC 

this characgter is punctuation.

SPACE 

this character is whitespace.

HEX 

this character is a hexadecimal digit.

DNA 

this character is a DNA base (i.e in: {ATCGatcg})

VOWEL 

this character is a vowel (i.e in: {aeiouAEIOU})

VOWELY 

this character is a vowel or Y (i.e in: {aeiouyAEIOUY})

ALPHA 

this character is alphabetic

ALNUM 

this character is alphanumeric

GRAPH 

this character is a graphic character

Member Function Documentation

◆ isalnum()

static int JASS::ascii::isalnum ( uint8_t  c)
inlinestatic

Is this character alphanumeric?

Parameters
c[in] The character to check
Returns
true if uppercase, lowercase, or a digit, else false.

◆ isalpha()

static int JASS::ascii::isalpha ( uint8_t  c)
inlinestatic

Is this character an uppercase or lowercase alphabetic?

Parameters
c[in] The character to check
Returns
true if uppercase or lowercase, else false.

◆ isascii()

static int JASS::ascii::isascii ( uint8_t  c)
inlinestatic

Is the given character a plain 7-bit ASCII character.

Parameters
c[in] The character to check.
Returns
true is the high bit is 0, false if the high bit is 1.

◆ iscntrl()

static int JASS::ascii::iscntrl ( uint8_t  c)
inlinestatic

Is this character a control character (ASCII code 0x00-0x1F or 0x7F)?

Parameters
c[in] The character to check
Returns
true if a control character, else false.

◆ isdigit()

static int JASS::ascii::isdigit ( uint8_t  c)
inlinestatic

Is this character a digit?

Parameters
c[in] The character to check
Returns
true if a digit, else false.

◆ isDNAbase()

static int JASS::ascii::isDNAbase ( uint8_t  c)
inlinestatic

Is this character a DNA base (i.e. in {a,t,c,g,A,T,C,G})

Parameters
c[in] The character to check
Returns
true if a DNA base, else false.

◆ isgraph()

static int JASS::ascii::isgraph ( uint8_t  c)
inlinestatic

Is this character a graphical character (defined as printable but not space).

Parameters
c[in] The character to check
Returns
true if a graphic character, else false.

◆ islower()

static int JASS::ascii::islower ( uint8_t  c)
inlinestatic

Is this character a lowercase character.

Parameters
c[in] The character to check
Returns
true if a lowercase character, else false.

◆ isprint()

static int JASS::ascii::isprint ( uint8_t  c)
inlinestatic

Is this character a printable character (all characters greater than 0x1F, except 0x7F).

Parameters
c[in] The character to check
Returns
true if a printable character, else false.

◆ ispunct()

static int JASS::ascii::ispunct ( uint8_t  c)
inlinestatic

Is this character a punctuation character (a non-alphanumeric character that is printable).

Parameters
c[in] The character to check
Returns
true if a punctuation character, else false.

◆ isspace()

static int JASS::ascii::isspace ( uint8_t  c)
inlinestatic

Is this character a space character (space, tab, vertical tab, carrage return, newline, form feed)

Parameters
c[in] The character to check
Returns
true if a space character, else false.

◆ isupper()

static int JASS::ascii::isupper ( uint8_t  c)
inlinestatic

Is this character a uppercase character.

Parameters
c[in] The character to check
Returns
true if an uppercase character, else false.

◆ isvowel()

static int JASS::ascii::isvowel ( uint8_t  c)
inlinestatic

Is this character a vowel (i.e. in {aeiouAEIOU})

Parameters
c[in] The character to check
Returns
true if a vowel base, else false.

◆ isvowely()

static int JASS::ascii::isvowely ( uint8_t  c)
inlinestatic

Is this character a vowel or Y (i.e. in {aeiouyAEIOUY})

Parameters
c[in] The character to check
Returns
true if a vowel base, else false.

◆ isxdigit()

static int JASS::ascii::isxdigit ( uint8_t  c)
inlinestatic

Is this character a hexadecimal digit.

Parameters
c[in] The character to check
Returns
true if a hexadecimal, else false.

◆ tolower()

static uint8_t JASS::ascii::tolower ( uint8_t  c)
inlinestatic

Convert the uppercase character to lowercase (and leave all other characters are they are).

Parameters
c[in] The character to convert.
Returns
if c is uppercase then the lowercase of c, else c.

◆ toupper()

static uint8_t JASS::ascii::toupper ( uint8_t  c)
inlinestatic

Convert the lowercase character to uppercase (and leave all other characters are they are).

Parameters
c[in] The character to convert.
Returns
if c is lowercae then the uppercase of c, else c.

◆ unittest()

static void JASS::ascii::unittest ( void  )
inlinestatic

Unit test this class.

This simply compares this class's method with the C runtime library versions. The test is exhaustive


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