<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- qtextboundaryfinder.cpp --> <head> <title>Qt 4.6: QTextBoundaryFinder Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//QTextBoundaryFinder"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QTextBoundaryFinder Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span> </h1> <p>The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string. <a href="#details">More...</a></p> <pre> #include <QTextBoundaryFinder></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p> <p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qtextboundaryfinder-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#BoundaryReason-enum">BoundaryReason</a></b> { NotAtBoundary, StartWord, EndWord }</td></tr> <tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#BoundaryReason-enum">BoundaryReasons</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#BoundaryType-enum">BoundaryType</a></b> { Grapheme, Word, Line, Sentence }</td></tr> </table> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#QTextBoundaryFinder">QTextBoundaryFinder</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#QTextBoundaryFinder-2">QTextBoundaryFinder</a></b> ( const QTextBoundaryFinder & <i>other</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#QTextBoundaryFinder-3">QTextBoundaryFinder</a></b> ( BoundaryType <i>type</i>, const QString & <i>string</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#QTextBoundaryFinder-4">QTextBoundaryFinder</a></b> ( BoundaryType <i>type</i>, const QChar * <i>chars</i>, int <i>length</i>, unsigned char * <i>buffer</i> = 0, int <i>bufferSize</i> = 0 )</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#dtor.QTextBoundaryFinder">~QTextBoundaryFinder</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">BoundaryReasons </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#boundaryReasons">boundaryReasons</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#isAtBoundary">isAtBoundary</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#isValid">isValid</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#position">position</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#setPosition">setPosition</a></b> ( int <i>position</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#string">string</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#toEnd">toEnd</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#toNextBoundary">toNextBoundary</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#toPreviousBoundary">toPreviousBoundary</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#toStart">toStart</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">BoundaryType </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#type">type</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QTextBoundaryFinder & </td><td class="memItemRight" valign="bottom"><b><a href="qtextboundaryfinder.html#operator-eq">operator=</a></b> ( const QTextBoundaryFinder & <i>other</i> )</td></tr> </table> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string.</p> <p>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).</p> <p>QTextBoundaryFinder can operate on a <a href="qstring.html">QString</a> in four possible modes depending on the value of <i>BoundaryType</i>.</p> <p>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.</p> <p>Word boundaries are there to locate the start and end of what a language considers to be a word.</p> <p>Line break boundaries give possible places where a line break might happen and sentence boundaries will show the beginning and end of whole sentences.</p> <hr /> <h2>Member Type Documentation</h2> <a name="//apple_ref/cpp/tag/QTextBoundaryFinder/BoundaryReason"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/NotAtBoundary"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/StartWord"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/EndWord"></a> <a name="//apple_ref/cpp/tdef/QTextBoundaryFinder/BoundaryReasons"></a> <h3 class="flags"><a name="BoundaryReason-enum"></a>enum QTextBoundaryFinder::BoundaryReason<br />flags QTextBoundaryFinder::BoundaryReasons</h3> <p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::NotAtBoundary</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The boundary finder is not at a boundary position.</td></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::StartWord</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The boundary finder is at the start of a word.</td></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::EndWord</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The boundary finder is at the end of a word.</td></tr> </table></p> <p>The BoundaryReasons type is a typedef for <a href="qflags.html">QFlags</a><BoundaryReason>. It stores an OR combination of BoundaryReason values.</p> <a name="//apple_ref/cpp/tag/QTextBoundaryFinder/BoundaryType"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/Grapheme"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/Word"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/Line"></a> <a name="//apple_ref/cpp/econst/QTextBoundaryFinder/Sentence"></a> <h3 class="fn"><a name="BoundaryType-enum"></a>enum QTextBoundaryFinder::BoundaryType</h3> <p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::Grapheme</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Finds a grapheme which is the smallest boundary. It including letters, punctation marks, numerals and more.</td></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::Word</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Finds a word.</td></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::Line</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Finds possible positions for breaking the text into multiple lines.</td></tr> <tr><td valign="top"><tt>QTextBoundaryFinder::Sentence</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Finds sentence boundaries. These include periods, question marks etc.</td></tr> </table></p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/QTextBoundaryFinder"></a> <h3 class="fn"><a name="QTextBoundaryFinder"></a>QTextBoundaryFinder::QTextBoundaryFinder ()</h3> <p>Constructs an invalid <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object.</p> <h3 class="fn"><a name="QTextBoundaryFinder-2"></a>QTextBoundaryFinder::QTextBoundaryFinder ( const QTextBoundaryFinder & <i>other</i> )</h3> <p>Copies the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object, <i>other</i>.</p> <h3 class="fn"><a name="QTextBoundaryFinder-3"></a>QTextBoundaryFinder::QTextBoundaryFinder ( <a href="qtextboundaryfinder.html#BoundaryType-enum">BoundaryType</a> <i>type</i>, const <a href="qstring.html">QString</a> & <i>string</i> )</h3> <p>Creates a <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object of <i>type</i> operating on <i>string</i>.</p> <h3 class="fn"><a name="QTextBoundaryFinder-4"></a>QTextBoundaryFinder::QTextBoundaryFinder ( <a href="qtextboundaryfinder.html#BoundaryType-enum">BoundaryType</a> <i>type</i>, const <a href="qchar.html">QChar</a> * <i>chars</i>, int <i>length</i>, unsigned char * <i>buffer</i> = 0, int <i>bufferSize</i> = 0 )</h3> <p>Creates a <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object of <i>type</i> operating on <i>chars</i> with <i>length</i>.</p> <p><i>buffer</i> is an optional working buffer of size <i>bufferSize</i> you can pass to the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a>. If the buffer is large enough to hold the working data required, it will use this instead of allocating its own buffer.</p> <p><b>Warning:</b> <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> does not create a copy of <i>chars</i>. It is the application programmer's responsability to ensure the array is allocated for as long as the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object stays alive. The same applies to <i>buffer</i>.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/~QTextBoundaryFinder"></a> <h3 class="fn"><a name="dtor.QTextBoundaryFinder"></a>QTextBoundaryFinder::~QTextBoundaryFinder ()</h3> <p>Destructs the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/boundaryReasons"></a> <h3 class="fn"><a name="boundaryReasons"></a><a href="qtextboundaryfinder.html#BoundaryReason-enum">BoundaryReasons</a> QTextBoundaryFinder::boundaryReasons () const</h3> <p>Returns the reasons for the boundary finder to have chosen the current position as a boundary.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/isAtBoundary"></a> <h3 class="fn"><a name="isAtBoundary"></a>bool QTextBoundaryFinder::isAtBoundary () const</h3> <p>Returns true if the object's <a href="qtextboundaryfinder.html#position">position</a>() is currently at a valid text boundary.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/isValid"></a> <h3 class="fn"><a name="isValid"></a>bool QTextBoundaryFinder::isValid () const</h3> <p>Returns true if the text boundary finder is valid; otherwise returns false. A default <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> is invalid.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/position"></a> <h3 class="fn"><a name="position"></a>int QTextBoundaryFinder::position () const</h3> <p>Returns the current position of the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a>.</p> <p>The range is from 0 (the beginning of the string) to the length of the string inclusive.</p> <p>See also <a href="qtextboundaryfinder.html#setPosition">setPosition</a>().</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/setPosition"></a> <h3 class="fn"><a name="setPosition"></a>void QTextBoundaryFinder::setPosition ( int <i>position</i> )</h3> <p>Sets the current position of the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> to <i>position</i>.</p> <p>If <i>position</i> 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.</p> <p>See also <a href="qtextboundaryfinder.html#position">position</a>().</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/string"></a> <h3 class="fn"><a name="string"></a><a href="qstring.html">QString</a> QTextBoundaryFinder::string () const</h3> <p>Returns the string the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object operates on.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/toEnd"></a> <h3 class="fn"><a name="toEnd"></a>void QTextBoundaryFinder::toEnd ()</h3> <p>Moves the finder to the end of the string. This is equivalent to setPosition(string.length()).</p> <p>See also <a href="qtextboundaryfinder.html#setPosition">setPosition</a>() and <a href="qtextboundaryfinder.html#position">position</a>().</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/toNextBoundary"></a> <h3 class="fn"><a name="toNextBoundary"></a>int QTextBoundaryFinder::toNextBoundary ()</h3> <p>Moves the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> to the next boundary position and returns that position.</p> <p>Returns -1 is there is no next boundary.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/toPreviousBoundary"></a> <h3 class="fn"><a name="toPreviousBoundary"></a>int QTextBoundaryFinder::toPreviousBoundary ()</h3> <p>Moves the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> to the previous boundary position and returns that position.</p> <p>Returns -1 is there is no previous boundary.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/toStart"></a> <h3 class="fn"><a name="toStart"></a>void QTextBoundaryFinder::toStart ()</h3> <p>Moves the finder to the start of the string. This is equivalent to setPosition(0).</p> <p>See also <a href="qtextboundaryfinder.html#setPosition">setPosition</a>() and <a href="qtextboundaryfinder.html#position">position</a>().</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/type"></a> <h3 class="fn"><a name="type"></a><a href="qtextboundaryfinder.html#BoundaryType-enum">BoundaryType</a> QTextBoundaryFinder::type () const</h3> <p>Returns the type of the <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a>.</p> <a name="//apple_ref/cpp/instm/QTextBoundaryFinder/operator="></a> <h3 class="fn"><a name="operator-eq"></a>QTextBoundaryFinder & QTextBoundaryFinder::operator= ( const QTextBoundaryFinder & <i>other</i> )</h3> <p>Assigns the object, <i>other</i>, to another <a href="qtextboundaryfinder.html">QTextBoundaryFinder</a> object.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>