IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QSourceLocation Class

The QSourceLocation class identifies a location in a resource by URI, line, and column.

This class was introduced in Qt 4.4.

All functions in this class are reentrant.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QSourceLocation Class

  • Header: QSourceLocation

  • Since: Qt 4.4

  • qmake: QT += xmlpatterns

  • Group: QSourceLocation is part of xml-tools

Detailed Description

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.

Member Function Documentation

 

QSourceLocation::QSourceLocation()

Construct a QSourceLocation that doesn't identify anything at all.

For a default constructed QSourceLocation(), isNull() returns true.

QSourceLocation::QSourceLocation(const QUrl &u, int l = -1, int c = -1)

Constructs a QSourceLocation with URI u, line l and column c.

QSourceLocation::QSourceLocation(const QSourceLocation &other)

Constructs a QSourceLocation that is a copy of other.

QSourceLocation::~QSourceLocation()

Destructor.

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.

See Also

See also setColumn()

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.

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.

See Also

See also setLine()

void QSourceLocation::setColumn(qint64 newColumn)

Sets the column number to newColumn. 0 is an invalid column number. The first column number is 1.

See Also

See also column()

void QSourceLocation::setLine(qint64 newLine)

Sets the line number to newLine. 0 is an invalid line number. The first line number is 1.

See Also

See also line()

void QSourceLocation::setUri(const QUrl &newUri)

Sets the URI to newUri.

See Also

See also uri()

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.

See Also

See also setUri()

bool QSourceLocation::operator!=(const QSourceLocation &other) const

Returns true if this QSourceLocation is not equal to other; false otherwise.

QSourceLocation &QSourceLocation::operator=(const QSourceLocation &other)

Assigns this QSourceLocation instance to other.

bool QSourceLocation::operator==(const QSourceLocation &other) const

Returns true if this QSourceLocation is equal to other; false otherwise.

Two QSourceLocation instances are equal if their uri(), line() and column() are equal.

QSourceLocation instances for which isNull() returns true are considered equal.

Related Non-Members

 

[since 4.4] uint qHash(const QSourceLocation &location)

Computes a hash key for the QSourceLocation location.

This function was introduced in Qt 4.4.

[since 4.4] QDebug operator<<(QDebug debug, const QSourceLocation &sourceLocation)

Prints sourceLocation to the debug stream debug.

This function was introduced in Qt 4.4.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+