ELAM
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
ELAM::Position Class Reference

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 More...
 
 Position (const QPoint &p)
 converts a QPoint to a position - x is interpreted as column, y as line More...
 
 Position (int line, int col)
 instantiates a position from line and column More...
 
 Position (int col)
 instantiates a position from column only, line is assumed to be "1" More...
 
 Position ()
 instantiates an invalid position More...
 
 Position (const Position &p)
 copy constructor More...
 
Positionoperator= (const Position &p)
 copies a position More...
 
int line () const
 returns the line of this position or -1 if the position is invalid More...
 
int column () const
 returns the column of this position or -1 if the position is invalid More...
 
bool isValid () const
 true if this position is valid More...
 
 operator QPair< int, int > () const
 transparently converts to a pair of ints More...
 
 operator QPoint () const
 transparently converts to a QPoint, with x=column and y=line More...
 
 operator QString () const
 converts to a human readable QString More...
 

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
inlineexplicit

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: