- typedef bool Boolean, * PBoolean;
- typedef char Char, * PChar;
- typedef wchar_t WChar, * PWChar;
- typedef unsigned char UChar, * PUChar, Byte, * PByte;
- typedef short Short, * PShort;
- typedef unsigned short UShort, * PUShort;
- typedef int Int, * PInt;
- typedef unsigned int UInt, * PUInt;
- typedef long Long, * PLong;
- typedef unsigned long ULong, * PULong;
- typedef __int64 Int64, * PInt64;
- typedef unsigned __int64 UInt64, * PUInt64;
- typedef long long LongLong, * PLongLong;
- typedef unsigned long long ULongLong, * PULongLong;
- typedef double Double, * PDouble;
- typedef float Float, * PFloat;
- typedef Char const * PCSTR;
- typedef WChar const * PCWSTR;
- typedef Char * PSTR;
- typedef WChar * PWSTR;
- // 返回一个字符串里有多少个字符
- Int ansiCharsCount( PCSTR ansiStr)
- {
- Int count = 0;
- Char ch;
- while ( ch = *ansiStr )
- {
- if ( ch & (Byte)0x80 )
- {
- ansiStr++;
- }
- count++;
- ansiStr++;
- }
- return count;
- }
- // 返回一个unicode字符串最少长度
- Int unicodeMinLength( PCWSTR unicodeStr )
- {
- Int size = 0;
- WChar ch;
- while ( ch = *unicodeStr )
- {
- if ( (UShort)ch > 0xFF )
- {
- size++;
- }
- size++;
- unicodeStr++;
- }
- return size;
- }
- //该片段来自于http://www.codesnippet.cn/detail/260320132568.html
来源: http://www.codesnippet.cn/detail/260320132568.html