Back to index

lightning-sunbird  0.9+nobinonly
Defines | Variables
nsID.cpp File Reference
#include "nsID.h"
#include "prprf.h"
#include "prmem.h"

Go to the source code of this file.

Defines

#define ADD_HEX_CHAR_TO_INT_OR_RETURN_FALSE(the_char, the_int_var)
 Multiplies the_int_var with 16 (0x10) and adds the value of the hexadecimal digit the_char.
#define PARSE_CHARS_TO_NUM(char_pointer, dest_variable, number_of_chars)
 Parses number_of_chars characters from the char_pointer pointer and puts the number in the dest_variable.
#define PARSE_HYPHEN(char_pointer)   if(*(char_pointer++) != '-') return PR_FALSE
 Parses a hyphen from the char_pointer string.

Variables

static const char gIDFormat [] = "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
static const char gIDFormat2 [] = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"

Define Documentation

#define ADD_HEX_CHAR_TO_INT_OR_RETURN_FALSE (   the_char,
  the_int_var 
)
Value:
the_int_var = (the_int_var << 4) + the_char; \
    if(the_char >= '0' && the_char <= '9') the_int_var -= '0'; \
    else if(the_char >= 'a' && the_char <= 'f') the_int_var -= 'a'-10; \
    else if(the_char >= 'A' && the_char <= 'F') the_int_var -= 'A'-10; \
    else return PR_FALSE

Multiplies the_int_var with 16 (0x10) and adds the value of the hexadecimal digit the_char.

If it fails it returns PR_FALSE from the function it's used in.

Definition at line 55 of file nsID.cpp.

#define PARSE_CHARS_TO_NUM (   char_pointer,
  dest_variable,
  number_of_chars 
)
Value:
do { PRInt32 _i=number_of_chars; \
  dest_variable = 0; \
  while(_i) { \
    ADD_HEX_CHAR_TO_INT_OR_RETURN_FALSE(*char_pointer, dest_variable); \
    char_pointer++; \
    _i--; \
  } } while(0)

Parses number_of_chars characters from the char_pointer pointer and puts the number in the dest_variable.

The pointer is moved to point at the first character after the parsed ones. If it fails it returns PR_FALSE from the function the macro is used in.

Definition at line 70 of file nsID.cpp.

#define PARSE_HYPHEN (   char_pointer)    if(*(char_pointer++) != '-') return PR_FALSE

Parses a hyphen from the char_pointer string.

If there is no hyphen there the function returns PR_FALSE from the function it's used in. The char_pointer is advanced one step.

Definition at line 86 of file nsID.cpp.


Variable Documentation

const char gIDFormat[] = "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}" [static]

Definition at line 42 of file nsID.cpp.

const char gIDFormat2[] = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" [static]

Definition at line 45 of file nsID.cpp.