Views
Gadgets Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvCodeEditor::Location Class Reference

The position of a logical character in the text managed by an IlvCodeEditor. More...

#include <ilviews/gadgets/codeedit.h>

Public Member Functions

 Location (IlInt line=-1, IlInt column=-1)
 Constructor. More...
 
IlInt getColumn () const
 Returns the value of the column of this location. More...
 
IlInt getLine () const
 Returns the value of the line of this location. More...
 
IlBoolean isDefault () const
 Tells if the location is set to default values. More...
 
IlBoolean operator!= (const Location &source) const
 Are the two locations different. More...
 
IlBoolean operator< (const Location &other) const
 Checks if this location is strictly before another one. More...
 
IlBoolean operator<= (const Location &other) const
 Checks if this location is before another one. More...
 
IlBoolean operator== (const Location &source) const
 Are the two locations identical. More...
 
IlBoolean operator> (const Location &other) const
 Checks if this location is strictly after another one. More...
 
IlBoolean operator>= (const Location &other) const
 Checks if this location is after another one. More...
 
void set (const Location &source)
 Copies a location. More...
 
void set (IlInt line, IlInt column)
 Assigns the line and column values. More...
 
void setColumn (IlInt col)
 Sets the value of the column for this location. More...
 
void setLine (IlInt line)
 Sets the value of the line for this location. More...
 

Detailed Description

The position of a logical character in the text managed by an IlvCodeEditor.

Library: ilvadvgagt

This class allows locating characters in a text that can contain up to MAX_INT * MAX_INT characters. The line and column values are signed; the negative -1 values are used to note incorrect line, column, or location altogether.

The valid numbering of lines and columns in locations starts from (0, 0).

Constructor & Destructor Documentation

◆ Location()

IlvCodeEditor::Location::Location ( IlInt  line = -1,
IlInt  column = -1 
)

Constructor.

By default, when no values are given for line and column, the location is invalid. That is a call to isDefault() will return IlTrue.

Member Function Documentation

◆ getColumn()

IlInt IlvCodeEditor::Location::getColumn ( ) const

Returns the value of the column of this location.

Returns
The column of this location.

◆ getLine()

IlInt IlvCodeEditor::Location::getLine ( ) const

Returns the value of the line of this location.

Returns
The line of this location.

◆ isDefault()

IlBoolean IlvCodeEditor::Location::isDefault ( ) const

Tells if the location is set to default values.

Returns
IlTrue if both the line and the column numbers are set to -1; IlFalse otherwise.

◆ operator!=()

IlBoolean IlvCodeEditor::Location::operator!= ( const Location source) const

Are the two locations different.

Locations are different if they are not identical.

Returns
IlTrue if the locations are different, IlFalse otherwise.

◆ operator<()

IlBoolean IlvCodeEditor::Location::operator< ( const Location other) const

Checks if this location is strictly before another one.

Returns
IlTrue if this location is strictly smaller than other; IlFalse otherwise.
Parameters
otherthe location to compare to.

A location is strictly smaller than another if it is not greater.

◆ operator<=()

IlBoolean IlvCodeEditor::Location::operator<= ( const Location other) const

Checks if this location is before another one.

Parameters
otherthe location to compare to.
Returns
IlTrue if this location is smaller than other; IlFalse otherwise.

A location is smaller than another if its line is smaller than the other one, or the lines are the same but its column is smaller.

◆ operator==()

IlBoolean IlvCodeEditor::Location::operator== ( const Location source) const

Are the two locations identical.

Locations are identical if the line and column values are identical.

Returns
IlTrue if the locations are identical; IlFalse otherwise.

◆ operator>()

IlBoolean IlvCodeEditor::Location::operator> ( const Location other) const

Checks if this location is strictly after another one.

A location is strictly greater than another if it is not smaller.

Parameters
otherthe location to compare to.
Returns
IlTrue if this location is strictly greater than other; IlFalse otherwise.

◆ operator>=()

IlBoolean IlvCodeEditor::Location::operator>= ( const Location other) const

Checks if this location is after another one.

Parameters
otherthe location to compare to.
Returns
IlTrue if this location is greater than other; IlFalse otherwise.

A location is greater to another if its line is greater than the other one, or the lines are the same but its column is greater.

◆ set() [1/2]

void IlvCodeEditor::Location::set ( const Location source)

Copies a location.

No check is made to verify the validity of the argument.

Parameters
sourceThe location to copy.

◆ set() [2/2]

void IlvCodeEditor::Location::set ( IlInt  line,
IlInt  column 
)

Assigns the line and column values.

Parameters
lineThe new line number.
columnThe new column number.

If line or column is strictly negative, the set value is -1, making the location at least partially invalid.

◆ setColumn()

void IlvCodeEditor::Location::setColumn ( IlInt  col)

Sets the value of the column for this location.

If the given value is negative, the column number will be changed to -1.

Parameters
colThe new column number for this location.

◆ setLine()

void IlvCodeEditor::Location::setLine ( IlInt  line)

Sets the value of the line for this location.

If the given value is negative, the line number will be changed to -1.

Parameters
lineThe new line number for this location.