com.trolltech.qt.core
Class QStringMatcher

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QStringMatcher
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QStringMatcher
extends QtJambiObject
implements java.lang.Cloneable

The QStringMatcher class holds a sequence of characters that can be quickly matched in a Unicode string. This class is useful when you have a sequence of QChars that you want to repeatedly match against some strings (perhaps in a loop), or when you want to search for the same sequence of characters multiple times in the same string. Using a matcher object and indexIn() is faster than matching a plain QString with QString::indexOf() if repeated matching takes place. This class offers no benefit if you are doing one-off string matches.

Create the QStringMatcher with the QString you want to search for. Then call indexIn() on the QString that you want to search.

See also:
QString, QByteArrayMatcher, and QRegExp.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QStringMatcher()
          Constructs an empty string matcher that won't match anything.
QStringMatcher(QStringMatcher other)
          Copies the other string matcher to this string matcher.
QStringMatcher(java.lang.String pattern)
          Constructs a string matcher that will search for pattern, with case sensitivity cs.
QStringMatcher(java.lang.String pattern, Qt.CaseSensitivity cs)
          Constructs a string matcher that will search for pattern, with case sensitivity cs.
 
Method Summary
 Qt.CaseSensitivity caseSensitivity()
          Returns the case sensitivity setting for this string matcher.
 QStringMatcher clone()
          This method is reimplemented for internal reasons
 int indexIn(java.lang.String str)
          Searches the string str from character position from (default 0, i.
 int indexIn(java.lang.String str, int from)
          Searches the string str from character position from (default 0, i.
 java.lang.String pattern()
          Returns the string pattern that this string matcher will search for.
 void setCaseSensitivity(Qt.CaseSensitivity cs)
          Sets the case sensitivity setting of this string matcher to cs.
 void setPattern(java.lang.String pattern)
          Sets the string that this string matcher will search for to pattern.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QStringMatcher

public QStringMatcher()
Constructs an empty string matcher that won't match anything. Call setPattern() to give it a pattern to match.


QStringMatcher

public QStringMatcher(java.lang.String pattern)
Constructs a string matcher that will search for pattern, with case sensitivity cs.

Call indexIn() to perform a search.


QStringMatcher

public QStringMatcher(java.lang.String pattern,
                      Qt.CaseSensitivity cs)
Constructs a string matcher that will search for pattern, with case sensitivity cs.

Call indexIn() to perform a search.


QStringMatcher

public QStringMatcher(QStringMatcher other)
Copies the other string matcher to this string matcher.

Method Detail

caseSensitivity

public final Qt.CaseSensitivity caseSensitivity()
Returns the case sensitivity setting for this string matcher.

See also:
setCaseSensitivity().


indexIn

public final int indexIn(java.lang.String str)
Searches the string str from character position from (default 0, i. . from the first character), for the string pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

See also:
setPattern(), and setCaseSensitivity().


indexIn

public final int indexIn(java.lang.String str,
                         int from)
Searches the string str from character position from (default 0, i. . from the first character), for the string pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in str, or -1 if no match was found.

See also:
setPattern(), and setCaseSensitivity().


pattern

public final java.lang.String pattern()
Returns the string pattern that this string matcher will search for.

See also:
setPattern().


setCaseSensitivity

public final void setCaseSensitivity(Qt.CaseSensitivity cs)
Sets the case sensitivity setting of this string matcher to cs.

See also:
caseSensitivity(), setPattern(), and indexIn().


setPattern

public final void setPattern(java.lang.String pattern)
Sets the string that this string matcher will search for to pattern.

See also:
pattern(), setCaseSensitivity(), and indexIn().


clone

public QStringMatcher clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object