説明を見る。00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef WTF_ASCIICType_h
00030 #define WTF_ASCIICType_h
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 inline bool isASCIIAlpha(char c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00043 inline bool isASCIIAlpha(unsigned short c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00044 inline bool isASCIIAlpha(int c) { return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00045
00046 inline bool isASCIIAlphanumeric(char c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00047 inline bool isASCIIAlphanumeric(unsigned short c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00048 inline bool isASCIIAlphanumeric(int c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; }
00049
00050 inline bool isASCIIDigit(char c) { return (c >= '0') & (c <= '9'); }
00051 inline bool isASCIIDigit(unsigned short c) { return (c >= '0') & (c <= '9'); }
00052 inline bool isASCIIDigit(int c) { return (c >= '0') & (c <= '9'); }
00053
00054 inline bool isASCIIHexDigit(char c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'f'; }
00055 inline bool isASCIIHexDigit(unsigned short c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'f'; }
00056 inline bool isASCIIHexDigit(int c) { return c >= '0' && c <= '9' || (c | 0x20) >= 'a' && (c | 0x20) <= 'f'; }
00057
00058 inline bool isASCIILower(char c) { return c >= 'a' && c <= 'z'; }
00059 inline bool isASCIILower(unsigned short c) { return c >= 'a' && c <= 'z'; }
00060 inline bool isASCIILower(int c) { return c >= 'a' && c <= 'z'; }
00061
00062 inline bool isASCIIUpper(char c) { return c >= 'A' && c <= 'Z'; }
00063 inline bool isASCIIUpper(unsigned short c) { return c >= 'A' && c <= 'Z'; }
00064 inline bool isASCIIUpper(int c) { return c >= 'A' && c <= 'Z'; }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 inline bool isASCIISpace(char c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
00080 inline bool isASCIISpace(unsigned short c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
00081 inline bool isASCIISpace(int c) { return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); }
00082
00083 inline char toASCIILower(char c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
00084 inline unsigned short toASCIILower(unsigned short c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
00085 inline int toASCIILower(int c) { return c | ((c >= 'A' && c <= 'Z') << 5); }
00086
00087 inline char toASCIIUpper(char c) { return static_cast<char>(c & ~((c >= 'a' && c <= 'z') << 5)); }
00088 inline unsigned short toASCIIUpper(unsigned short c) { return static_cast<unsigned short>(c & ~((c >= 'a' && c <= 'z') << 5)); }
00089 inline int toASCIIUpper(int c) { return static_cast<int>(c & ~((c >= 'a' && c <= 'z') << 5)); }
00090
00091 inline int toASCIIHexValue(char c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
00092 inline int toASCIIHexValue(unsigned short c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
00093 inline int toASCIIHexValue(int c) { ASSERT(isASCIIHexDigit(c)); return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; }
00094
00095 #endif