HTTP Parser and message builder / objects in plain C Snapshot
Functions
charclass.h File Reference
#include <cutils/base.h>

Go to the source code of this file.

Functions

M_INLINE int is_digit (int8_t ch)
M_INLINE int is_upper_case (int8_t ch)
M_INLINE int is_hex (int8_t ch)
M_INLINE int is_hex_ext (int8_t ch)
M_INLINE int is_alpha (int8_t ch)
M_INLINE int is_alphanum (int8_t ch)

Function Documentation

M_INLINE int is_alpha ( int8_t  ch)

Definition at line 37 of file charclass.h.

{
  return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
}
M_INLINE int is_alphanum ( int8_t  ch)

Definition at line 42 of file charclass.h.

{
  return is_alpha( ch ) || is_digit( ch );
}
M_INLINE int is_digit ( int8_t  ch)

Definition at line 7 of file charclass.h.

{
  return (ch >= '0' && ch <= '9');
}
M_INLINE int is_hex ( int8_t  ch)

Definition at line 17 of file charclass.h.

{
  return is_digit(ch) || (ch >= 'a' && ch <='f') || (ch >='A' && ch <= 'F');
}
M_INLINE int is_hex_ext ( int8_t  ch)

Definition at line 23 of file charclass.h.

{
  if (is_digit(ch)) {
    return ch - '0';
  }
  if ( ch >= 'a' && ch <='f') { 
    return ch - 'a';
  }
  if ( ch >='A' && ch <= 'F') {
    return ch - 'A';
  }
  return 0;
}
M_INLINE int is_upper_case ( int8_t  ch)

Definition at line 12 of file charclass.h.

{
  return (ch >= 'A' && ch <= 'Z');
}