3
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /fasttmp/mkdist-qt-4.5.2-1245473805/qt-x11-opensource-src-4.5.2/src/corelib/tools/qstring.cpp -->
7
<title>Qt 4.5: QStringRef Class Reference</title>
7
<title>Qt 4.6: QStringRef Class Reference</title>
8
8
<link href="classic.css" rel="stylesheet" type="text/css" />
11
<a name="//apple_ref/cpp/cl//QStringRef" />
11
12
<table border="0" cellpadding="0" cellspacing="0" width="100%">
13
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
14
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="namespaces.html"><font color="#004faf">All Namespaces</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
15
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QStringRef Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
14
<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>
15
<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><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
16
</tr></table><h1 class="title">QStringRef Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
17
18
<p>The QStringRef class provides a thin wrapper around <a href="qstring.html">QString</a> substrings. <a href="#details">More...</a></p>
18
<pre> #include <QStringRef></pre><p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
19
<pre> #include <QStringRef></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
19
20
<p>This class was introduced in Qt 4.3.</p>
21
22
<li><a href="qstringref-members.html">List of all members, including inherited members</a></li>
23
25
<a name="public-functions"></a>
24
<h3>Public Functions</h3>
26
<li><div class="fn"></div><b><a href="qstringref.html#QStringRef">QStringRef</a></b> ()</li>
27
<li><div class="fn"></div><b><a href="qstringref.html#QStringRef-2">QStringRef</a></b> ( const QString * <i>string</i>, int <i>position</i>, int <i>length</i> )</li>
28
<li><div class="fn"></div><b><a href="qstringref.html#QStringRef-3">QStringRef</a></b> ( const QString * <i>string</i> )</li>
29
<li><div class="fn"></div><b><a href="qstringref.html#QStringRef-4">QStringRef</a></b> ( const QStringRef & <i>other</i> )</li>
30
<li><div class="fn"></div><b><a href="qstringref.html#dtor.QStringRef">~QStringRef</a></b> ()</li>
31
<li><div class="fn"></div>QStringRef <b><a href="qstringref.html#appendTo">appendTo</a></b> ( QString * <i>string</i> ) const</li>
32
<li><div class="fn"></div>const QChar <b><a href="qstringref.html#at">at</a></b> ( int <i>position</i> ) const</li>
33
<li><div class="fn"></div>void <b><a href="qstringref.html#clear">clear</a></b> ()</li>
34
<li><div class="fn"></div>int <b><a href="qstringref.html#compare-4">compare</a></b> ( const QString & <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
35
<li><div class="fn"></div>int <b><a href="qstringref.html#compare-5">compare</a></b> ( const QStringRef & <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
36
<li><div class="fn"></div>int <b><a href="qstringref.html#compare-6">compare</a></b> ( QLatin1String <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</li>
37
<li><div class="fn"></div>const QChar * <b><a href="qstringref.html#constData">constData</a></b> () const</li>
38
<li><div class="fn"></div>int <b><a href="qstringref.html#count">count</a></b> () const</li>
39
<li><div class="fn"></div>const QChar * <b><a href="qstringref.html#data">data</a></b> () const</li>
40
<li><div class="fn"></div>bool <b><a href="qstringref.html#isEmpty">isEmpty</a></b> () const</li>
41
<li><div class="fn"></div>bool <b><a href="qstringref.html#isNull">isNull</a></b> () const</li>
42
<li><div class="fn"></div>int <b><a href="qstringref.html#length">length</a></b> () const</li>
43
<li><div class="fn"></div>int <b><a href="qstringref.html#localeAwareCompare-3">localeAwareCompare</a></b> ( const QString & <i>other</i> ) const</li>
44
<li><div class="fn"></div>int <b><a href="qstringref.html#localeAwareCompare-4">localeAwareCompare</a></b> ( const QStringRef & <i>other</i> ) const</li>
45
<li><div class="fn"></div>int <b><a href="qstringref.html#position">position</a></b> () const</li>
46
<li><div class="fn"></div>int <b><a href="qstringref.html#size">size</a></b> () const</li>
47
<li><div class="fn"></div>const QString * <b><a href="qstringref.html#string">string</a></b> () const</li>
48
<li><div class="fn"></div>QString <b><a href="qstringref.html#toString">toString</a></b> () const</li>
49
<li><div class="fn"></div>const QChar * <b><a href="qstringref.html#unicode">unicode</a></b> () const</li>
50
<li><div class="fn"></div>QStringRef & <b><a href="qstringref.html#operator-eq">operator=</a></b> ( const QStringRef & <i>other</i> )</li>
51
<li><div class="fn"></div>QStringRef & <b><a href="qstringref.html#operator-eq-2">operator=</a></b> ( const QString * <i>string</i> )</li>
26
<h2>Public Functions</h2>
27
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
28
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#QStringRef">QStringRef</a></b> ()</td></tr>
29
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#QStringRef-2">QStringRef</a></b> ( const QString * <i>string</i>, int <i>position</i>, int <i>length</i> )</td></tr>
30
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#QStringRef-3">QStringRef</a></b> ( const QString * <i>string</i> )</td></tr>
31
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#QStringRef-4">QStringRef</a></b> ( const QStringRef & <i>other</i> )</td></tr>
32
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#dtor.QStringRef">~QStringRef</a></b> ()</td></tr>
33
<tr><td class="memItemLeft" align="right" valign="top">QStringRef </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#appendTo">appendTo</a></b> ( QString * <i>string</i> ) const</td></tr>
34
<tr><td class="memItemLeft" align="right" valign="top">const QChar </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#at">at</a></b> ( int <i>position</i> ) const</td></tr>
35
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#clear">clear</a></b> ()</td></tr>
36
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare-4">compare</a></b> ( const QString & <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
37
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare-5">compare</a></b> ( const QStringRef & <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
38
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare-6">compare</a></b> ( QLatin1String <i>other</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive ) const</td></tr>
39
<tr><td class="memItemLeft" align="right" valign="top">const QChar * </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#constData">constData</a></b> () const</td></tr>
40
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#count">count</a></b> () const</td></tr>
41
<tr><td class="memItemLeft" align="right" valign="top">const QChar * </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#data">data</a></b> () const</td></tr>
42
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#isEmpty">isEmpty</a></b> () const</td></tr>
43
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#isNull">isNull</a></b> () const</td></tr>
44
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#length">length</a></b> () const</td></tr>
45
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#localeAwareCompare-3">localeAwareCompare</a></b> ( const QString & <i>other</i> ) const</td></tr>
46
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#localeAwareCompare-4">localeAwareCompare</a></b> ( const QStringRef & <i>other</i> ) const</td></tr>
47
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#position">position</a></b> () const</td></tr>
48
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#size">size</a></b> () const</td></tr>
49
<tr><td class="memItemLeft" align="right" valign="top">const QString * </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#string">string</a></b> () const</td></tr>
50
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#toString">toString</a></b> () const</td></tr>
51
<tr><td class="memItemLeft" align="right" valign="top">const QChar * </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#unicode">unicode</a></b> () const</td></tr>
52
<tr><td class="memItemLeft" align="right" valign="top">QStringRef & </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-eq">operator=</a></b> ( const QStringRef & <i>other</i> )</td></tr>
53
<tr><td class="memItemLeft" align="right" valign="top">QStringRef & </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-eq-2">operator=</a></b> ( const QString * <i>string</i> )</td></tr>
53
56
<a name="static-public-members"></a>
54
<h3>Static Public Members</h3>
56
<li><div class="fn"></div>int <b><a href="qstringref.html#compare">compare</a></b> ( const QStringRef & <i>s1</i>, const QString & <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
57
<li><div class="fn"></div>int <b><a href="qstringref.html#compare-2">compare</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
58
<li><div class="fn"></div>int <b><a href="qstringref.html#compare-3">compare</a></b> ( const QStringRef & <i>s1</i>, QLatin1String <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</li>
59
<li><div class="fn"></div>int <b><a href="qstringref.html#localeAwareCompare">localeAwareCompare</a></b> ( const QStringRef & <i>s1</i>, const QString & <i>s2</i> )</li>
60
<li><div class="fn"></div>int <b><a href="qstringref.html#localeAwareCompare-2">localeAwareCompare</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
57
<h2>Static Public Members</h2>
58
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
59
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare">compare</a></b> ( const QStringRef & <i>s1</i>, const QString & <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
60
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare-2">compare</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
61
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#compare-3">compare</a></b> ( const QStringRef & <i>s1</i>, QLatin1String <i>s2</i>, Qt::CaseSensitivity <i>cs</i> = Qt::CaseSensitive )</td></tr>
62
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#localeAwareCompare">localeAwareCompare</a></b> ( const QStringRef & <i>s1</i>, const QString & <i>s2</i> )</td></tr>
63
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#localeAwareCompare-2">localeAwareCompare</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
62
66
<a name="related-non-members"></a>
63
<h3>Related Non-Members</h3>
65
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-lt-13">operator<</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
66
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-lt-eq-11">operator<=</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
67
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-eq-eq-48">operator==</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
68
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-eq-eq-49">operator==</a></b> ( const QString & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
69
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-eq-eq-51">operator==</a></b> ( const QLatin1String & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
70
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-gt-11">operator></a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
71
<li><div class="fn"></div>bool <b><a href="qstringref.html#operator-gt-eq-11">operator>=</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</li>
67
<h2>Related Non-Members</h2>
68
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
69
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-lt-15">operator<</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
70
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-lt-eq-12">operator<=</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
71
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-eq-eq-63">operator==</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
72
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-eq-eq-64">operator==</a></b> ( const QString & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
73
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-eq-eq-66">operator==</a></b> ( const QLatin1String & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
74
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-gt-12">operator></a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
75
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstringref.html#operator-gt-eq-12">operator>=</a></b> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</td></tr>
73
77
<a name="details"></a>
75
79
<h2>Detailed Description</h2>
93
98
<p>Constructs a string reference to the given <i>string</i>.</p>
94
99
<h3 class="fn"><a name="QStringRef-4"></a>QStringRef::QStringRef ( const QStringRef & <i>other</i> )</h3>
95
100
<p>Constructs a copy of the <i>other</i> string reference.</p>
101
<a name="//apple_ref/cpp/instm/QStringRef/~QStringRef" />
96
102
<h3 class="fn"><a name="dtor.QStringRef"></a>QStringRef::~QStringRef ()</h3>
97
103
<p>Destroys the string reference.</p>
98
104
<p>Since this class is only used to refer to string data, and does not take ownership of it, no memory is freed when instances are destroyed.</p>
105
<a name="//apple_ref/cpp/instm/QStringRef/appendTo" />
99
106
<h3 class="fn"><a name="appendTo"></a>QStringRef QStringRef::appendTo ( <a href="qstring.html">QString</a> * <i>string</i> ) const</h3>
100
107
<p>Appends the string reference to <i>string</i>, and returns a new reference to the combined string data.</p>
108
<a name="//apple_ref/cpp/instm/QStringRef/at" />
101
109
<h3 class="fn"><a name="at"></a>const <a href="qchar.html">QChar</a> QStringRef::at ( int <i>position</i> ) const</h3>
102
110
<p>Returns the character at the given index <i>position</i> in the string reference.</p>
103
111
<p>The <i>position</i> must be a valid index position in the string (i.e., 0 <= <i>position</i> < <a href="qstringref.html#size">size</a>()).</p>
112
<a name="//apple_ref/cpp/instm/QStringRef/clear" />
104
113
<h3 class="fn"><a name="clear"></a>void QStringRef::clear ()</h3>
105
114
<p>Clears the contents of the string reference by making it null and empty.</p>
106
115
<p>See also <a href="qstringref.html#isEmpty">isEmpty</a>() and <a href="qstringref.html#isNull">isNull</a>().</p>
116
<a name="//apple_ref/cpp/clm/QStringRef/compare" />
107
117
<h3 class="fn"><a name="compare"></a>int QStringRef::compare ( const QStringRef & <i>s1</i>, const <a href="qstring.html">QString</a> & <i>s2</i>, <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitivity</a> <i>cs</i> = Qt::CaseSensitive ) <tt> [static]</tt></h3>
108
118
<p>Compares the string <i>s1</i> with the string <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
109
119
<p>If <i>cs</i> is <a href="qt.html#CaseSensitivity-enum">Qt::CaseSensitive</a>, the comparison is case sensitive; otherwise the comparison is case insensitive.</p>
139
149
<p>Equivalent to <tt>compare(*this, other, cs)</tt>.</p>
140
150
<p>This function was introduced in Qt 4.5.</p>
141
151
<p>See also <a href="qstring.html#compare">QString::compare</a>().</p>
152
<a name="//apple_ref/cpp/instm/QStringRef/constData" />
142
153
<h3 class="fn"><a name="constData"></a>const <a href="qchar.html">QChar</a> * QStringRef::constData () const</h3>
143
154
<p>Same as <a href="qstringref.html#unicode">unicode</a>().</p>
155
<a name="//apple_ref/cpp/instm/QStringRef/count" />
144
156
<h3 class="fn"><a name="count"></a>int QStringRef::count () const</h3>
145
157
<p>Returns the number of characters referred to by the string reference. Equivalent to <a href="qstringref.html#size">size</a>() and <a href="qstringref.html#length">length</a>().</p>
146
158
<p>See also <a href="qstringref.html#position">position</a>() and <a href="qstringref.html#string">string</a>().</p>
159
<a name="//apple_ref/cpp/instm/QStringRef/data" />
147
160
<h3 class="fn"><a name="data"></a>const <a href="qchar.html">QChar</a> * QStringRef::data () const</h3>
148
161
<p>Same as <a href="qstringref.html#unicode">unicode</a>().</p>
162
<a name="//apple_ref/cpp/instm/QStringRef/isEmpty" />
149
163
<h3 class="fn"><a name="isEmpty"></a>bool QStringRef::isEmpty () const</h3>
150
164
<p>Returns true if the string reference has no characters; otherwise returns false.</p>
151
165
<p>A string reference is empty if its size is zero.</p>
152
166
<p>See also <a href="qstringref.html#size">size</a>().</p>
167
<a name="//apple_ref/cpp/instm/QStringRef/isNull" />
153
168
<h3 class="fn"><a name="isNull"></a>bool QStringRef::isNull () const</h3>
154
169
<p>Returns true if <a href="qstringref.html#string">string</a>() returns a null pointer or a pointer to a null string; otherwise returns true.</p>
155
170
<p>See also <a href="qstringref.html#size">size</a>().</p>
171
<a name="//apple_ref/cpp/instm/QStringRef/length" />
156
172
<h3 class="fn"><a name="length"></a>int QStringRef::length () const</h3>
157
173
<p>Returns the number of characters referred to by the string reference. Equivalent to <a href="qstringref.html#size">size</a>() and <a href="qstringref.html#count">count</a>().</p>
158
174
<p>See also <a href="qstringref.html#position">position</a>() and <a href="qstringref.html#string">string</a>().</p>
175
<a name="//apple_ref/cpp/clm/QStringRef/localeAwareCompare" />
159
176
<h3 class="fn"><a name="localeAwareCompare"></a>int QStringRef::localeAwareCompare ( const QStringRef & <i>s1</i>, const <a href="qstring.html">QString</a> & <i>s2</i> ) <tt> [static]</tt></h3>
160
177
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
161
178
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
162
179
<p>On Mac OS X, this function compares according the "Order for sorted lists" setting in the International prefereces panel.</p>
163
180
<p>This function was introduced in Qt 4.5.</p>
164
<p>See also <a href="qstringref.html#compare">compare</a>() and <a href="qtextcodec-qt3.html#locale">QTextCodec::locale</a>().</p>
181
<p>See also <a href="qstringref.html#compare">compare</a>() and <a href="qtextcodec-qt3.html#locale" class="compat">QTextCodec::locale</a>().</p>
165
182
<h3 class="fn"><a name="localeAwareCompare-2"></a>int QStringRef::localeAwareCompare ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> ) <tt> [static]</tt></h3>
166
183
<p>This is an overloaded function.</p>
167
184
<p>Compares <i>s1</i> with <i>s2</i> and returns an integer less than, equal to, or greater than zero if <i>s1</i> is less than, equal to, or greater than <i>s2</i>.</p>
177
194
<p>Compares this string with the <i>other</i> string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the <i>other</i> string.</p>
178
195
<p>The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.</p>
179
196
<p>This function was introduced in Qt 4.5.</p>
197
<a name="//apple_ref/cpp/instm/QStringRef/position" />
180
198
<h3 class="fn"><a name="position"></a>int QStringRef::position () const</h3>
181
199
<p>Returns the starting position in the referenced string that is referred to by the string reference.</p>
182
200
<p>See also <a href="qstringref.html#size">size</a>() and <a href="qstringref.html#string">string</a>().</p>
201
<a name="//apple_ref/cpp/instm/QStringRef/size" />
183
202
<h3 class="fn"><a name="size"></a>int QStringRef::size () const</h3>
184
203
<p>Returns the number of characters referred to by the string reference. Equivalent to <a href="qstringref.html#length">length</a>() and <a href="qstringref.html#count">count</a>().</p>
185
204
<p>See also <a href="qstringref.html#position">position</a>() and <a href="qstringref.html#string">string</a>().</p>
205
<a name="//apple_ref/cpp/instm/QStringRef/string" />
186
206
<h3 class="fn"><a name="string"></a>const <a href="qstring.html">QString</a> * QStringRef::string () const</h3>
187
207
<p>Returns a pointer to the string referred to by the string reference, or 0 if it does not reference a string.</p>
188
208
<p>See also <a href="qstringref.html#unicode">unicode</a>().</p>
209
<a name="//apple_ref/cpp/instm/QStringRef/toString" />
189
210
<h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> QStringRef::toString () const</h3>
190
211
<p>Returns a copy of the string reference as a <a href="qstring.html">QString</a> object.</p>
191
212
<p>If the string reference is not a complete reference of the string (meaning that <a href="qstringref.html#position">position</a>() is 0 and <a href="qstringref.html#size">size</a>() equals <a href="qstringref.html#string">string</a>()-><a href="qstringref.html#size">size</a>()), this function will allocate a new string to return.</p>
192
213
<p>See also <a href="qstringref.html#string">string</a>().</p>
214
<a name="//apple_ref/cpp/instm/QStringRef/unicode" />
193
215
<h3 class="fn"><a name="unicode"></a>const <a href="qchar.html">QChar</a> * QStringRef::unicode () const</h3>
194
216
<p>Returns a Unicode representation of the string reference. Since the data stems directly from the referenced string, it is not null-terminated unless the string reference includes the string's null terminator.</p>
195
217
<p>See also <a href="qstringref.html#string">string</a>().</p>
218
<a name="//apple_ref/cpp/instm/QStringRef/operator=" />
196
219
<h3 class="fn"><a name="operator-eq"></a>QStringRef & QStringRef::operator= ( const QStringRef & <i>other</i> )</h3>
197
220
<p>Assigns the <i>other</i> string reference to this string reference, and returns the result.</p>
198
221
<h3 class="fn"><a name="operator-eq-2"></a>QStringRef & QStringRef::operator= ( const <a href="qstring.html">QString</a> * <i>string</i> )</h3>
199
222
<p>Constructs a string reference to the given <i>string</i> and assigns it to this string reference, returning the result.</p>
201
224
<h2>Related Non-Members</h2>
202
<h3 class="fn"><a name="operator-lt-13"></a>bool operator< ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
225
<h3 class="fn"><a name="operator-lt-15"></a>bool operator< ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
203
226
<p>Returns true if string reference <i>s1</i> is lexically less than string reference <i>s2</i>; otherwise returns false.</p>
204
227
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
205
<h3 class="fn"><a name="operator-lt-eq-11"></a>bool operator<= ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
228
<h3 class="fn"><a name="operator-lt-eq-12"></a>bool operator<= ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
206
229
<p>Returns true if string reference <i>s1</i> is lexically less than or equal to string reference <i>s2</i>; otherwise returns false.</p>
207
230
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
208
<h3 class="fn"><a name="operator-eq-eq-48"></a>bool operator== ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
231
<h3 class="fn"><a name="operator-eq-eq-63"></a>bool operator== ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
209
232
<p>Returns true if string reference <i>s1</i> is lexically equal to string reference <i>s2</i>; otherwise returns false.</p>
210
<h3 class="fn"><a name="operator-eq-eq-49"></a>bool operator== ( const <a href="qstring.html">QString</a> & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
211
<p>Returns true if string <i>s1</i> is lexically equal to string reference <i>s2</i>; otherwise returns false.</p>
212
<h3 class="fn"><a name="operator-eq-eq-51"></a>bool operator== ( const <a href="qlatin1string.html">QLatin1String</a> & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
213
<p>Returns true if string <i>s1</i> is lexically equal to string reference <i>s2</i>; otherwise returns false.</p>
214
<h3 class="fn"><a name="operator-gt-11"></a>bool operator> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
233
<h3 class="fn"><a name="operator-eq-eq-64"></a>bool operator== ( const <a href="qstring.html">QString</a> & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
234
<p>Returns true if string <i>s1</i> is lexically equal to string reference <i>s2</i>; otherwise returns false.</p>
235
<h3 class="fn"><a name="operator-eq-eq-66"></a>bool operator== ( const <a href="qlatin1string.html">QLatin1String</a> & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
236
<p>Returns true if string <i>s1</i> is lexically equal to string reference <i>s2</i>; otherwise returns false.</p>
237
<h3 class="fn"><a name="operator-gt-12"></a>bool operator> ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
215
238
<p>Returns true if string reference <i>s1</i> is lexically greater than string reference <i>s2</i>; otherwise returns false.</p>
216
239
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
217
<h3 class="fn"><a name="operator-gt-eq-11"></a>bool operator>= ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
240
<h3 class="fn"><a name="operator-gt-eq-12"></a>bool operator>= ( const QStringRef & <i>s1</i>, const QStringRef & <i>s2</i> )</h3>
218
241
<p>Returns true if string reference <i>s1</i> is lexically greater than or equal to string reference <i>s2</i>; otherwise returns false.</p>
219
242
<p>The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>() function.</p>
220
243
<p /><address><hr /><div align="center">
221
244
<table width="100%" cellspacing="0" border="0"><tr class="address">
222
<td width="30%" align="left">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
223
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
224
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
225
</tr></table></div></address></body>
245
<td width="40%" align="left">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
246
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
247
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
248
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>