A character position inside a text/string that is being evaluated. More...
#include <elamvalue.h>
Public Member Functions | |
Position (const QPair< int, int > &p) | |
converts a pair of ints to a position | |
Position (const QPoint &p) | |
converts a QPoint to a position - x is interpreted as column, y as line | |
Position (int line, int col) | |
instantiates a position from line and column | |
Position (int col) | |
instantiates a position from column only, line is assumed to be "1" | |
Position () | |
instantiates an invalid position | |
Position (const Position &p) | |
copy constructor | |
Position & | operator= (const Position &p) |
copies a position | |
int | line () const |
returns the line of this position or -1 if the position is invalid | |
int | column () const |
returns the column of this position or -1 if the position is invalid | |
bool | isValid () const |
true if this position is valid | |
operator QPair< int, int > () const | |
transparently converts to a pair of ints | |
operator QPoint () const | |
transparently converts to a QPoint, with x=column and y=line | |
operator QString () const | |
converts to a human readable QString |
A character position inside a text/string that is being evaluated.
A position consists of line and column. The top left position in a text is assumed to be line 1 column 1. Any position with line and/or column less than zero is considered invalid.
This class is completely inline and as such should be quite fast.
ELAM::Position::Position | ( | const QPair< int, int > & | p | ) | [inline] |
converts a pair of ints to a position
ELAM::Position::Position | ( | const QPoint & | p | ) | [inline] |
converts a QPoint to a position - x is interpreted as column, y as line
ELAM::Position::Position | ( | int | line, | |
int | col | |||
) | [inline] |
instantiates a position from line and column
ELAM::Position::Position | ( | int | col | ) | [inline] |
instantiates a position from column only, line is assumed to be "1"
ELAM::Position::Position | ( | ) | [inline] |
instantiates an invalid position
ELAM::Position::Position | ( | const Position & | p | ) | [inline] |
copy constructor
int ELAM::Position::column | ( | ) | const [inline] |
returns the column of this position or -1 if the position is invalid
bool ELAM::Position::isValid | ( | ) | const [inline] |
true if this position is valid
int ELAM::Position::line | ( | ) | const [inline] |
returns the line of this position or -1 if the position is invalid
ELAM::Position::operator QPair< int, int > | ( | ) | const [inline] |
transparently converts to a pair of ints
ELAM::Position::operator QPoint | ( | ) | const [inline] |
transparently converts to a QPoint, with x=column and y=line
ELAM::Position::operator QString | ( | ) | const [inline, explicit] |
converts to a human readable QString