Ghidra Decompiler Analysis Engine
Public Member Functions | Friends | List of all members
Range Class Reference

A contiguous range of bytes in some address space. More...

#include <address.hh>

Public Member Functions

 Range (AddrSpace *s, uintb f, uintb l)
 Construct a Range from offsets. More...
 
Address getLastAddrOpen (const AddrSpaceManager *manage) const
 Get address of first byte after this. More...
 
bool contains (const Address &addr) const
 Determine if the address is in this Range. More...
 
bool operator< (const Range &op2) const
 Sorting operator for Ranges. More...
 
void printBounds (ostream &s) const
 Print this Range to a stream. More...
 
void saveXml (ostream &s) const
 Save this Range to an XML stream. More...
 
void restoreXml (const Element *el, const AddrSpaceManager *manage)
 Restore this from XML stream. More...
 

Friends

class RangeList
 

Detailed Description

A contiguous range of bytes in some address space.

Constructor & Destructor Documentation

◆ Range()

Range::Range ( AddrSpace s,
uintb  f,
uintb  l 
)
inline

Construct a Range from offsets.

Offsets must expressed in bytes as opposed to addressable words

Parameters
sis the address space containing the range
fis the offset of the first byte in the range
lis the offset of the last byte in the range

Member Function Documentation

◆ contains()

bool Range::contains ( const Address addr) const
inline

Determine if the address is in this Range.

Parameters
addris the Address to test for containment
Returns
true if addr is in this Range

◆ getLastAddrOpen()

Address Range::getLastAddrOpen ( const AddrSpaceManager manage) const

Get address of first byte after this.

Get the last address +1, updating the space, or returning the extremal address if necessary

Parameters
manageis used to fetch the next address space

◆ operator<()

bool Range::operator< ( const Range op2) const
inline

Sorting operator for Ranges.

Compare based on address space, then the starting offset

Parameters
op2is the Range to compare with this
Returns
true if this comes before op2

◆ printBounds()

void Range::printBounds ( ostream &  s) const

Print this Range to a stream.

Output a description of this Range like: ram: 7f-9c

Parameters
sis the output stream

◆ restoreXml()

void Range::restoreXml ( const Element el,
const AddrSpaceManager manage 
)

Restore this from XML stream.

Reconstruct this object from an XML <range> element

Parameters
elis the XML element
manageis the space manage for recovering AddrSpace objects

◆ saveXml()

void Range::saveXml ( ostream &  s) const

Save this Range to an XML stream.

Write this object to a stream as a <range> tag.

Parameters
sis the output stream

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