lestes::lang::cplus::lex::simple_location Class Reference

Simple token location. More...

#include <simple_location.hh>

Inheritance diagram for lestes::lang::cplus::lex::simple_location:

lestes::std::object lestes::std::mem::keystone List of all members.

Public Member Functions

ulint line_get (void) const
 Returns line in file.
ulint column_get (void) const
 Returns column on line.
bool equals (const ptr< simple_location > &rhs) const
 Tests equality.

Static Public Member Functions

static ptr< simple_locationcreate (ulint a_line, ulint a_column)
 Returns new object, initializes with position.

Protected Member Functions

 simple_location (ulint a_line, ulint a_column)
 Creates new object, initializes with postion.

Private Member Functions

 simple_location (const simple_location &)
 Hides copy constructor.
simple_locationoperator= (const simple_location &)
 Hides assigment operator.

Private Attributes

ulint line
 Line in file.
ulint column
 Column inside the line.

Detailed Description

Simple token location.

Contains line number and column number. The object is inmutable to help keeping invariants.

Definition at line 49 of file simple_location.hh.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::simple_location::simple_location ( ulint  a_line,
ulint  a_column 
) [protected]

Creates new object, initializes with postion.

Creates new object, initializes with file information and position.

Parameters:
a_line The line number.
a_column The column on the line.

Definition at line 50 of file simple_location.cc.

Referenced by create().

00050                                                             :
00051         line(a_line),
00052         column(a_column)
00053 {
00054 }

lestes::lang::cplus::lex::simple_location::simple_location ( const simple_location  )  [private]

Hides copy constructor.


Member Function Documentation

ulint lestes::lang::cplus::lex::simple_location::line_get ( void   )  const

Returns line in file.

Returns position in the file.

Returns:
The line number.

Definition at line 60 of file simple_location.cc.

References line.

00061 {
00062         return line;
00063 }

ulint lestes::lang::cplus::lex::simple_location::column_get ( void   )  const

Returns column on line.

Returns position on the line.

Returns:
The column number.

Definition at line 69 of file simple_location.cc.

References column.

00070 {
00071         return column;
00072 }

bool lestes::lang::cplus::lex::simple_location::equals ( const ptr< simple_location > &  rhs  )  const

Tests equality.

Tests equality to other simple_location.

Parameters:
rhs The location to compare to.

Definition at line 78 of file simple_location.cc.

References column, lestes::is_equal(), and line.

00079 {
00080         return rhs &&
00081           is_equal(line,rhs->line_get()) &&
00082           is_equal(column,rhs->column_get());
00083 }

ptr< simple_location > lestes::lang::cplus::lex::simple_location::create ( ulint  a_line,
ulint  a_column 
) [static]

Returns new object, initializes with position.

Returns new instance, initializes with position.

Parameters:
a_line The line number.
a_column The column on the line.

Definition at line 90 of file simple_location.cc.

References simple_location().

Referenced by lestes::lang::cplus::lex::line_numbers::read().

00091 {
00092         return new simple_location(a_line,a_column);
00093 }

simple_location& lestes::lang::cplus::lex::simple_location::operator= ( const simple_location  )  [private]

Hides assigment operator.


Member Data Documentation

ulint lestes::lang::cplus::lex::simple_location::line [private]

Line in file.

Definition at line 64 of file simple_location.hh.

Referenced by equals(), and line_get().

ulint lestes::lang::cplus::lex::simple_location::column [private]

Column inside the line.

Definition at line 66 of file simple_location.hh.

Referenced by column_get(), and equals().


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:24:19 2007 for lestes by doxygen 1.5.1-20070107