Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SCLocationRange Struct Reference

This class implements source code location ranges. More...

#include <location.h>

Collaboration diagram for SCLocationRange:

Collaboration graph
[legend]
List of all members.

Public Types

enum  _NullRange { NullRange }

Public Member Functions

 SCLocationRange (_NullRange=NullRange)
 Create a NULL location range.

 SCLocationRange (const SCLocation &a, const SCLocation &b)
 Construct a location range from two locations, start and end.

 SCLocationRange (const SCLocationRange &r)
 Copy constructor works as usual.

 ~SCLocationRange ()
 Destructor is essentially a no-op.

SCLocationRangeoperator= (const SCLocationRange &r)
 Assignment operator works as usual.

SCLocationRangeoperator= (_NullRange)
 This can be used to assign a NULL range.

bool operator! () const
 Check for NULL loc. range (true if start and end are NULL locations).

 operator bool () const
 Check for NULL loc. range (false if start and end are NULL locations).

TLString RangeString (int with_files=1) const
 Return a string representation of this location range.

TLString RelString (const SCLocationRange &rloc) const
 Return a relative string representation of the location.

TLString RelString (const SCLocation &rloc) const
 Version of RelString() which takes a single SCLocation.


Public Attributes

SCLocation loc0
 start location

SCLocation loc1
 end location


Detailed Description

This class implements source code location ranges.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class is intended to be used during parsing with bottom-up parsers where the source code location of some subtree can be represented by a location range. A location range is a start and an end location and for a tree, the start (end) location is the start (end) location of the first (last) immediate child [recursive definition].

This class is as well leight-weight as it may be heavily used during parsing and may even be attached to tree nodes where a location range (compared to a single location) may help a lot. It has no virtual functions.

This class is "C++-safe", i.e. copy constructors and assignment are implemented properly.

Definition at line 133 of file location.h.


Member Enumeration Documentation

enum SCLocationRange::_NullRange
 

Enumeration values:
NullRange 

Definition at line 135 of file location.h.


Constructor & Destructor Documentation

SCLocationRange::SCLocationRange _NullRange  = NullRange  )  [inline]
 

Create a NULL location range.

Definition at line 141 of file location.h.

References loc0, and loc1.

SCLocationRange::SCLocationRange const SCLocation a,
const SCLocation b
[inline]
 

Construct a location range from two locations, start and end.

Definition at line 144 of file location.h.

References loc0, and loc1.

SCLocationRange::SCLocationRange const SCLocationRange r  )  [inline]
 

Copy constructor works as usual.

Definition at line 147 of file location.h.

References loc0, and loc1.

SCLocationRange::~SCLocationRange  )  [inline]
 

Destructor is essentially a no-op.

Definition at line 150 of file location.h.


Member Function Documentation

SCLocationRange::operator bool  )  const [inline]
 

Check for NULL loc. range (false if start and end are NULL locations).

Definition at line 163 of file location.h.

References loc0, and loc1.

bool SCLocationRange::operator!  )  const [inline]
 

Check for NULL loc. range (true if start and end are NULL locations).

Definition at line 160 of file location.h.

References loc0, and loc1.

SCLocationRange& SCLocationRange::operator= _NullRange   )  [inline]
 

This can be used to assign a NULL range.

Definition at line 156 of file location.h.

References loc0, and loc1.

SCLocationRange& SCLocationRange::operator= const SCLocationRange r  )  [inline]
 

Assignment operator works as usual.

Definition at line 153 of file location.h.

References loc0, and loc1.

TLString SCLocationRange::RangeString int  with_files = 1  )  const
 

Return a string representation of this location range.

Format the location into a string representation; include hierarchy dump for start location is only included if with_files>1. If with_files=0, only the location in the file but not the file is written; for 1, the file and the location in the file (but no include hierarchy) is emitted.

Definition at line 20 of file location.cc.

References loc0, loc1, and SCLocation::pos.

Referenced by MessageHandler_Console::HandleMessage(), and RelString().

TLString SCLocationRange::RelString const SCLocation rloc  )  const
 

Version of RelString() which takes a single SCLocation.

Definition at line 43 of file location.cc.

References loc0, loc1, SCLocation::pos, and RangeString().

TLString SCLocationRange::RelString const SCLocationRange rloc  )  const
 

Return a relative string representation of the location.

Returns a relative string representation; i.e. the location stored in *this is reported, relative to the passed one. "Relative" means that the file is left away if it is the same file.

Definition at line 30 of file location.cc.

References loc0, loc1, SCLocation::pos, and RangeString().


Member Data Documentation

SCLocation SCLocationRange::loc0
 

start location

Definition at line 137 of file location.h.

Referenced by Message::location(), operator bool(), operator!(), operator=(), RangeString(), RelString(), and SCLocationRange().

SCLocation SCLocationRange::loc1
 

end location

Definition at line 138 of file location.h.

Referenced by MessageHandler_Console::HandleMessage(), operator bool(), operator!(), operator=(), RangeString(), RelString(), and SCLocationRange().


The documentation for this struct was generated from the following files:
Generated on Sat Feb 19 22:35:37 2005 for Ray by doxygen 1.3.5