com.trolltech.qt.core
Class QTextBoundaryFinder

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.QTextBoundaryFinder
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QTextBoundaryFinder
extends QtJambiObject
implements java.lang.Cloneable

The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string. QTextBoundaryFinder allows to find Unicode text boundaries in a string, similar to the Unicode text boundary specification (see http://www.unicode.org/reports/tr29/tr29-11.html).

QTextBoundaryFinder can operate on a QString in four possible modes depending on the value of BoundaryType.

Units of Unicode characters that make up what the user thinks of as a character or basic unit of the language are here called Grapheme clusters. The two unicode characters 'A' + diaeresis do for example form one grapheme cluster as the user thinks of them as one character, yet it is in this case represented by two unicode code points.

Word boundaries are there to locate the start and end of what a language considers to be a word.

Line break boundaries give possible places where a line break might happen and sentence boundaries will show the beginning and end of whole sentences.


Nested Class Summary
static class QTextBoundaryFinder.BoundaryReason
           
static class QTextBoundaryFinder.BoundaryReasons
           
static class QTextBoundaryFinder.BoundaryType
           
 
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
QTextBoundaryFinder()
          Constructs an invalid QTextBoundaryFinder object.
QTextBoundaryFinder(QTextBoundaryFinder.BoundaryType type, java.lang.String string)
          Creates a QTextBoundaryFinder object of type operating on string.
QTextBoundaryFinder(QTextBoundaryFinder other)
          Copies the QTextBoundaryFinder object, other.
 
Method Summary
 QTextBoundaryFinder.BoundaryReasons boundaryReasons()
          Returns the reasons for the boundary finder to have chosen the current position as a boundary.
 QTextBoundaryFinder clone()
          This method is reimplemented for internal reasons
 boolean isAtBoundary()
          Returns true if the object's position() is currently at a valid text boundary.
 boolean isValid()
          Returns true if the text boundary finder is valid; otherwise returns false.
 int position()
          Returns the current position of the QTextBoundaryFinder.
 void setPosition(int position)
          Sets the current position of the QTextBoundaryFinder to position.
 java.lang.String string()
          Returns the string the QTextBoundaryFinder object operates on.
 void toEnd()
          Moves the finder to the end of the string.
 int toNextBoundary()
          Moves the QTextBoundaryFinder to the next boundary position and returns that position.
 int toPreviousBoundary()
          Moves the QTextBoundaryFinder to the previous boundary position and returns that position.
 void toStart()
          Moves the finder to the start of the string.
 QTextBoundaryFinder.BoundaryType type()
          Returns the type of the QTextBoundaryFinder.
 
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

QTextBoundaryFinder

public QTextBoundaryFinder()
Constructs an invalid QTextBoundaryFinder object.


QTextBoundaryFinder

public QTextBoundaryFinder(QTextBoundaryFinder.BoundaryType type,
                           java.lang.String string)
Creates a QTextBoundaryFinder object of type operating on string.


QTextBoundaryFinder

public QTextBoundaryFinder(QTextBoundaryFinder other)
Copies the QTextBoundaryFinder object, other.

Method Detail

boundaryReasons

public final QTextBoundaryFinder.BoundaryReasons boundaryReasons()
Returns the reasons for the boundary finder to have chosen the current position as a boundary.


isAtBoundary

public final boolean isAtBoundary()
Returns true if the object's position() is currently at a valid text boundary.


isValid

public final boolean isValid()
Returns true if the text boundary finder is valid; otherwise returns false. A default QTextBoundaryFinder is invalid.


position

public final int position()
Returns the current position of the QTextBoundaryFinder.

The range is from 0 (the beginning of the string) to the length of the string inclusive.

See also:
setPosition().


setPosition

public final void setPosition(int position)
Sets the current position of the QTextBoundaryFinder to position.

If position is out of bounds, it will be bound to only valid positions. In this case, valid positions are from 0 to the length of the string inclusive.

See also:
position().


string

public final java.lang.String string()
Returns the string the QTextBoundaryFinder object operates on.


toEnd

public final void toEnd()
Moves the finder to the end of the string. This is equivalent to setPosition(string.length()).

See also:
setPosition(), and position().


toNextBoundary

public final int toNextBoundary()
Moves the QTextBoundaryFinder to the next boundary position and returns that position.

Returns -1 is there is no next boundary.


toPreviousBoundary

public final int toPreviousBoundary()
Moves the QTextBoundaryFinder to the previous boundary position and returns that position.

Returns -1 is there is no previous boundary.


toStart

public final void toStart()
Moves the finder to the start of the string. This is equivalent to setPosition(0).

See also:
setPosition(), and position().


type

public final QTextBoundaryFinder.BoundaryType type()
Returns the type of the QTextBoundaryFinder.


clone

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

Overrides:
clone in class java.lang.Object