24 #ifndef __PLATFORMCHAR__ 25 #define __PLATFORMCHAR__ 27 #define USE_CHARCOUNTER_CLASS 0 28 #define USE_PLATFORMCHAR_CLASS 1 30 #if USE_CHARCOUNTER_CLASS 37 CharCounter(int32 value)
38 { fNumChars = value; };
40 inline void Set(int32 value)
41 { fNumChars = value; }
43 inline int32 GetInt32()
const 44 {
return (fNumChars); }
48 operator int32()
const 51 int32& operator = (
const int32 &newValue)
52 { fNumChars = newValue;
return fNumChars; }
54 inline bool16 operator == (
const CharCounter &value)
const 55 {
return (value.GetInt32() == fNumChars);}
56 inline bool16 operator != (
const CharCounter &value)
const 57 {
return (value.GetInt32() != fNumChars);}
59 inline bool16 operator < (
const CharCounter &value)
const 60 {
return (fNumChars < value.GetInt32());}
61 inline bool16 operator > (
const CharCounter &value)
const 62 {
return (fNumChars > value.GetInt32());}
64 inline bool16 operator <= (
const CharCounter &value)
const 65 {
return (fNumChars <= value.GetInt32()); }
66 inline bool16 operator >= (
const CharCounter &value)
const 67 {
return (fNumChars >= value.GetInt32()); }
69 inline CharCounter& operator ++ ()
70 { fNumChars++;
return *
this; }
71 inline CharCounter operator ++ (
int)
72 { CharCounter temp = *
this; ++*
this;
return temp; }
73 inline CharCounter operator += (
const CharCounter &value)
74 {
return (fNumChars += value.GetInt32()); }
75 inline CharCounter operator + (
const CharCounter &value)
const 76 {
return (fNumChars + value.GetInt32()); }
77 inline CharCounter& operator -- ()
78 { fNumChars--;
return *
this; }
79 inline CharCounter operator -- (
int)
80 { CharCounter temp = *
this; --*
this;
return temp; }
81 inline CharCounter operator -= (
const CharCounter &value)
82 {
return (fNumChars -= value.GetInt32()); }
83 inline CharCounter operator - (
const CharCounter &value)
const 84 {
return (fNumChars - value.GetInt32()); }
86 inline CharCounter operator / (
const CharCounter &value)
const 87 {
return (fNumChars / value.GetInt32()); }
89 inline CharCounter operator * (
const CharCounter &value)
const 90 {
return (fNumChars * value.GetInt32()); }
97 inline int32 CharCounter_GetInt32(CharCounter i)
98 {
return i.GetInt32(); }
99 inline void CharCounter_SetInt32(CharCounter i, int32 newValue)
102 typedef int32 CharCounter;
104 inline int32 CharCounter_GetInt32(CharCounter i)
106 inline void CharCounter_SetInt32(CharCounter i, int32 newValue)
115 { fPlatformChar = 0; fScript = -1; };
118 { fPlatformChar = inChar; fScript = script; }
121 { fPlatformChar = inChar; fScript = script; }
123 PlatformChar(uchar highByte, uchar lowByte, int8 script = -1)
124 {
Set(highByte, lowByte, script); };
131 inline void Set(uchar highByte, uchar lowByte, int8 script = -1)
133 fPlatformChar = highByte<<8 | lowByte;
135 #ifdef DEBUG //following function will assert if fPlatformChar is invalid 144 inline void Set(uchar16 inChar, int8 script = -1)
146 fPlatformChar = inChar;
148 #ifdef DEBUG //following function will assert if fPlatformChar is invalid 157 inline void Set(
char inChar, int8 script = -1)
158 { fPlatformChar = inChar; fScript = script; }
164 inline void Set(uchar inChar, int8 script = -1)
165 { fPlatformChar = inChar; fScript = script; }
176 {
return (fPlatformChar & 0xFF00); }
182 {
return (fPlatformChar < 128); }
188 {
return (fPlatformChar >=
'0' && fPlatformChar <=
'9'); }
194 {
return ((fPlatformChar >=
'0' && fPlatformChar <=
'9')
195 || (fPlatformChar >=
'a' && fPlatformChar <=
'f')
196 || (fPlatformChar >=
'A' && fPlatformChar <=
'F') ); }
202 {
return ((fPlatformChar >=
'a' && fPlatformChar <=
'z') || (fPlatformChar >=
'A' && fPlatformChar <=
'Z')); }
225 inline bool16 IsSpace()
const 226 {
return (fPlatformChar ==
' '); }
227 inline bool16 IsComma()
const 228 {
return (fPlatformChar ==
','); }
229 inline bool16 IsDash()
const 230 {
return (fPlatformChar ==
'-'); }
231 inline bool16 IsPeriod()
const 232 {
return (fPlatformChar ==
'.'); }
233 inline bool16 IsColon()
const 234 {
return (fPlatformChar ==
':'); }
235 inline bool16 IsSemiColon()
const 236 {
return (fPlatformChar ==
';'); }
237 inline bool16 IsBackSlash()
const 238 {
return (fPlatformChar ==
'\\'); }
239 inline bool16 IsSlash()
const 240 {
return (fPlatformChar ==
'/'); }
241 inline bool16 IsTilde()
const 242 {
return (fPlatformChar ==
'~'); }
243 inline bool16 IsLineBreakChar()
const 244 {
return (fPlatformChar ==
'\r' || fPlatformChar ==
'\n'); }
245 inline bool16 IsChar(
char compareChar)
const 246 {
return (fPlatformChar == compareChar); }
248 inline uchar HighByte()
const 249 {
return (uchar)(fPlatformChar >> 8); }
250 inline uchar LowByte()
const 251 {
return (uchar)(fPlatformChar & 0x00FF); }
269 uchar16
GetValue()
const {
return fPlatformChar; };
271 inline int32 GetScript()
const 272 {
return (fScript); }
289 int16
GetAsNumber( ConversionError *pError = nil )
const;
290 void SetFromNumber(int16 number);
293 inline bool16 IsValid()
const 294 {
return (fPlatformChar != 0); }
312 inline bool16 operator == (
const PlatformChar &value)
const 313 {
return (value.
GetValue() == fPlatformChar);}
314 inline bool16 operator != (
const PlatformChar &value)
const 315 {
return (value.
GetValue() != fPlatformChar);}
317 inline bool16 operator < (
const PlatformChar &value)
const 318 {
return (fPlatformChar < value.
GetValue());}
319 inline bool16 operator > (
const PlatformChar &value)
const 320 {
return (fPlatformChar > value.
GetValue());}
322 inline bool16 operator <= (
const PlatformChar &value)
const 323 {
return (fPlatformChar <= value.
GetValue()); }
324 inline bool16 operator >= (
const PlatformChar &value)
const 325 {
return (fPlatformChar >= value.
GetValue()); }
328 { fPlatformChar++;
return *
this; }
336 { fPlatformChar--;
return *
this; }
345 uchar16 fPlatformChar;