Changeset View
Changeset View
Standalone View
Standalone View
libksieve/ksieveui/vacation/vacationscriptextractor.h
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | void doProcess( BuilderMethod method, const QString & string ) { | ||||
const StateNode & expected = mNodes[mState]; | const StateNode & expected = mNodes[mState]; | ||||
if ( expected.depth != -1 && mNestingDepth != expected.depth ) | if ( expected.depth != -1 && mNestingDepth != expected.depth ) | ||||
found = false; | found = false; | ||||
if ( expected.method != Any && method != expected.method ) | if ( expected.method != Any && method != expected.method ) | ||||
found = false; | found = false; | ||||
if ( const char * str = expected.string ) | if ( const char * str = expected.string ) | ||||
if ( string.toLower() != QString::fromUtf8( str ).toLower() ) | if ( string.toLower() != QString::fromUtf8( str ).toLower() ) | ||||
found = false; | found = false; | ||||
kDebug() << ( found ?"found:" :"not found:" ) | /*kDebug() << ( found ?"found:" :"not found:" ) | ||||
<< mState << "->" | << mState << "->" | ||||
<< ( found ? expected.if_found : expected.if_not_found ); | << ( found ? expected.if_found : expected.if_not_found );*/ | ||||
mState = found ? expected.if_found : expected.if_not_found ; | mState = found ? expected.if_found : expected.if_not_found ; | ||||
assert( mState < mNodes.size() ); | assert( mState < mNodes.size() ); | ||||
if ( found ) | if ( found ) | ||||
if ( const char * save_tag = expected.save_tag ) { | if ( const char * save_tag = expected.save_tag ) { | ||||
kDebug() << "stored tag" << save_tag << ":" << string; | |||||
mResults[QString::fromLatin1(save_tag)] = string; | mResults[QString::fromLatin1(save_tag)] = string; | ||||
} | } | ||||
if ( !found && !mRecursionGuard.count( mState ) ) { | if ( !found && !mRecursionGuard.count( mState ) ) { | ||||
doProcess( method, string ); | doProcess( method, string ); | ||||
} | } | ||||
} | } | ||||
void commandStart( const QString & identifier, int lineNumber ) { kDebug() << identifier ; process( CommandStart, identifier ); } | void commandStart( const QString & identifier, int lineNumber ) { process( CommandStart, identifier ); } | ||||
void commandEnd(int lineNumber) { kDebug() ; process( CommandEnd ); } | void commandEnd(int lineNumber) { process( CommandEnd ); } | ||||
void testStart( const QString & identifier ) { kDebug() << identifier ; process( TestStart, identifier ); } | void testStart( const QString & identifier ) { process( TestStart, identifier ); } | ||||
void testEnd() { kDebug() ; process( TestEnd ); } | void testEnd() { process( TestEnd ); } | ||||
void testListStart() { kDebug() ; process( TestListStart ); } | void testListStart() { process( TestListStart ); } | ||||
void testListEnd() { kDebug() ; process( TestListEnd ); } | void testListEnd() { process( TestListEnd ); } | ||||
void blockStart(int lineNumber) { kDebug() ; process( BlockStart ); ++mNestingDepth; } | void blockStart(int lineNumber) { process( BlockStart ); ++mNestingDepth; } | ||||
void blockEnd(int lineNumber) { kDebug() ; --mNestingDepth; process( BlockEnd ); } | void blockEnd(int lineNumber) { --mNestingDepth; process( BlockEnd ); } | ||||
void hashComment( const QString & ) { kDebug() ; } | void hashComment( const QString & ) { } | ||||
void bracketComment( const QString & ) { kDebug() ; } | void bracketComment( const QString & ) { } | ||||
void lineFeed() { kDebug() << ++mLineNumber; } | void lineFeed() { ++mLineNumber; } | ||||
void error( const KSieve::Error & ) { | void error( const KSieve::Error & ) { | ||||
kDebug() ; | kDebug() ; | ||||
mState = 0; | mState = 0; | ||||
} | } | ||||
void finished() { kDebug() ; } | void finished() { } | ||||
void taggedArgument( const QString & tag ) { kDebug() ; process( TaggedArgument, tag ); } | void taggedArgument( const QString & tag ) { process( TaggedArgument, tag ); } | ||||
void stringArgument( const QString & string, bool, const QString & ) { kDebug() ; process( StringArgument, string ); } | void stringArgument( const QString & string, bool, const QString & ) { process( StringArgument, string ); } | ||||
void numberArgument( unsigned long number, char ) { kDebug(); process( NumberArgument, QString::number( number ) ); } | void numberArgument( unsigned long number, char ) { process( NumberArgument, QString::number( number ) ); } | ||||
void stringListArgumentStart() { kDebug() ; process( StringListArgumentStart ); } | void stringListArgumentStart() { process( StringListArgumentStart ); } | ||||
void stringListEntry( const QString & string, bool, const QString & ) { kDebug() ; process( StringListEntry, string ); } | void stringListEntry( const QString & string, bool, const QString & ) { process( StringListEntry, string ); } | ||||
void stringListArgumentEnd() { kDebug() ; process( StringListArgumentEnd ); } | void stringListArgumentEnd() { process( StringListArgumentEnd ); } | ||||
}; | }; | ||||
typedef GenericInformationExtractor GIE; | typedef GenericInformationExtractor GIE; | ||||
static const GenericInformationExtractor::StateNode spamNodes[] = { | static const GenericInformationExtractor::StateNode spamNodes[] = { | ||||
{ 0, GIE::CommandStart, "if", 1, 0, 0 }, // 0 | { 0, GIE::CommandStart, "if", 1, 0, 0 }, // 0 | ||||
{ 0, GIE::TestStart, "allof", 2, 3, 0 }, // 1 | { 0, GIE::TestStart, "allof", 2, 3, 0 }, // 1 | ||||
{ 0, GIE::TestListStart, 0, 3, 0, 0 }, // 2 | { 0, GIE::TestListStart, 0, 3, 0, 0 }, // 2 | ||||
{ 0, GIE::TestStart, "not", 4, 3, 0 }, // 3 | { 0, GIE::TestStart, "not", 4, 3, 0 }, // 3 | ||||
▲ Show 20 Lines • Show All 337 Lines • Show Last 20 Lines |