Qt 4.8
|
The QSourceLocation class identifies a location in a resource by URI, line, and column. More...
#include <qsourcelocation.h>
Public Functions | |
qint64 | column () const |
Returns the current column number. More... | |
bool | isNull () const |
Returns true if this QSourceLocation doesn't identify anything. More... | |
qint64 | line () const |
Returns the current line number. More... | |
bool | operator!= (const QSourceLocation &other) const |
Returns the opposite of applying operator==() for this QXmlName and other. More... | |
QSourceLocation & | operator= (const QSourceLocation &other) |
Assigns this QSourceLocation instance to other. More... | |
bool | operator== (const QSourceLocation &other) const |
Returns true if this QSourceLocation is identical to other. More... | |
QSourceLocation () | |
Construct a QSourceLocation that doesn't identify anything at all. More... | |
QSourceLocation (const QSourceLocation &other) | |
Constructs a QSourceLocation that is a copy of other. More... | |
QSourceLocation (const QUrl &uri, int line=-1, int column=-1) | |
Constructs a QSourceLocation with URI u, line l and column c. More... | |
void | setColumn (qint64 newColumn) |
Sets the column number to newColumn. More... | |
void | setLine (qint64 newLine) |
Sets the line number to newLine. More... | |
void | setUri (const QUrl &newUri) |
Sets the URI to newUri. More... | |
QUrl | uri () const |
Returns the resource that this QSourceLocation refers to. More... | |
~QSourceLocation () | |
Destructor. More... | |
Properties | |
union { | |
qint64 m_line | |
QSourceLocationPrivate * m_ptr | |
}; | |
qint64 | m_column |
QUrl | m_uri |
Related Functions | |
(Note that these are not member functions.) | |
QDebug | operator<< (QDebug debug, const QSourceLocation &sourceLocation) |
Prints sourceLocation to the debug stream debug. More... | |
uint | qHash (const QSourceLocation &location) |
The QSourceLocation class identifies a location in a resource by URI, line, and column.
QSourceLocation is a simple value based class that has three properties, uri(), line(), and column(), that, taken together, identify a certain point in a resource, e.g., a file or an in-memory document.
line() and column() refer to character counts (not byte counts), and they both start from 1, as opposed to 0.
Definition at line 56 of file qsourcelocation.h.
QSourceLocation::QSourceLocation | ( | ) |
Construct a QSourceLocation that doesn't identify anything at all.
For a default constructed QSourceLocation(), isNull() returns true
.
Definition at line 73 of file qsourcelocation.cpp.
QSourceLocation::QSourceLocation | ( | const QSourceLocation & | other | ) |
Constructs a QSourceLocation that is a copy of other.
Definition at line 80 of file qsourcelocation.cpp.
QSourceLocation::QSourceLocation | ( | const QUrl & | uri, |
int | line = -1 , |
||
int | column = -1 |
||
) |
Constructs a QSourceLocation with URI u, line l and column c.
Definition at line 88 of file qsourcelocation.cpp.
QSourceLocation::~QSourceLocation | ( | ) |
qint64 QSourceLocation::column | ( | ) | const |
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.
Definition at line 145 of file qsourcelocation.cpp.
Referenced by QPatternist::ColoringMessageHandler::handleMessage(), operator<<(), and qHash().
bool QSourceLocation::isNull | ( | ) | const |
Returns true
if this QSourceLocation doesn't identify anything.
For a default constructed QSourceLocation, this function returns true
. The same applies for any other QSourceLocation whose uri() is invalid.
Definition at line 227 of file qsourcelocation.cpp.
Referenced by QPatternist::GenericStaticContext::addLocation(), QPatternist::ColoringMessageHandler::handleMessage(), and QPatternist::ReportContext::lookupSourceLocation().
qint64 QSourceLocation::line | ( | ) | const |
Returns the current line number.
The first line number is 1, not 0. The default value is -1, indicating the line number is unknown.
Definition at line 165 of file qsourcelocation.cpp.
Referenced by QPatternist::ColoringMessageHandler::handleMessage(), operator<<(), and qHash().
bool QSourceLocation::operator!= | ( | const QSourceLocation & | other | ) | const |
Returns the opposite of applying operator==() for this QXmlName and other.
Definition at line 120 of file qsourcelocation.cpp.
QSourceLocation & QSourceLocation::operator= | ( | const QSourceLocation & | other | ) |
bool QSourceLocation::operator== | ( | const QSourceLocation & | other | ) | const |
Returns true if this QSourceLocation is identical to other.
Two QSourceLocation instances are equal if their uri(), line() and column() are equal.
QSourceLocation instances for which isNull() returns true are considered equal.
Definition at line 109 of file qsourcelocation.cpp.
Referenced by operator!=().
void QSourceLocation::setColumn | ( | qint64 | newColumn | ) |
Sets the column number to newColumn.
0 is an invalid column number. The first column number is 1.
Definition at line 154 of file qsourcelocation.cpp.
Referenced by QPatternist::XsdSchemaParser::currentSourceLocation(), QPatternist::XsdSchemaChecker::sourceLocation(), and QPatternist::XsdSchemaResolver::sourceLocation().
void QSourceLocation::setLine | ( | qint64 | newLine | ) |
Sets the line number to newLine.
0 is an invalid line number. The first line number is 1.
Definition at line 174 of file qsourcelocation.cpp.
Referenced by QPatternist::XsdSchemaParser::currentSourceLocation(), QPatternist::XsdSchemaChecker::sourceLocation(), and QPatternist::XsdSchemaResolver::sourceLocation().
void QSourceLocation::setUri | ( | const QUrl & | newUri | ) |
Sets the URI to newUri.
Definition at line 192 of file qsourcelocation.cpp.
Referenced by QPatternist::XsdSchemaParser::currentSourceLocation(), QPatternist::XsdSchemaChecker::sourceLocation(), and QPatternist::XsdSchemaResolver::sourceLocation().
QUrl QSourceLocation::uri | ( | ) | const |
Returns the resource that this QSourceLocation refers to.
For example, the resource could be a file in the local file system, if the URI scheme is file
.
Definition at line 184 of file qsourcelocation.cpp.
Referenced by QPatternist::ColoringMessageHandler::handleMessage(), operator<<(), and qHash().
|
related |
Prints sourceLocation to the debug stream debug.
Definition at line 207 of file qsourcelocation.cpp.
|
related |
Computes a hash key for the QSourceLocation location.
Definition at line 239 of file qsourcelocation.cpp.
union { ... } |
|
private |
Definition at line 83 of file qsourcelocation.h.
Referenced by column(), operator=(), operator==(), and setColumn().
qint64 QSourceLocation::m_line |
Definition at line 80 of file qsourcelocation.h.
Referenced by line(), operator=(), operator==(), and setLine().
QSourceLocationPrivate* QSourceLocation::m_ptr |
Definition at line 81 of file qsourcelocation.h.
|
private |
Definition at line 84 of file qsourcelocation.h.
Referenced by isNull(), operator=(), operator==(), setUri(), and uri().