void KRegExpEditorPrivate::slotUpdateEditor( const TQString & txt) { _updating = true; bool ok; if ( !RegExpConverter::current()->canParse() ) { // This can happend if the application set a text through the API. } else { RegExp* result = RegExpConverter::current()->parse( txt, &ok ); if ( ok ) { TQPtrList<CompoundRegExp> list = _userRegExps->regExps(); for ( TQPtrListIterator<CompoundRegExp> it( list ); *it; ++it ) { result->replacePart( *it ); } _scrolledEditorWindow->slotSetRegExp( result ); _error->hide(); maybeVerify( ); recordUndoInfo(); result->check( _errorMap ); } else { _error->show(); if ( _autoVerify ) _verifier->clearRegexp(); } delete result; } _updating = false; }
void KRegExpEditorPrivate::slotUpdateLineEdit() { if ( _updating ) return; _updating = true; RegExp* regexp = _scrolledEditorWindow->regExp(); regexp->check( _errorMap ); TQString str = RegExpConverter::current()->toStr( regexp, false ); _regexpEdit->setText( str ); delete regexp; recordUndoInfo(); _updating = false; }
void testObj::test<8>(void) { const RegExp re("ab*", true); ensure("regexp does not match valid string", re.check("a") ); }
void testObj::test<6>(void) { const RegExp re("a\\d{2}[bc]", true); ensure("regexp does not match matching string", re.check("a12c") ); }
void testObj::test<7>(void) { const RegExp re("a\\d{2}[bc]", true); ensure("regexp matches invalid string", re.check("a2c")==false ); }
void testObj::test<4>(void) { const RegExp re("^full$", true); ensure("exact regexp matches different string", re.check("not full")==false ); }
void testObj::test<5>(void) { const RegExp re("ABC", true); ensure("exact regexp does not match", re.check("xx abc yy")==false ); }
void testObj::test<3>(void) { const RegExp re("^full$", true); ensure("exact regexp does not match", re.check("full") ); }
void testObj::test<2>(void) { const RegExp re("x", true); ensure("string does not match valid regexp", re.check("axc") ); }
void testObj::test<1>(void) { const RegExp re("", true); ensure("string does not match empty regexp", re.check("abc") ); }
void testObj::test<12>(void) { const RegExp re("ab+", false); ensure("case-insensitive regexp matches invalid string", re.check("A") ); }
void testObj::test<11>(void) { const RegExp re("ab+", false); ensure("case-insensitive regexp does not match valid string", re.check("AB") ); }