diff options
Diffstat (limited to 'libksieve')
-rw-r--r-- | libksieve/impl/lexer.h | 24 | ||||
-rw-r--r-- | libksieve/impl/parser.h | 6 | ||||
-rw-r--r-- | libksieve/ksieve/error.h | 12 | ||||
-rw-r--r-- | libksieve/ksieve/lexer.h | 2 | ||||
-rw-r--r-- | libksieve/ksieve/scriptbuilder.h | 14 | ||||
-rw-r--r-- | libksieve/parser/lexer.cpp | 52 | ||||
-rw-r--r-- | libksieve/parser/parser.cpp | 8 | ||||
-rw-r--r-- | libksieve/parser/utf8validator.cpp | 4 | ||||
-rw-r--r-- | libksieve/shared/error.cpp | 6 | ||||
-rw-r--r-- | libksieve/tests/lexertest.cpp | 10 | ||||
-rw-r--r-- | libksieve/tests/parsertest.cpp | 46 |
11 files changed, 92 insertions, 92 deletions
diff --git a/libksieve/impl/lexer.h b/libksieve/impl/lexer.h index 0eba0e585..5dbb34076 100644 --- a/libksieve/impl/lexer.h +++ b/libksieve/impl/lexer.h @@ -38,8 +38,8 @@ #include <ksieve/lexer.h> #include <ksieve/error.h> -#include <qvaluestack.h> -#include <qcstring.h> +#include <tqvaluestack.h> +#include <tqcstring.h> namespace KSieve { @@ -79,7 +79,7 @@ namespace KSieve { mState = mStateStack.pop(); } - Lexer::Token nextToken( QString & tokenValue ); + Lexer::Token nextToken( TQString & tokenValue ); private: /** Cursor must be positioned on the \r or the \n. */ @@ -88,13 +88,13 @@ namespace KSieve { /** Cursor must be positioned after the opening hash (#). If parsing is successful, cursor is positioned behind the CRLF that ended the comment's line (or past the end). */ - bool parseHashComment( QString & result, bool reallySave=false ); + bool parseHashComment( TQString & result, bool reallySave=false ); /** Cursor must be positioned after the opening slash-asterisk */ - bool parseBracketComment( QString & result, bool reallySave=false ); + bool parseBracketComment( TQString & result, bool reallySave=false ); /** Cursor must be positioned on the opening '/'or '#' */ - bool parseComment( QString & result, bool reallySave=false ); + bool parseComment( TQString & result, bool reallySave=false ); /** Eats whitespace, but not comments */ bool eatWS(); @@ -103,19 +103,19 @@ namespace KSieve { bool eatCWS(); /** Cursor must be positioned on the first character */ - bool parseIdentifier( QString & result ); + bool parseIdentifier( TQString & result ); /** Cursor must be positioned after the initial ':' */ - bool parseTag( QString & result ); + bool parseTag( TQString & result ); /** Cursor must be positioned on the first digit */ - bool parseNumber( QString & result ); + bool parseNumber( TQString & result ); /** Cursor must be positioned after the "text:" token. */ - bool parseMultiLine( QString & result ); + bool parseMultiLine( TQString & result ); /** Cursor must be positioned after the initial " */ - bool parseQuotedString( QString & result ); + bool parseQuotedString( TQString & result ); struct State { State( const char * s=0 ) @@ -129,7 +129,7 @@ namespace KSieve { const char * const mEnd; const bool mIgnoreComments : 1; const bool mIgnoreLF : 1; - QValueStack<State> mStateStack; + TQValueStack<State> mStateStack; const char * beginOfLine() const { return mState.beginOfLine; } diff --git a/libksieve/impl/parser.h b/libksieve/impl/parser.h index 736678b43..d337f0f9d 100644 --- a/libksieve/impl/parser.h +++ b/libksieve/impl/parser.h @@ -82,7 +82,7 @@ namespace KSieve { Lexer::Token token() const { return mToken; } - QString tokenValue() const { return mTokenValue; } + TQString tokenValue() const { return mTokenValue; } bool atEnd() const { return !mToken && lexer.atEnd() ; @@ -90,7 +90,7 @@ namespace KSieve { bool obtainToken(); void consumeToken() { mToken = Lexer::None; - mTokenValue = QString::null; + mTokenValue = TQString::null; } void makeError( Error::Type e, int line, int col ) { mError = Error( e, line, col ); @@ -108,7 +108,7 @@ namespace KSieve { Error mError; Lexer::Token mToken; - QString mTokenValue; + TQString mTokenValue; Lexer::Impl lexer; ScriptBuilder * mBuilder; }; diff --git a/libksieve/ksieve/error.h b/libksieve/ksieve/error.h index 2dbed32c8..de84b2041 100644 --- a/libksieve/ksieve/error.h +++ b/libksieve/ksieve/error.h @@ -33,7 +33,7 @@ #ifndef __KSIEVE_ERROR_H__ #define __KSIEVE_ERROR_H__ -#include <qstring.h> +#include <tqstring.h> #include <kdepimmacros.h> @@ -107,14 +107,14 @@ namespace KSieve { static const char * typeToString( Type type ); Error( Type type=None, - const QString & s1=QString::null, const QString & s2=QString::null, + const TQString & s1=TQString::null, const TQString & s2=TQString::null, int line=-1, int col=-1 ) : mType( type ), mLine( line ), mCol( col ), mStringOne( s1 ), mStringTwo( s2 ) {} Error( Type type, int line, int col ) : mType( type ), mLine( line ), mCol( col ) {} - QString asString() const; + TQString asString() const; /** So you can write <pre>if( error() )</pre> with e.g. @ref Lexer */ operator bool() const { @@ -124,14 +124,14 @@ namespace KSieve { Type type() const { return mType; } int line() const { return mLine; } int column() const { return mCol; } - QString firstString() const { return mStringOne; } - QString secondString() const { return mStringTwo; } + TQString firstString() const { return mStringOne; } + TQString secondString() const { return mStringTwo; } protected: Type mType; int mLine; int mCol; - QString mStringOne, mStringTwo; + TQString mStringOne, mStringTwo; }; } // namespace KSieve diff --git a/libksieve/ksieve/lexer.h b/libksieve/ksieve/lexer.h index d5bb1fc3b..befcb0242 100644 --- a/libksieve/ksieve/lexer.h +++ b/libksieve/ksieve/lexer.h @@ -89,7 +89,7 @@ namespace KSieve { /** Parse the next token and return it's type. @p result will contain the value of the token. */ - Token nextToken( QString & result ); + Token nextToken( TQString & result ); void save(); void restore(); diff --git a/libksieve/ksieve/scriptbuilder.h b/libksieve/ksieve/scriptbuilder.h index 5e0a955bb..28fd60879 100644 --- a/libksieve/ksieve/scriptbuilder.h +++ b/libksieve/ksieve/scriptbuilder.h @@ -43,18 +43,18 @@ namespace KSieve { public: virtual ~ScriptBuilder() {} - virtual void taggedArgument( const QString & tag ) = 0; - virtual void stringArgument( const QString & string, bool multiLine, const QString & embeddedHashComment ) = 0; + virtual void taggedArgument( const TQString & tag ) = 0; + virtual void stringArgument( const TQString & string, bool multiLine, const TQString & embeddedHashComment ) = 0; virtual void numberArgument( unsigned long number, char quantifier ) = 0; virtual void stringListArgumentStart() = 0; - virtual void stringListEntry( const QString & string, bool multiLine, const QString & embeddedHashComment ) = 0; + virtual void stringListEntry( const TQString & string, bool multiLine, const TQString & embeddedHashComment ) = 0; virtual void stringListArgumentEnd() = 0; - virtual void commandStart( const QString & identifier ) = 0; + virtual void commandStart( const TQString & identifier ) = 0; virtual void commandEnd() = 0; - virtual void testStart( const QString & identifier ) = 0; + virtual void testStart( const TQString & identifier ) = 0; virtual void testEnd() = 0; virtual void testListStart() = 0; @@ -64,9 +64,9 @@ namespace KSieve { virtual void blockEnd() = 0; /** A hash comment always includes an implicit lineFeed() at it's end. */ - virtual void hashComment( const QString & comment ) = 0; + virtual void hashComment( const TQString & comment ) = 0; /** Bracket comments inclde explicit lineFeed()s in their content */ - virtual void bracketComment( const QString & comment ) = 0; + virtual void bracketComment( const TQString & comment ) = 0; virtual void lineFeed() = 0; diff --git a/libksieve/parser/lexer.cpp b/libksieve/parser/lexer.cpp index d8b76da71..c0b7cb8b3 100644 --- a/libksieve/parser/lexer.cpp +++ b/libksieve/parser/lexer.cpp @@ -38,9 +38,9 @@ #include <impl/utf8validator.h> #include <ksieve/error.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qtextcodec.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqtextcodec.h> #include <memory> // std::auto_ptr @@ -105,7 +105,7 @@ namespace KSieve { i->restore(); } - Lexer::Token Lexer::nextToken( QString & result ) { + Lexer::Token Lexer::nextToken( TQString & result ) { assert( i ); return i->nextToken( result ); } @@ -159,7 +159,7 @@ static inline bool is8Bit( signed char ch ) { return ch < 0; } -static QString removeCRLF( const QString & s ) { +static TQString removeCRLF( const TQString & s ) { const bool CRLF = s.endsWith( "\r\n" ); const bool LF = !CRLF && s.endsWith( "\n" ); @@ -168,7 +168,7 @@ static QString removeCRLF( const QString & s ) { return s.left( s.length() - e ); } -static QString removeDotStuff( const QString & s ) { +static TQString removeDotStuff( const TQString & s ) { return s.startsWith( ".." ) ? s.mid( 1 ) : s ; } @@ -190,9 +190,9 @@ namespace KSieve { assert( atEnd() ); } - Lexer::Token Lexer::Impl::nextToken( QString & result ) { + Lexer::Token Lexer::Impl::nextToken( TQString & result ) { assert( !atEnd() ); - result = QString::null; + result = TQString::null; //clearErrors(); const int oldLine = line(); @@ -332,7 +332,7 @@ namespace KSieve { } - bool Lexer::Impl::parseHashComment( QString & result, bool reallySave ) { + bool Lexer::Impl::parseHashComment( TQString & result, bool reallySave ) { // hash-comment := "#" *CHAR-NOT-CRLF CRLF // check that the caller plays by the rules: @@ -358,7 +358,7 @@ namespace KSieve { return false; } if ( reallySave ) - result += QString::fromUtf8( commentStart, commentLength ); + result += TQString::fromUtf8( commentStart, commentLength ); } return true; } @@ -366,7 +366,7 @@ namespace KSieve { return false; } - bool Lexer::Impl::parseBracketComment( QString & result, bool reallySave ) { + bool Lexer::Impl::parseBracketComment( TQString & result, bool reallySave ) { // bracket-comment := "/*" *(CHAR-NOT-STAR / ("*" CHAR-NOT-SLASH )) "*/" // check that caller plays by the rules: @@ -400,7 +400,7 @@ namespace KSieve { return false; } if ( reallySave ) { - QString tmp = QString::fromUtf8( commentStart, commentLength ); + TQString tmp = TQString::fromUtf8( commentStart, commentLength ); result += tmp.remove( '\r' ); // get rid of CR in CRLF pairs } } @@ -409,7 +409,7 @@ namespace KSieve { return true; } - bool Lexer::Impl::parseComment( QString & result, bool reallySave ) { + bool Lexer::Impl::parseComment( TQString & result, bool reallySave ) { // comment := hash-comment / bracket-comment switch( *mState.cursor ) { @@ -446,7 +446,7 @@ namespace KSieve { case '#': case '/': // comments { - QString dummy; + TQString dummy; if ( !parseComment( dummy ) ) return false; } @@ -458,7 +458,7 @@ namespace KSieve { return true; } - bool Lexer::Impl::parseIdentifier( QString & result ) { + bool Lexer::Impl::parseIdentifier( TQString & result ) { // identifier := (ALPHA / "_") *(ALPHA DIGIT "_") assert( isIText( *mState.cursor ) ); @@ -478,7 +478,7 @@ namespace KSieve { // Can use the fast fromLatin1 here, since identifiers are always // in the us-ascii subset: - result += QString::fromLatin1( identifierStart, identifierLength ); + result += TQString::fromLatin1( identifierStart, identifierLength ); if ( atEnd() || isDelim( *mState.cursor ) ) return true; @@ -487,7 +487,7 @@ namespace KSieve { return false; } - bool Lexer::Impl::parseTag( QString & result ) { + bool Lexer::Impl::parseTag( TQString & result ) { // tag := ":" identifier // check that the caller plays by the rules: @@ -498,7 +498,7 @@ namespace KSieve { return parseIdentifier( result ); } - bool Lexer::Impl::parseNumber( QString & result ) { + bool Lexer::Impl::parseNumber( TQString & result ) { // number := 1*DIGIT [QUANTIFIER] // QUANTIFIER := "K" / "M" / "G" @@ -531,7 +531,7 @@ namespace KSieve { return false; } - bool Lexer::Impl::parseMultiLine( QString & result ) { + bool Lexer::Impl::parseMultiLine( TQString & result ) { // multi-line := "text:" *(SP / HTAB) (hash-comment / CRLF) // *(multi-line-literal / multi-line-dotstuff) // "." CRLF @@ -554,7 +554,7 @@ namespace KSieve { case '#': { ++mState.cursor; - QString dummy; + TQString dummy; if ( !parseHashComment( dummy ) ) return false; goto MultiLineStart; // break from switch _and_ while @@ -576,7 +576,7 @@ namespace KSieve { } // Now, collect the single lines until one with only a single dot is found: - QStringList lines; + TQStringList lines; while ( !atEnd() ) { const char * const oldBeginOfLine = beginOfLine(); if ( !skipToCRLF() ) @@ -587,12 +587,12 @@ namespace KSieve { makeError( Error::InvalidUTF8 ); return false; } - const QString line = removeCRLF( QString::fromUtf8( oldBeginOfLine, lineLength ) ); + const TQString line = removeCRLF( TQString::fromUtf8( oldBeginOfLine, lineLength ) ); lines.push_back( removeDotStuff( line ) ); if ( line == "." ) break; } else { - lines.push_back( QString::null ); + lines.push_back( TQString::null ); } } @@ -607,7 +607,7 @@ namespace KSieve { return true; } - bool Lexer::Impl::parseQuotedString( QString & result ) { + bool Lexer::Impl::parseQuotedString( TQString & result ) { // quoted-string := DQUOTE *CHAR DQUOTE // check that caller plays by the rules: @@ -616,9 +616,9 @@ namespace KSieve { const int qsBeginCol = column() - 1; const int qsBeginLine = line(); - const QTextCodec * const codec = QTextCodec::codecForMib( 106 ); // UTF-8 + const TQTextCodec * const codec = TQTextCodec::codecForMib( 106 ); // UTF-8 assert( codec ); - const std::auto_ptr<QTextDecoder> dec( codec->makeDecoder() ); + const std::auto_ptr<TQTextDecoder> dec( codec->makeDecoder() ); assert( dec.get() ); while ( !atEnd() ) diff --git a/libksieve/parser/parser.cpp b/libksieve/parser/parser.cpp index 8c2db050e..0a136e71c 100644 --- a/libksieve/parser/parser.cpp +++ b/libksieve/parser/parser.cpp @@ -37,7 +37,7 @@ #include <ksieve/error.h> -#include <qstring.h> +#include <tqstring.h> #include <assert.h> #include <limits.h> // ULONG_MAX @@ -332,7 +332,7 @@ namespace KSieve { return true; } else if ( isStringToken() ) { if ( scriptBuilder() ) - scriptBuilder()->stringArgument( tokenValue(), token() == Lexer::MultiLineString, QString::null ); + scriptBuilder()->stringArgument( tokenValue(), token() == Lexer::MultiLineString, TQString::null ); consumeToken(); return true; } else if ( token() == Lexer::Special && tokenValue() == "[" ) { @@ -590,7 +590,7 @@ namespace KSieve { } lastWasComma = false; if ( scriptBuilder() ) - scriptBuilder()->stringListEntry( tokenValue(), token() == Lexer::MultiLineString, QString::null ); + scriptBuilder()->stringListEntry( tokenValue(), token() == Lexer::MultiLineString, TQString::null ); consumeToken(); break; @@ -618,7 +618,7 @@ namespace KSieve { // number: unsigned long result = 0; unsigned int i = 0; - const QCString s = tokenValue().latin1(); + const TQCString s = tokenValue().latin1(); for ( const unsigned int len = s.length() ; i < len && isdigit( s[i] ) ; ++i ) { const unsigned long digitValue = s[i] - '0' ; if ( willOverflowULong( result, digitValue ) ) { diff --git a/libksieve/parser/utf8validator.cpp b/libksieve/parser/utf8validator.cpp index 248a1f5e9..ac94281e6 100644 --- a/libksieve/parser/utf8validator.cpp +++ b/libksieve/parser/utf8validator.cpp @@ -32,8 +32,8 @@ #include <impl/utf8validator.h> -#include <qglobal.h> -#include <qcstring.h> +#include <tqglobal.h> +#include <tqcstring.h> static inline bool is8Bit( signed char ch ) { return ch < 0; diff --git a/libksieve/shared/error.cpp b/libksieve/shared/error.cpp index e53b0c252..527370b8b 100644 --- a/libksieve/shared/error.cpp +++ b/libksieve/shared/error.cpp @@ -98,12 +98,12 @@ namespace KSieve { } } - QString Error::asString() const { + TQString Error::asString() const { - QString err; + TQString err; switch( type() ) { case None: - return QString::null; + return TQString::null; case Custom: return mStringOne; diff --git a/libksieve/tests/lexertest.cpp b/libksieve/tests/lexertest.cpp index 461499501..23e0f886d 100644 --- a/libksieve/tests/lexertest.cpp +++ b/libksieve/tests/lexertest.cpp @@ -36,8 +36,8 @@ using KSieve::Lexer; #include <ksieve/error.h> using KSieve::Error; -#include <qcstring.h> // qstrlen -#include <qstring.h> +#include <tqcstring.h> // qstrlen +#include <tqstring.h> #include <iostream> using std::cout; @@ -403,7 +403,7 @@ int main( int argc, char * argv[] ) { cout << "Begin" << endl; while ( !lexer.atEnd() ) { - QString result; + TQString result; Lexer::Token token = lexer.nextToken( result ); if ( lexer.error() ) { cout << "Error " << token2string( token ) << ": \"" @@ -427,7 +427,7 @@ int main( int argc, char * argv[] ) { Lexer lexer( t.string, send, Lexer::IncludeComments ); cerr << t.name << ":"; for ( int j = 0 ; !lexer.atEnd() ; ++j ) { - QString result; + TQString result; Lexer::Token token = lexer.nextToken( result ); Error error = lexer.error(); if ( t.expected[j].token != token ) { @@ -435,7 +435,7 @@ int main( int argc, char * argv[] ) { cerr << " expected token " << token2string( t.expected[j].token ) << ", got " << token2string( token ); } - if ( QString::fromUtf8( t.expected[j].result ) != result ) { + if ( TQString::fromUtf8( t.expected[j].result ) != result ) { ok = false; if ( t.expected[j].result ) cerr << " expected string \"" << t.expected[j].result << "\""; diff --git a/libksieve/tests/parsertest.cpp b/libksieve/tests/parsertest.cpp index e2ea0fd39..87381a326 100644 --- a/libksieve/tests/parsertest.cpp +++ b/libksieve/tests/parsertest.cpp @@ -36,8 +36,8 @@ using KSieve::Parser; #include <ksieve/error.h> #include <ksieve/scriptbuilder.h> -#include <qcstring.h> // qstrlen -#include <qstring.h> +#include <tqcstring.h> // qstrlen +#include <tqstring.h> #include <iostream> using std::cout; @@ -389,17 +389,17 @@ public: } virtual ~PrintingScriptBuilder() {} - void taggedArgument( const QString & tag ) { + void taggedArgument( const TQString & tag ) { write( "tag", tag ); } - void stringArgument( const QString & string, bool multiLine, const QString & /*fixme*/ ) { + void stringArgument( const TQString & string, bool multiLine, const TQString & /*fixme*/ ) { write( multiLine ? "string type=\"multiline\"" : "string type=\"quoted\"", string ); } void numberArgument( unsigned long number, char quantifier ) { - const QString txt = "number" + ( quantifier ? QString(" quantifier=\"%1\"").arg( quantifier ) : QString::null ) ; - write( txt.latin1(), QString::number( number ) ); + const TQString txt = "number" + ( quantifier ? TQString(" quantifier=\"%1\"").arg( quantifier ) : TQString::null ) ; + write( txt.latin1(), TQString::number( number ) ); } - void commandStart( const QString & identifier ) { + void commandStart( const TQString & identifier ) { write( "<command>" ); ++indent; write( "identifier", identifier ); @@ -408,7 +408,7 @@ public: --indent; write( "</command>" ); } - void testStart( const QString & identifier ) { + void testStart( const TQString & identifier ) { write( "<test>" ); ++indent; write( "identifier", identifier ); @@ -441,13 +441,13 @@ public: --indent; write( "</stringlist>" ); } - void stringListEntry( const QString & string, bool multiline, const QString & hashComment ) { + void stringListEntry( const TQString & string, bool multiline, const TQString & hashComment ) { stringArgument( string, multiline, hashComment ); } - void hashComment( const QString & comment ) { + void hashComment( const TQString & comment ) { write( "comment type=\"hash\"", comment ); } - void bracketComment( const QString & comment ) { + void bracketComment( const TQString & comment ) { write( "comment type=\"bracket\"", comment ); } @@ -470,7 +470,7 @@ private: cout << " "; cout << msg << endl; } - void write( const QCString & key, const QString & value ) { + void write( const TQCString & key, const TQString & value ) { if ( value.isEmpty() ) { write( "<" + key + "/>" ); return; @@ -498,12 +498,12 @@ public: bool ok() const { return mOk; } - void taggedArgument( const QString & tag ) { + void taggedArgument( const TQString & tag ) { checkIs( TaggedArgument ); checkEquals( tag ); ++mNextResponse; } - void stringArgument( const QString & string, bool multiline, const QString & /*fixme*/ ) { + void stringArgument( const TQString & string, bool multiline, const TQString & /*fixme*/ ) { checkIs( StringArgument ); checkEquals( string ); checkEquals( multiline ); @@ -511,10 +511,10 @@ public: } void numberArgument( unsigned long number, char quantifier ) { checkIs( NumberArgument ); - checkEquals( QString::number( number ) + ( quantifier ? quantifier : ' ' ) ); + checkEquals( TQString::number( number ) + ( quantifier ? quantifier : ' ' ) ); ++mNextResponse; } - void commandStart( const QString & identifier ) { + void commandStart( const TQString & identifier ) { checkIs( CommandStart ); checkEquals( identifier ); ++mNextResponse; @@ -523,7 +523,7 @@ public: checkIs( CommandEnd ); ++mNextResponse; } - void testStart( const QString & identifier ) { + void testStart( const TQString & identifier ) { checkIs( TestStart ); checkEquals( identifier ); ++mNextResponse; @@ -552,7 +552,7 @@ public: checkIs( StringListArgumentStart ); ++mNextResponse; } - void stringListEntry( const QString & string, bool multiLine, const QString & /*fixme*/ ) { + void stringListEntry( const TQString & string, bool multiLine, const TQString & /*fixme*/ ) { checkIs( StringListEntry ); checkEquals( string ); checkEquals( multiLine ); @@ -562,12 +562,12 @@ public: checkIs( StringListArgumentEnd ); ++mNextResponse; } - void hashComment( const QString & comment ) { + void hashComment( const TQString & comment ) { checkIs( HashComment ); checkEquals( comment ); ++mNextResponse; } - void bracketComment( const QString & comment ) { + void bracketComment( const TQString & comment ) { checkIs( BracketComment ); checkEquals( comment ); ++mNextResponse; @@ -577,7 +577,7 @@ public: } void error( const KSieve::Error & error ) { checkIs( Error ); - checkEquals( QString( KSieve::Error::typeToString( error.type() ) ) ); + checkEquals( TQString( KSieve::Error::typeToString( error.type() ) ) ); ++mNextResponse; } void finished() { @@ -599,8 +599,8 @@ private: } } - void checkEquals( const QString & s ) { - if ( s != QString::fromUtf8( currentResponse().string ) ) { + void checkEquals( const TQString & s ) { + if ( s != TQString::fromUtf8( currentResponse().string ) ) { cerr << " expected string arg \"" << ( currentResponse().string ? currentResponse().string : "<null>" ) << "\", got \"" << ( s.isNull() ? "<null>" : s.utf8().data() ) << "\""; |