ROSE  0.11.96.11
Public Member Functions | List of all members
Rose::Location Class Referenceabstract

Description

Base class for location types.

A location is something that specifies a location for something else. For instance, a location might be part of a line in a source code file, or a memory address in a binary file.

All locations implement a common base API consisting of:

Definition at line 23 of file Location.h.

#include <Location.h>

Inheritance diagram for Rose::Location:
Inheritance graph
[legend]

Public Member Functions

virtual std::string toString () const =0
 Convert location to string. More...
 
virtual void print (std::ostream &) const =0
 Output location to a stream. More...
 
virtual std::string printableName () const =0
 Convert location to escaped, parsable string. More...
 
virtual bool operator< (const Location &) const =0
 
virtual bool operator<= (const Location &) const =0
 
virtual bool operator> (const Location &) const =0
 
virtual bool operator>= (const Location &) const =0
 
virtual bool isEqual (const Location &other) const =0
 Equality and inequality. More...
 
virtual bool operator== (const Location &other) const final
 Equality and inequality. More...
 
virtual bool operator!= (const Location &other) const final
 Equality and inequality. More...
 
virtual operator bool () const final
 Test whether this object is valid.
 
virtual bool isValid () const =0
 Test whether this object is valid.
 
virtual bool operator! () const final
 Test whether this object is empty. More...
 
virtual bool isEmpty () const final
 Test whether this object is empty. More...
 

Member Function Documentation

◆ toString()

virtual std::string Rose::Location::toString ( ) const
pure virtual

Convert location to string.

Returns a string representation of the location. This representation is not necessarily parsable.

See also, print.

Implemented in Rose::SourceLocation.

◆ print()

virtual void Rose::Location::print ( std::ostream &  ) const
pure virtual

Output location to a stream.

The format is the same as the toString method and is not necessarily parsable.

See also, toString.

Implemented in Rose::SourceLocation.

◆ printableName()

virtual std::string Rose::Location::printableName ( ) const
pure virtual

Convert location to escaped, parsable string.

Returns a string that can be safely emitted to a terminal. The format should also be parsable so the parse method can create an equal object from the string.

See also, parse.

Implemented in Rose::SourceLocation.

◆ isEqual()

virtual bool Rose::Location::isEqual ( const Location other) const
pure virtual

Equality and inequality.

Objects are equal if they are the same type and they point to the same location. Otherwise they are unequal.

The operator== is implemented in the base class only. For the expression a == b it calls both a.isEqual(b) and b.isEqual(a), returning true only if both tests return true. Subclasses should implement x.isEqual(y) by dynamic casting y to the type of x and returning true if and only if the cast succeeds and x and y point to the same location.

The operator!= is implemented in the base class as the complement of operator==.

Implemented in Rose::SourceLocation.

Referenced by operator==().

Here is the caller graph for this function:

◆ operator==()

virtual bool Rose::Location::operator== ( const Location other) const
inlinefinalvirtual

Equality and inequality.

Objects are equal if they are the same type and they point to the same location. Otherwise they are unequal.

The operator== is implemented in the base class only. For the expression a == b it calls both a.isEqual(b) and b.isEqual(a), returning true only if both tests return true. Subclasses should implement x.isEqual(y) by dynamic casting y to the type of x and returning true if and only if the cast succeeds and x and y point to the same location.

The operator!= is implemented in the base class as the complement of operator==.

Definition at line 65 of file Location.h.

References isEqual().

Here is the call graph for this function:

◆ operator!=()

virtual bool Rose::Location::operator!= ( const Location other) const
inlinefinalvirtual

Equality and inequality.

Objects are equal if they are the same type and they point to the same location. Otherwise they are unequal.

The operator== is implemented in the base class only. For the expression a == b it calls both a.isEqual(b) and b.isEqual(a), returning true only if both tests return true. Subclasses should implement x.isEqual(y) by dynamic casting y to the type of x and returning true if and only if the cast succeeds and x and y point to the same location.

The operator!= is implemented in the base class as the complement of operator==.

Definition at line 68 of file Location.h.

◆ operator!()

virtual bool Rose::Location::operator! ( ) const
inlinefinalvirtual

Test whether this object is empty.

A default constructed location is empty. Other objects are valid.

Definition at line 101 of file Location.h.

References isEmpty().

Here is the call graph for this function:

◆ isEmpty()

virtual bool Rose::Location::isEmpty ( ) const
inlinefinalvirtual

Test whether this object is empty.

A default constructed location is empty. Other objects are valid.

Definition at line 104 of file Location.h.

Referenced by operator!().

Here is the caller graph for this function:

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