Public Member Functions

ELAM::Position Class Reference

A character position inside a text/string that is being evaluated. More...

#include <elamvalue.h>

List of all members.

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
Positionoperator= (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

Detailed Description

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.


Constructor & Destructor Documentation

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


Member Function Documentation

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

Position& ELAM::Position::operator= ( const Position p  )  [inline]

copies a position


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends