<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qsourcelocation.cpp --> <title>QSourceLocation Class | Qt XML Patterns 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtxmlpatterns-index.html">Qt XML Patterns</a></td><td ><a href="qtxmlpatterns-module.html">C++ Classes</a></td><td >QSourceLocation</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#related-non-members">Related Non-Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QSourceLocation Class</h1> <!-- $$$QSourceLocation-brief --> <p>The <a href="qsourcelocation.html">QSourceLocation</a> class identifies a location in a resource by URI, line, and column. <a href="#details">More...</a></p> <!-- @@@QSourceLocation --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QSourceLocation></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += xmlpatterns</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.4</td></tr></table></div><ul> <li><a href="qsourcelocation-members.html">List of all members, including inherited members</a></li> </ul> <p><b>Note:</b> All functions in this class are reentrant.</p> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#QSourceLocation-1">QSourceLocation</a></b>(const QSourceLocation &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#QSourceLocation-2">QSourceLocation</a></b>(const QUrl &<i>u</i>, int <i>l</i> = -1, int <i>c</i> = -1)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#dtor.QSourceLocation">~QSourceLocation</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#column">column</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#isNull">isNull</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#line">line</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#setColumn">setColumn</a></b>(qint64 <i>newColumn</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#setLine">setLine</a></b>(qint64 <i>newLine</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#setUri">setUri</a></b>(const QUrl &<i>newUri</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QUrl </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#uri">uri</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#operator-not-eq">operator!=</a></b>(const QSourceLocation &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSourceLocation &</td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#operator-eq">operator=</a></b>(const QSourceLocation &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#operator-eq-eq">operator==</a></b>(const QSourceLocation &<i>other</i>) const</td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#qHash">qHash</a></b>(const QSourceLocation &<i>location</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDebug </td><td class="memItemRight bottomAlign"><b><a href="qsourcelocation.html#operator-lt-lt">operator<<</a></b>(QDebug <i>debug</i>, const QSourceLocation &<i>sourceLocation</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QSourceLocation-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qsourcelocation.html">QSourceLocation</a> class identifies a location in a resource by URI, line, and column.</p> <p><a href="qsourcelocation.html">QSourceLocation</a> is a simple value based class that has three properties, <a href="qsourcelocation.html#uri">uri</a>(), <a href="qsourcelocation.html#line">line</a>(), and <a href="qsourcelocation.html#column">column</a>(), that, taken together, identify a certain point in a resource, e.g., a file or an in-memory document.</p> <p><a href="qsourcelocation.html#line">line</a>() and <a href="qsourcelocation.html#column">column</a>() refer to character counts (not byte counts), and they both start from 1, as opposed to 0.</p> </div> <!-- @@@QSourceLocation --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QSourceLocation[overload1]$$$QSourceLocation --> <h3 class="fn" id="QSourceLocation"><a name="QSourceLocation"></a>QSourceLocation::<span class="name">QSourceLocation</span>()</h3> <p>Construct a <a href="qsourcelocation.html">QSourceLocation</a> that doesn't identify anything at all.</p> <p>For a default constructed QSourceLocation(), <a href="qsourcelocation.html#isNull">isNull</a>() returns <code>true</code>.</p> <!-- @@@QSourceLocation --> <!-- $$$QSourceLocation$$$QSourceLocationconstQSourceLocation& --> <h3 class="fn" id="QSourceLocation-1"><a name="QSourceLocation-1"></a>QSourceLocation::<span class="name">QSourceLocation</span>(const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>other</i>)</h3> <p>Constructs a <a href="qsourcelocation.html">QSourceLocation</a> that is a copy of <i>other</i>.</p> <!-- @@@QSourceLocation --> <!-- $$$QSourceLocation$$$QSourceLocationconstQUrl&intint --> <h3 class="fn" id="QSourceLocation-2"><a name="QSourceLocation-2"></a>QSourceLocation::<span class="name">QSourceLocation</span>(const <span class="type">QUrl</span> &<i>u</i>, <span class="type">int</span> <i>l</i> = -1, <span class="type">int</span> <i>c</i> = -1)</h3> <p>Constructs a <a href="qsourcelocation.html">QSourceLocation</a> with URI <i>u</i>, line <i>l</i> and column <i>c</i>.</p> <!-- @@@QSourceLocation --> <!-- $$$~QSourceLocation[overload1]$$$~QSourceLocation --> <h3 class="fn" id="dtor.QSourceLocation"><a name="dtor.QSourceLocation"></a>QSourceLocation::<span class="name">~QSourceLocation</span>()</h3> <p>Destructor.</p> <!-- @@@~QSourceLocation --> <!-- $$$column[overload1]$$$column --> <h3 class="fn" id="column"><a name="column"></a><span class="type">qint64</span> QSourceLocation::<span class="name">column</span>() const</h3> <p>Returns the current column number. The column number refers to the count of characters, not bytes. The first column is column 1, not 0. The default value is -1, indicating the column number is unknown.</p> <p><b>See also </b><a href="qsourcelocation.html#setColumn">setColumn</a>().</p> <!-- @@@column --> <!-- $$$isNull[overload1]$$$isNull --> <h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QSourceLocation::<span class="name">isNull</span>() const</h3> <p>Returns <code>true</code> if this <a href="qsourcelocation.html">QSourceLocation</a> doesn't identify anything.</p> <p>For a default constructed <a href="qsourcelocation.html">QSourceLocation</a>, this function returns <code>true</code>. The same applies for any other <a href="qsourcelocation.html">QSourceLocation</a> whose <a href="qsourcelocation.html#uri">uri</a>() is invalid.</p> <!-- @@@isNull --> <!-- $$$line[overload1]$$$line --> <h3 class="fn" id="line"><a name="line"></a><span class="type">qint64</span> QSourceLocation::<span class="name">line</span>() const</h3> <p>Returns the current line number. The first line number is 1, not 0. The default value is -1, indicating the line number is unknown.</p> <p><b>See also </b><a href="qsourcelocation.html#setLine">setLine</a>().</p> <!-- @@@line --> <!-- $$$setColumn[overload1]$$$setColumnqint64 --> <h3 class="fn" id="setColumn"><a name="setColumn"></a><span class="type">void</span> QSourceLocation::<span class="name">setColumn</span>(<span class="type">qint64</span> <i>newColumn</i>)</h3> <p>Sets the column number to <i>newColumn</i>. 0 is an invalid column number. The first column number is 1.</p> <p><b>See also </b><a href="qsourcelocation.html#column">column</a>().</p> <!-- @@@setColumn --> <!-- $$$setLine[overload1]$$$setLineqint64 --> <h3 class="fn" id="setLine"><a name="setLine"></a><span class="type">void</span> QSourceLocation::<span class="name">setLine</span>(<span class="type">qint64</span> <i>newLine</i>)</h3> <p>Sets the line number to <i>newLine</i>. 0 is an invalid line number. The first line number is 1.</p> <p><b>See also </b><a href="qsourcelocation.html#line">line</a>().</p> <!-- @@@setLine --> <!-- $$$setUri[overload1]$$$setUriconstQUrl& --> <h3 class="fn" id="setUri"><a name="setUri"></a><span class="type">void</span> QSourceLocation::<span class="name">setUri</span>(const <span class="type">QUrl</span> &<i>newUri</i>)</h3> <p>Sets the URI to <i>newUri</i>.</p> <p><b>See also </b><a href="qsourcelocation.html#uri">uri</a>().</p> <!-- @@@setUri --> <!-- $$$uri[overload1]$$$uri --> <h3 class="fn" id="uri"><a name="uri"></a><span class="type">QUrl</span> QSourceLocation::<span class="name">uri</span>() const</h3> <p>Returns the resource that this <a href="qsourcelocation.html">QSourceLocation</a> refers to. For example, the resource could be a file in the local file system, if the URI scheme is <code>file</code>.</p> <p><b>See also </b><a href="qsourcelocation.html#setUri">setUri</a>().</p> <!-- @@@uri --> <!-- $$$operator!=[overload1]$$$operator!=constQSourceLocation& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QSourceLocation::<span class="name">operator!=</span>(const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>other</i>) const</h3> <p>Returns the opposite of applying operator==() for this <a href="qxmlname.html">QXmlName</a> and <i>other</i>.</p> <!-- @@@operator!= --> <!-- $$$operator=[overload1]$$$operator=constQSourceLocation& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &QSourceLocation::<span class="name">operator=</span>(const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>other</i>)</h3> <p>Assigns this <a href="qsourcelocation.html">QSourceLocation</a> instance to <i>other</i>.</p> <!-- @@@operator= --> <!-- $$$operator==[overload1]$$$operator==constQSourceLocation& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QSourceLocation::<span class="name">operator==</span>(const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>other</i>) const</h3> <p>Returns true if this <a href="qsourcelocation.html">QSourceLocation</a> is identical to <i>other</i>.</p> <p>Two <a href="qsourcelocation.html">QSourceLocation</a> instances are equal if their <a href="qsourcelocation.html#uri">uri</a>(), <a href="qsourcelocation.html#line">line</a>() and <a href="qsourcelocation.html#column">column</a>() are equal.</p> <p><a href="qsourcelocation.html">QSourceLocation</a> instances for which <a href="qsourcelocation.html#isNull">isNull</a>() returns true are considered equal.</p> <!-- @@@operator== --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$qHash[overload1]$$$qHashconstQSourceLocation& --> <h3 class="fn" id="qHash"><a name="qHash"></a><span class="type">uint</span> <span class="name">qHash</span>(const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>location</i>)</h3> <p>Computes a hash key for the <a href="qsourcelocation.html">QSourceLocation</a> <i>location</i>.</p> <p>This function was introduced in Qt 4.4.</p> <!-- @@@qHash --> <!-- $$$operator<<[overload1]$$$operator<<QDebugconstQSourceLocation& --> <h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type">QDebug</span> <span class="name">operator<<</span>(<span class="type">QDebug</span> <i>debug</i>, const <span class="type"><a href="qsourcelocation.html#QSourceLocation">QSourceLocation</a></span> &<i>sourceLocation</i>)</h3> <p>Prints <i>sourceLocation</i> to the debug stream <i>debug</i>.</p> <p>This function was introduced in Qt 4.4.</p> <!-- @@@operator<< --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>