04.11.2011 - adjust for Windows & QNX, multiprotocol, repeater, signals, process, codec, console input
This commit is contained in:
50
pichar.h
50
pichar.h
@@ -18,14 +18,14 @@ public:
|
||||
//inline operator const int() {return static_cast<const int>(ch);}
|
||||
//inline operator const char() {return toAscii();}
|
||||
|
||||
inline PIChar & operator =(const char v) {ch = v; return *this;}
|
||||
PIChar & operator =(const char v) {ch = v; return *this;}
|
||||
/*inline PIChar & operator =(const short v) {ch = v; return *this;}
|
||||
inline PIChar & operator =(const int v) {ch = v; return *this;}
|
||||
inline PIChar & operator =(const uchar v) {ch = v; return *this;}
|
||||
inline PIChar & operator =(const ushort v) {ch = v; return *this;}
|
||||
inline PIChar & operator =(const uint v) {ch = v; return *this;}*/
|
||||
|
||||
inline bool operator ==(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) == 0;}
|
||||
bool operator ==(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) == 0;}
|
||||
/*inline bool operator ==(const PIChar & o) const {if (o.isAscii() ^ isAscii()) return false;
|
||||
if (isAscii()) return (o.toAscii() == toAscii());
|
||||
return (o.toInt() == toInt());}
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
inline bool operator ==(const ushort o) const {return (PIChar(o) == *this);}
|
||||
inline bool operator ==(const uint o) const {return (PIChar(o) == *this);}*/
|
||||
|
||||
inline bool operator !=(const PIChar & o) const {return !(o == *this);}
|
||||
bool operator !=(const PIChar & o) const {return !(o == *this);}
|
||||
/*inline bool operator !=(const char o) const {return (PIChar(o) != *this);}
|
||||
inline bool operator !=(const short o) const {return (PIChar(o) != *this);}
|
||||
inline bool operator !=(const int o) const {return (PIChar(o) != *this);}
|
||||
@@ -44,34 +44,34 @@ public:
|
||||
inline bool operator !=(const ushort o) const {return (PIChar(o) != *this);}
|
||||
inline bool operator !=(const uint o) const {return (PIChar(o) != *this);}*/
|
||||
|
||||
inline bool operator >(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) < 0;}
|
||||
inline bool operator <(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) > 0;}
|
||||
inline bool operator >=(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) <= 0;}
|
||||
inline bool operator <=(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) >= 0;}
|
||||
bool operator >(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) < 0;}
|
||||
bool operator <(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) > 0;}
|
||||
bool operator >=(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) <= 0;}
|
||||
bool operator <=(const PIChar & o) const {return strcmp(o.toCharPtr(), toCharPtr()) >= 0;}
|
||||
|
||||
inline bool isDigit() const {return isdigit(ch);}
|
||||
inline bool isHex() const {return isxdigit(ch);}
|
||||
inline bool isGraphical() const {return isgraph(ch);}
|
||||
inline bool isControl() const {return iscntrl(ch);}
|
||||
inline bool isLower() const {return islower(ch);}
|
||||
inline bool isUpper() const {return isupper(ch);}
|
||||
inline bool isPrint() const {return isprint(ch);}
|
||||
inline bool isSpace() const {return isspace(ch);}
|
||||
inline bool isAlpha() const {return isalpha(ch);}
|
||||
inline bool isAscii() const {return isascii(ch);}
|
||||
bool isDigit() const {return isdigit(ch) != 0;}
|
||||
bool isHex() const {return isxdigit(ch) != 0;}
|
||||
bool isGraphical() const {return isgraph(ch) != 0;}
|
||||
bool isControl() const {return iscntrl(ch) != 0;}
|
||||
bool isLower() const {return islower(ch) != 0;}
|
||||
bool isUpper() const {return isupper(ch) != 0;}
|
||||
bool isPrint() const {return isprint(ch) != 0;}
|
||||
bool isSpace() const {return isspace(ch) != 0;}
|
||||
bool isAlpha() const {return isalpha(ch) != 0;}
|
||||
bool isAscii() const {return isascii(ch) != 0;}
|
||||
|
||||
inline int toInt() const {return static_cast<const int>(ch);}
|
||||
inline const wchar_t * toWCharPtr() const {return &ch;}
|
||||
inline const char * toCharPtr() const {return reinterpret_cast<const char * >(&ch);}
|
||||
inline const wchar_t toWChar() const {return ch;}
|
||||
inline char toAscii() const {return ch % 256;}
|
||||
inline int unicode16Code() const {wchar_t wc; if (mbtowc(&wc, toCharPtr(), 4) > 0) return wc; return 0;}
|
||||
int toInt() const {return static_cast<const int>(ch);}
|
||||
const wchar_t * toWCharPtr() const {return &ch;}
|
||||
const char * toCharPtr() const {return reinterpret_cast<const char * >(&ch);}
|
||||
const wchar_t toWChar() const {return ch;}
|
||||
char toAscii() const {return ch % 256;}
|
||||
int unicode16Code() const {wchar_t wc; if (mbtowc(&wc, toCharPtr(), 4) > 0) return wc; return 0;}
|
||||
//#ifdef WINDOWS
|
||||
// inline PIChar toUpper() const __attribute__ ((optimize(0))) {return PIChar(toupper(ch));}
|
||||
// inline PIChar toLower() const __attribute__ ((optimize(0))) {return PIChar(tolower(ch));}
|
||||
//#else
|
||||
inline PIChar toUpper() const {return PIChar(toupper(ch));}
|
||||
inline PIChar toLower() const {return PIChar(tolower(ch));}
|
||||
PIChar toUpper() const {return PIChar(toupper(ch));}
|
||||
PIChar toLower() const {return PIChar(tolower(ch));}
|
||||
//#endif
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user