ROSE 0.11.145.147
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 <Rose/Location.h>

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

Public Member Functions

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

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::BinaryAnalysis::AbstractLocation, Rose::BinaryAnalysis::ConcreteLocation, and 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::BinaryAnalysis::AbstractLocation, Rose::BinaryAnalysis::ConcreteLocation, and 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 static parse method in subclasses can create an equal object from the string.

Implemented in Rose::BinaryAnalysis::AbstractLocation, Rose::BinaryAnalysis::ConcreteLocation, and 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::BinaryAnalysis::AbstractLocation, Rose::BinaryAnalysis::ConcreteLocation, and Rose::SourceLocation.

Referenced by operator==().

◆ 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 63 of file Location.h.

References isEqual().

◆ 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 66 of file Location.h.

◆ operator<()

virtual bool Rose::Location::operator< ( const Location ) const
pure virtual

Implemented in Rose::SourceLocation.

◆ operator<=()

virtual bool Rose::Location::operator<= ( const Location ) const
pure virtual

Implemented in Rose::SourceLocation.

◆ operator>()

virtual bool Rose::Location::operator> ( const Location ) const
pure virtual

Implemented in Rose::SourceLocation.

◆ operator>=()

virtual bool Rose::Location::operator>= ( const Location ) const
pure virtual

Implemented in Rose::SourceLocation.

◆ operator bool()

virtual Rose::Location::operator bool ( ) const
inlineexplicitfinalvirtual

Test whether this object is valid.

Definition at line 87 of file Location.h.

References isValid().

◆ isValid()

virtual bool Rose::Location::isValid ( ) const
pure virtual

Test whether this object is valid.

Implemented in Rose::BinaryAnalysis::AbstractLocation, Rose::BinaryAnalysis::ConcreteLocation, and Rose::SourceLocation.

Referenced by operator bool().

◆ 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 99 of file Location.h.

References isEmpty().

◆ 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 102 of file Location.h.

Referenced by operator!().


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