comma::Location Class Reference

Provides a light-weight indicator of a position in source code. More...

#include <Location.h>

List of all members.

Public Member Functions

 Location ()
 Constructs an invalid Location object.
 Location (unsigned offset)
 Constructs a Location with the given offset.
bool isInvalid () const
 Returns true if this Location is invalid.
bool isValid () const
 Returns true if this Location is valid.
unsigned getOffset () const
 Returns the offset associated with this Location.
 operator unsigned () const
 Converts this Location to an unsigned integer.

Detailed Description

Provides a light-weight indicator of a position in source code.

Location objects are designed to be used in tandem with a particular instance of a TextProvider. They function simply as a key which a TextProvider can interpret to provide line and column information. More precisely, Locations are associated with a raw unsigned value known as its offset (since a TextProvider uses it as an index into internal tables to determine its associated line/column info). An offset of zero is reserved to indicate an invalid or non-existent location.

Location objects are typically created via a call to TextProvider::getLocation.

See also:
SourceLocation
TextProvider

Definition at line 34 of file Location.h.


Constructor & Destructor Documentation

comma::Location::Location (  )  [inline]

Constructs an invalid Location object.

Definition at line 38 of file Location.h.

comma::Location::Location ( unsigned  offset  )  [inline]

Constructs a Location with the given offset.

Definition at line 41 of file Location.h.


Member Function Documentation

unsigned comma::Location::getOffset (  )  const [inline]

Returns the offset associated with this Location.

Definition at line 53 of file Location.h.

bool comma::Location::isInvalid (  )  const [inline]

Returns true if this Location is invalid.

An invalid location does not correspond to any position in a source file).

Definition at line 47 of file Location.h.

bool comma::Location::isValid (  )  const [inline]

Returns true if this Location is valid.

Definition at line 50 of file Location.h.

comma::Location::operator unsigned (  )  const [inline]

Converts this Location to an unsigned integer.

Definition at line 56 of file Location.h.


The documentation for this class was generated from the following file:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1