示例#1
0
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;
}
示例#2
0
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;
}
示例#3
0
void testObj::test<8>(void)
{
  const RegExp re("ab*", true);
  ensure("regexp does not match valid string", re.check("a") );
}
示例#4
0
void testObj::test<6>(void)
{
  const RegExp re("a\\d{2}[bc]", true);
  ensure("regexp does not match matching string", re.check("a12c") );
}
示例#5
0
void testObj::test<7>(void)
{
  const RegExp re("a\\d{2}[bc]", true);
  ensure("regexp matches invalid string", re.check("a2c")==false );
}
示例#6
0
void testObj::test<4>(void)
{
  const RegExp re("^full$", true);
  ensure("exact regexp matches different string", re.check("not full")==false );
}
示例#7
0
void testObj::test<5>(void)
{
  const RegExp re("ABC", true);
  ensure("exact regexp does not match", re.check("xx abc yy")==false );
}
示例#8
0
void testObj::test<3>(void)
{
  const RegExp re("^full$", true);
  ensure("exact regexp does not match", re.check("full") );
}
示例#9
0
void testObj::test<2>(void)
{
  const RegExp re("x", true);
  ensure("string does not match valid regexp", re.check("axc") );
}
示例#10
0
void testObj::test<1>(void)
{
  const RegExp re("", true);
  ensure("string does not match empty regexp", re.check("abc") );
}
示例#11
0
void testObj::test<12>(void)
{
  const RegExp re("ab+", false);
  ensure("case-insensitive regexp matches invalid string", re.check("A") );
}
示例#12
0
void testObj::test<11>(void)
{
  const RegExp re("ab+", false);
  ensure("case-insensitive regexp does not match valid string", re.check("AB") );
}