Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Static Public Member Functions | Static Public Attributes
ImportCharSet Class Reference

#include <ImportCharSet.h>

List of all members.

Public Types

enum  {
  cTabChar = 9, cLinefeedChar = 10, cCRChar = 13, cSpaceChar = 32,
  cUpperAChar = 65, cUpperZChar = 90, cUnderscoreChar = 95, cLowerAChar = 97,
  cLowerZChar = 122, cZeroChar = 48, cNineChar = 57, cAlphaNumChar = 1,
  cAlphaChar = 2, cWhiteSpaceChar = 4, cDigitChar = 8, c822SpecialChar = 16
}

Static Public Member Functions

static PRBool IsUSAscii (PRUint8 ch)
static PRBool Is822CtlChar (PRUint8 ch)
static PRBool Is822SpecialChar (PRUint8 ch)
static PRBool IsWhiteSpace (PRUint8 ch)
static PRBool IsAlphaNum (PRUint8 ch)
static PRBool IsDigit (PRUint8 ch)
static PRUint8 ToLower (PRUint8 ch)
static long AsciiToLong (const PRUint8 *pChar, PRUint32 len)
static void ByteToHex (PRUint8 byte, PRUint8 *pHex)
static void LongToHexBytes (PRUint32 type, PRUint8 *pStr)
static void SkipWhiteSpace (const PRUint8 *&pChar, PRUint32 &pos, PRUint32 max)
static void SkipSpaceTab (const PRUint8 *&pChar, PRUint32 &pos, PRUint32 max)
static void SkipTilSpaceTab (const PRUint8 *&pChar, PRUint32 &pos, PRUint32 max)
static PRBool StrNICmp (const PRUint8 *pChar, const PRUint8 *pSrc, PRUint32 len)
static PRBool StrNCmp (const PRUint8 *pChar, const PRUint8 *pSrc, PRUint32 len)
static int FindChar (const PRUint8 *pChar, PRUint8 ch, PRUint32 max)
static PRBool NextChar (const PRUint8 *&pChar, PRUint8 ch, PRUint32 &pos, PRUint32 max)
static PRInt32 strcmp (const char *pS1, const char *pS2)
static PRInt32 stricmp (const char *pS1, const char *pS2)

Static Public Attributes

static char m_upperCaseMap [256]
static char m_Ascii [256] = {0}

Detailed Description

Definition at line 61 of file ImportCharSet.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
cTabChar 
cLinefeedChar 
cCRChar 
cSpaceChar 
cUpperAChar 
cUpperZChar 
cUnderscoreChar 
cLowerAChar 
cLowerZChar 
cZeroChar 
cNineChar 
cAlphaNumChar 
cAlphaChar 
cWhiteSpaceChar 
cDigitChar 
c822SpecialChar 

Definition at line 63 of file ImportCharSet.h.


Member Function Documentation

static long ImportCharSet::AsciiToLong ( const PRUint8 pChar,
PRUint32  len 
) [inline, static]

Definition at line 95 of file ImportCharSet.h.

                                                                            {
              long num = 0;
              while (len) {
                     if ((m_Ascii[*pChar] & cDigitChar) == 0)
                            return( num);
                     num *= 10;
                     num += (*pChar - cZeroChar);
                     len--;
                     pChar++;
              }
              return( num);
       }
static void ImportCharSet::ByteToHex ( PRUint8  byte,
PRUint8 pHex 
) [inline, static]

Definition at line 108 of file ImportCharSet.h.

                                                                   {
              PRUint8 val = byte;
              val /= 16;
              if (val < 10)
                     *pHex = '0' + val;
              else
                     *pHex = 'A' + (val - 10);
              pHex++;
              val = byte;
              val &= 0x0F;
              if (val < 10)
                     *pHex = '0' + val;
              else
                     *pHex = 'A' + (val - 10);          
       }

Here is the caller graph for this function:

static int ImportCharSet::FindChar ( const PRUint8 pChar,
PRUint8  ch,
PRUint32  max 
) [inline, static]

Definition at line 167 of file ImportCharSet.h.

                                                                                    {
              PRUint32             pos = 0;
              while ((pos < max) && (*pChar != ch)) {
                     pos++; pChar++;
              }
              if (pos < max)
                     return( (int) pos);
              else
                     return( -1);
       }
static PRBool ImportCharSet::Is822CtlChar ( PRUint8  ch) [inline, static]

Definition at line 87 of file ImportCharSet.h.

{ return( (ch < 32));}

Here is the caller graph for this function:

static PRBool ImportCharSet::Is822SpecialChar ( PRUint8  ch) [inline, static]

Definition at line 88 of file ImportCharSet.h.

{ return( (m_Ascii[ch] & c822SpecialChar) == c822SpecialChar);}

Here is the caller graph for this function:

static PRBool ImportCharSet::IsAlphaNum ( PRUint8  ch) [inline, static]

Definition at line 90 of file ImportCharSet.h.

{ return( (m_Ascii[ch] & cAlphaNumChar) == cAlphaNumChar); }
static PRBool ImportCharSet::IsDigit ( PRUint8  ch) [inline, static]

Definition at line 91 of file ImportCharSet.h.

{ return( (m_Ascii[ch] & cDigitChar) == cDigitChar); }
static PRBool ImportCharSet::IsUSAscii ( PRUint8  ch) [inline, static]

Definition at line 86 of file ImportCharSet.h.

{ return( ((ch & (PRUint8)0x80) == 0));}

Here is the caller graph for this function:

static PRBool ImportCharSet::IsWhiteSpace ( PRUint8  ch) [inline, static]

Definition at line 89 of file ImportCharSet.h.

{ return( (m_Ascii[ch] & cWhiteSpaceChar) == cWhiteSpaceChar); }

Here is the caller graph for this function:

static void ImportCharSet::LongToHexBytes ( PRUint32  type,
PRUint8 pStr 
) [inline, static]

Definition at line 124 of file ImportCharSet.h.

                                                                           {
              ByteToHex( (PRUint8) (type >> 24), pStr);
              pStr += 2;
              ByteToHex( (PRUint8) ((type >> 16) & 0x0FF), pStr);
              pStr += 2;
              ByteToHex( (PRUint8) ((type >> 8) & 0x0FF), pStr);
              pStr += 2;
              ByteToHex( (PRUint8) (type & 0x0FF), pStr);
       }

Here is the call graph for this function:

static PRBool ImportCharSet::NextChar ( const PRUint8 *&  pChar,
PRUint8  ch,
PRUint32 pos,
PRUint32  max 
) [inline, static]

Definition at line 178 of file ImportCharSet.h.

                                                                                                        {
              if ((pos < max) && (*pChar == ch)) {
                     pos++;
                     pChar++;
                     return( PR_TRUE);
              }
              return( PR_FALSE);
       }
static void ImportCharSet::SkipSpaceTab ( const PRUint8 *&  pChar,
PRUint32 pos,
PRUint32  max 
) [inline, static]

Definition at line 140 of file ImportCharSet.h.

                                                                                              {
              while ((pos < max) && ((*pChar == (PRUint8)cSpaceChar) || (*pChar == (PRUint8)cTabChar))) {
                     pos++; pChar++;
              }
       }
static void ImportCharSet::SkipTilSpaceTab ( const PRUint8 *&  pChar,
PRUint32 pos,
PRUint32  max 
) [inline, static]

Definition at line 146 of file ImportCharSet.h.

                                                                                                 {
              while ((pos < max) && (*pChar != (PRUint8)cSpaceChar) && (*pChar != (PRUint8)cTabChar)) {
                     pos++;
                     pChar++;
              }
       }
static void ImportCharSet::SkipWhiteSpace ( const PRUint8 *&  pChar,
PRUint32 pos,
PRUint32  max 
) [inline, static]

Definition at line 134 of file ImportCharSet.h.

                                                                                                 {
              while ((pos < max) && (IsWhiteSpace( *pChar))) {
                     pos++; pChar++;
              }
       }

Here is the call graph for this function:

static PRInt32 ImportCharSet::strcmp ( const char *  pS1,
const char *  pS2 
) [inline, static]

Definition at line 187 of file ImportCharSet.h.

                                                                         {
              while (*pS1 && *pS2 && (*pS1 == *pS2)) {
                     pS1++;
                     pS2++;
              }
              return( *pS1 - *pS2);
       }
static PRInt32 ImportCharSet::stricmp ( const char *  pS1,
const char *  pS2 
) [inline, static]

Definition at line 195 of file ImportCharSet.h.

                                                                          {
              while (*pS1 && *pS2 && (m_upperCaseMap[*pS1] == m_upperCaseMap[*pS2])) {
                     pS1++;
                     pS2++;
              }
              return( m_upperCaseMap[*pS1] - m_upperCaseMap[*pS2]);
       }
static PRBool ImportCharSet::StrNCmp ( const PRUint8 pChar,
const PRUint8 pSrc,
PRUint32  len 
) [inline, static]

Definition at line 160 of file ImportCharSet.h.

                                                                                               {
              while (len && (*pChar == *pSrc)) {
                     pChar++; pSrc++; len--;
              }
              return( len == 0);
       }
static PRBool ImportCharSet::StrNICmp ( const PRUint8 pChar,
const PRUint8 pSrc,
PRUint32  len 
) [inline, static]

Definition at line 153 of file ImportCharSet.h.

                                                                                                 {
              while (len && (m_upperCaseMap[*pChar] == m_upperCaseMap[*pSrc])) {
                     pChar++; pSrc++; len--;
              }
              return( len == 0);
       }
static PRUint8 ImportCharSet::ToLower ( PRUint8  ch) [inline, static]

Definition at line 93 of file ImportCharSet.h.

{ if ((m_Ascii[ch] & cAlphaChar) == cAlphaChar) { return( cLowerAChar + (m_upperCaseMap[ch] - cUpperAChar)); } else return( ch); }

Member Data Documentation

char ImportCharSet::m_Ascii = {0} [static]

Definition at line 84 of file ImportCharSet.h.

Definition at line 83 of file ImportCharSet.h.


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