QSourceLocation Class Reference

[ QtXmlPatterns module]

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

方法

Special Methods


详细描述

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

QSourceLocation is a simple value based class that has three 特性, uri (), line (),和 column (), that, taken together, identify a certain point in a resource, e.g., a file or an in-memory document.

line () 和 column () refer to character counts (not byte counts), and they both start from 1, as opposed to 0.


方法文档编制

QSourceLocation.__init__ ( self )

构造 QSourceLocation that doesn't identify anything at all.

For a default constructed QSourceLocation(), isNull () 返回 true .

QSourceLocation.__init__ ( self , QSourceLocation   other )

构造 QSourceLocation that is a copy of other .

QSourceLocation.__init__ ( self , QUrl   u , int  line  = -1, int  column  = -1)

构造 QSourceLocation with URI u , line l and column c .

int QSourceLocation.column ( self )

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.

另请参阅 setColumn ().

bool QSourceLocation.isNull ( self )

返回 true 若此 QSourceLocation doesn't identify anything.

For a default constructed QSourceLocation ,此函数返回 true . The same applies for any other QSourceLocation whose uri () is invalid.

int QSourceLocation.line ( self )

Returns the current line number. The first line number is 1, not 0. The default value is -1, indicating the line number is unknown.

另请参阅 setLine ().

QSourceLocation.setColumn ( self , int  newColumn )

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

另请参阅 column ().

QSourceLocation.setLine ( self , int  newLine )

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

另请参阅 line ().

QSourceLocation.setUri ( self , QUrl   newUri )

Sets the URI to newUri .

另请参阅 uri ().

QUrl QSourceLocation.uri ( self )

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 .

另请参阅 setUri ().

bool QSourceLocation.__eq__ ( self , QSourceLocation   other )

int QSourceLocation.__hash__ ( self )

bool QSourceLocation.__ne__ ( self , QSourceLocation   other )