Latest available version: IDA and decompilers v8.4.240215 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon

An ordered set of non-overlapping address ranges. More...

#include <range.hpp>

Public Types

typedef rangevec_t::iterator iterator
 Iterator for rangesets.
 
typedef rangevec_t::const_iterator const_iterator
 Const iterator for rangesets.
 

Public Member Functions

 rangeset_t (void)
 Constructor.
 
 rangeset_t (const range_t &range)
 Constructor - Initialize set with 'range'.
 
 rangeset_t (const rangeset_t &ivs)
 Constructor - Initialize set with 'ivs'.
 
rangeset_toperator= (const rangeset_t &ivs)
 
void swap (rangeset_t &r)
 Set this = 'r' and 'r' = this. See qvector::swap()
 
bool add (const range_t &range)
 Add an address range to the set. More...
 
bool add (ea_t start, ea_t _end)
 Create a new range_t from 'start' and 'end' and add it to the set.
 
bool add (const rangeset_t &aset)
 Add each element of 'aset' to the set. More...
 
bool sub (const range_t &range)
 Subtract an address range from the set. More...
 
bool sub (ea_t ea)
 Subtract an ea (an range of size 1) from the set. See sub(const range_t &)
 
bool sub (const rangeset_t &aset)
 Subtract each range in 'aset' from the set. More...
 
bool has_common (const range_t &range) const
 Is there an ea in 'range' that is also in the rangeset?
 
bool includes (const range_t &range) const
 Is every ea in 'range' contained in the rangeset?
 
size_t print (char *buf, size_t bufsize) const
 Print each range_t in the rangeset.
 
asize_t count (void) const
 Size in bytes.
 
const range_tgetrange (int idx) const
 Get the range_t at index 'idx'.
 
const range_tlastrange (void) const
 Get the last range_t in the set.
 
size_t nranges (void) const
 Get the number of range_t elements in the set.
 
bool empty (void) const
 Does the set have zero elements.
 
void clear (void)
 Delete all elements from the set. See qvector::clear()
 
bool has_common (const rangeset_t &aset) const
 Does any element of 'aset' overlap with an element in this rangeset?. See range_t::overlaps()
 
bool contains (ea_t ea) const
 Does an element of the rangeset contain 'ea'? See range_t::contains(ea_t)
 
bool contains (const rangeset_t &aset) const
 Is every element in 'aset' contained in an element of this rangeset?. See range_t::contains(range_t)
 
bool intersect (const rangeset_t &aset)
 Set the rangeset to its intersection with 'aset'. More...
 
bool is_subset_of (const rangeset_t &aset) const
 Is every element in the rangeset contained in an element of 'aset'?
 
bool is_equal (const rangeset_t &aset) const
 Do this rangeset and 'aset' have identical elements?
 
bool operator== (const rangeset_t &aset) const
 Compare two rangesets with '=='.
 
bool operator!= (const rangeset_t &aset) const
 Compare two rangesets with '!='.
 
const_iterator begin (void) const
 Get an iterator that points to the first element in the set.
 
const_iterator end (void) const
 Get an iterator that points to the end of the set. (This is NOT the last element)
 
iterator begin (void)
 Get an iterator that points to the first element in the set. More...
 
iterator end (void)
 Get an iterator that points to the end of the set. (This is NOT the last element) More...
 
const_iterator lower_bound (ea_t ea) const
 Get the first range that contains at least one ea_t value greater than 'ea'.
 
const_iterator upper_bound (ea_t ea) const
 Get the first range such that every ea_t value in this range is strictly greater than 'ea'.
 
const range_tfind_range (ea_t ea) const
 Get the element from the set that contains 'ea'. More...
 
const range_tcached_range (void) const
 When searching the rangeset, we keep a cached element to help speed up searches. More...
 
ea_t next_addr (ea_t ea) const
 Get the smallest ea_t value greater than 'ea' contained in the rangeset.
 
ea_t prev_addr (ea_t ea) const
 Get the largest ea_t value less than 'ea' contained in the rangeset.
 
ea_t next_range (ea_t ea) const
 Get the smallest ea_t value greater than 'ea' that is not in the same range as 'ea'.
 
ea_t prev_range (ea_t ea) const
 Get the largest ea_t value less than 'ea' that is not in the same range as 'ea'.
 
int move_chunk (ea_t from, ea_t to, asize_t size)
 Subtract the address range (from, from+size) and add the range (to, to+size)
 
int check_move_args (ea_t from, ea_t to, asize_t size)
 Check if the intended move_chunk() arguments are correct.
 

Detailed Description

An ordered set of non-overlapping address ranges.

Member Function Documentation

◆ add() [1/2]

bool rangeset_t::add ( const range_t range)
inline

Add an address range to the set.

If 'range' intersects an existing element e, then e is extended to include 'range', and any superfluous elements (subsets of e) are removed.

Parameters
rangeaddress range to add. cannot be empty
Returns
false if 'range' was not added (the set was unchanged)

◆ add() [2/2]

bool rangeset_t::add ( const rangeset_t aset)
inline

Add each element of 'aset' to the set.

Returns
false if no elements were added (the set was unchanged)

◆ sub() [1/2]

bool rangeset_t::sub ( const range_t range)
inline

Subtract an address range from the set.

All subsets of 'range' will be removed, and all elements that intersect 'range' will be truncated/split so they do not include 'range'.

Parameters
rangeaddress range to subtract. cannot be empty.
Returns
false if 'range' was not subtracted (the set was unchanged)

◆ sub() [2/2]

bool rangeset_t::sub ( const rangeset_t aset)
inline

Subtract each range in 'aset' from the set.

Returns
false if nothing was subtracted (the set was unchanged)

◆ intersect()

bool rangeset_t::intersect ( const rangeset_t aset)
inline

Set the rangeset to its intersection with 'aset'.

Returns
false if the set was unchanged

◆ begin()

iterator rangeset_t::begin ( void  )
inline

Get an iterator that points to the first element in the set.

◆ end()

iterator rangeset_t::end ( void  )
inline

Get an iterator that points to the end of the set. (This is NOT the last element)

◆ find_range()

const range_t * rangeset_t::find_range ( ea_t  ea) const
inline

Get the element from the set that contains 'ea'.

Returns
nullptr if there is no such element

◆ cached_range()

const range_t * rangeset_t::cached_range ( void  ) const
inline

When searching the rangeset, we keep a cached element to help speed up searches.

Returns
a pointer to the cached element

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