diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /libkdepim/qutf7codec.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/qutf7codec.cpp')
-rw-r--r-- | libkdepim/qutf7codec.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libkdepim/qutf7codec.cpp b/libkdepim/qutf7codec.cpp index 8cc3d4564..11c0db929 100644 --- a/libkdepim/qutf7codec.cpp +++ b/libkdepim/qutf7codec.cpp @@ -1,7 +1,7 @@ /* qutf7codec.cpp - A QTextCodec for UTF-7 (rfc2152). + A TQTextCodec for UTF-7 (rfc2152). Copyright (c) 2001 Marc Mutz <mutz@kde.org> See file COPYING for details @@ -47,11 +47,11 @@ const char* QUtf7Codec::mimeName() const { return "UTF-7"; } -bool QUtf7Codec::canEncode( QChar ) const { +bool QUtf7Codec::canEncode( TQChar ) const { return TRUE; } -bool QUtf7Codec::canEncode( const QString & ) const { +bool QUtf7Codec::canEncode( const TQString & ) const { return TRUE; } @@ -136,7 +136,7 @@ int QUtf7Codec::heuristicContentMatch(const char* chars, int len) const return i; } -class QUtf7Decoder : public QTextDecoder { +class QUtf7Decoder : public TQTextDecoder { // the storage for our unicode char until it's finished ushort uc; // the state of the base64 decoding @@ -170,9 +170,9 @@ private: } public: - QString toUnicode(const char* chars, int len) + TQString toUnicode(const char* chars, int len) { - QString result = ""; + TQString result = ""; for (int i=0; i<len; i++) { uchar ch = chars[i]; @@ -183,7 +183,7 @@ public: qWarning("QUtf7Decoder: 8bit char found in input. " "Parser has been re-initialized!"); resetParser(); - result += QChar::replacement; + result += TQChar::replacement; continue; } @@ -197,7 +197,7 @@ public: // a "+-" sequence is a short-circuit encoding // for just '+': resetParser(); - result += QChar('+'); + result += TQChar('+'); // we're already done for this "ch", so continue; } @@ -249,7 +249,7 @@ public: // // now we're going to stuff the "bits" bit bucket into // the right position inside "uc", emitting a resulting - // QChar if possible. + // TQChar if possible. // switch (stepNo) { // "bits" are the 6 msb's of uc @@ -258,21 +258,21 @@ public: case 1: uc |= bits << 4; break; // 4 bits of "bits" complete the first ushort - case 2: uc |= bits >> 2; result += QChar(uc); + case 2: uc |= bits >> 2; result += TQChar(uc); // 2 bits of "bits" make the msb's of the next ushort uc = bits << 14; break; case 3: uc |= bits << 8; break; case 4: uc |= bits << 2; break; // 2 bits of "bits" complete the second ushort - case 5: uc |= bits >> 4; result += QChar(uc); + case 5: uc |= bits >> 4; result += TQChar(uc); // 4 bits of "bits" make the msb's of the next ushort uc = bits << 12; break; case 6: uc |= bits << 6; break; // these 6 bits complete the third ushort // and also one round of 8 chars -> 3 ushort decoding - case 7: uc |= bits; result += QChar(uc); + case 7: uc |= bits; result += TQChar(uc); uc = 0; break; default: ; } // switch (stepNo) @@ -302,7 +302,7 @@ public: rightAfterEscape = TRUE; } else { // US-ASCII values are directly used - result += QChar(ch); + result += TQChar(ch); } } @@ -312,13 +312,13 @@ public: }; // class QUtf7Decoder -QTextDecoder* QUtf7Codec::makeDecoder() const +TQTextDecoder* QUtf7Codec::makeDecoder() const { return new QUtf7Decoder; } -class QUtf7Encoder : public QTextEncoder { +class QUtf7Encoder : public TQTextEncoder { uchar dontNeedEncodingSet[16]; ushort outbits; uint stepNo : 2; @@ -357,7 +357,7 @@ private: return '/'; } - void addToShiftedSequence(QCString::Iterator & t, ushort u) { + void addToShiftedSequence(TQCString::Iterator & t, ushort u) { switch (stepNo) { // no outbits; use uppermost 6 bits of u case 0: @@ -396,7 +396,7 @@ private: stepNo = (stepNo + 1) % 3; } - void endShiftedSequence(QCString::Iterator & t) { + void endShiftedSequence(TQCString::Iterator & t) { switch (stepNo) { case 1: // four outbits still to be written case 2: // two outbits still to be written @@ -418,7 +418,7 @@ private: ( stepNo == 2 && (u & 0xC000) == 0 ); } - void processDoesntNeedEncoding(QCString::Iterator & t, ushort ch) { + void processDoesntNeedEncoding(TQCString::Iterator & t, ushort ch) { // doesn't need encoding if (shifted) { endShiftedSequence(t); @@ -440,7 +440,7 @@ private: } public: - QCString fromUnicode(const QString & uc, int & len_in_out) + TQCString fromUnicode(const TQString & uc, int & len_in_out) { // allocate place for worst case: // len/2 * (5+1) for an alternating sequence of e.g. "A\", @@ -448,7 +448,7 @@ public: // + 1 for the trailing \0 // int maxreslen = 3 * len_in_out + 5; - QCString result( maxreslen ); + TQCString result( maxreslen ); #if 0 // if (len_in_out == 1) { @@ -462,8 +462,8 @@ public: #endif // source and destination cursor - const QChar * s = uc.unicode(); - QCString::Iterator t = result.data(); + const TQChar * s = uc.unicode(); + TQCString::Iterator t = result.data(); if ( uc.isNull() ) { // return to ascii requested: @@ -539,11 +539,11 @@ public: }; // class QUtf7Encoder -QTextEncoder* QUtf7Codec::makeEncoder() const { +TQTextEncoder* QUtf7Codec::makeEncoder() const { return new QUtf7Encoder( false, false ); } -QTextEncoder* QStrictUtf7Codec::makeEncoder() const { +TQTextEncoder* QStrictUtf7Codec::makeEncoder() const { return new QUtf7Encoder( true, false ); } |