111#define RANGESET_HELPER_DEFINITIONS(decl) \
112decl bool ida_export rangeset_t_add(rangeset_t *, const range_t &range);\
113decl bool ida_export rangeset_t_sub(rangeset_t *, const range_t &range);\
114decl bool ida_export rangeset_t_add2(rangeset_t *, const rangeset_t &aset);\
115decl bool ida_export rangeset_t_sub2(rangeset_t *, const rangeset_t &aset);\
116decl bool ida_export rangeset_t_has_common(const rangeset_t *, const range_t &range, bool strict);\
117decl bool ida_export rangeset_t_has_common2(const rangeset_t *, const rangeset_t &aset);\
118decl bool ida_export rangeset_t_contains(const rangeset_t *, const rangeset_t &aset);\
119decl size_t ida_export rangeset_t_print(const rangeset_t *, char *buf, size_t bufsize);\
120decl bool ida_export rangeset_t_intersect(rangeset_t *, const rangeset_t &aset);\
121decl const range_t *ida_export rangeset_t_find_range(const rangeset_t *, ea_t ea);\
122decl ea_t ida_export rangeset_t_next_addr(const rangeset_t *, ea_t ea);\
123decl ea_t ida_export rangeset_t_prev_addr(const rangeset_t *, ea_t ea);\
124decl ea_t ida_export rangeset_t_next_range(const rangeset_t *, ea_t ea);\
125decl ea_t ida_export rangeset_t_prev_range(const rangeset_t *, ea_t ea);\
126decl rangevec_t::const_iterator ida_export rangeset_t_lower_bound(const rangeset_t *, ea_t ea);\
127decl rangevec_t::const_iterator ida_export rangeset_t_upper_bound(const rangeset_t *, ea_t ea);\
128decl void ida_export rangeset_t_swap(rangeset_t *, rangeset_t &r);
130#define RANGESET_HELPER_DEFINITIONS(decl)
145 bool verify(
void)
const;
147 DEFINE_MEMORY_ALLOCATION_FUNCS()
149 rangeset_t(
void) : cache(
nullptr) {}
153 rangeset_t(
const rangeset_t &ivs) : bag(ivs.bag), cache(
nullptr) {}
154 rangeset_t &operator=(
const rangeset_t &ivs) { bag = ivs.bag; cache =
nullptr;
return *
this; }
156 void swap(rangeset_t &r) { rangeset_t_swap(
this, r); }
163 bool add(
const range_t &range) {
return rangeset_t_add(
this, range); }
170 bool add(
const rangeset_t &aset) {
return rangeset_t_add2(
this, aset); }
177 bool sub(
const range_t &range) {
return rangeset_t_sub(
this, range); }
180 bool sub(
ea_t ea) {
return sub(
range_t(ea, ea+1)); }
184 bool sub(
const rangeset_t &aset) {
return rangeset_t_sub2(
this, aset); }
187 bool has_common(
const range_t &range)
const
188 {
return rangeset_t_has_common(
this, range,
false); }
191 bool includes(
const range_t &range)
const
192 {
return rangeset_t_has_common(
this, range,
true); }
195 size_t print(
char *buf,
size_t bufsize)
const
196 {
return rangeset_t_print(
this, buf,
bufsize); }
202 const range_t &getrange(
int idx)
const {
return bag[idx]; }
205 const range_t &lastrange(
void)
const {
return bag.
back(); }
208 size_t nranges(
void)
const {
return bag.
size(); }
211 bool empty(
void)
const {
return bag.
empty(); }
214 void clear(
void) { bag.
clear(); cache =
nullptr; }
217 bool has_common(
const rangeset_t &aset)
const
218 {
return rangeset_t_has_common2(
this, aset); }
221 bool contains(
ea_t ea)
const {
return !empty() && find_range(ea) !=
nullptr; }
224 bool contains(
const rangeset_t &aset)
const
225 {
return rangeset_t_contains(
this, aset); }
229 bool intersect(
const rangeset_t &aset)
230 {
return rangeset_t_intersect(
this, aset); }
233 bool is_subset_of(
const rangeset_t &aset)
const {
return aset.contains(*
this); }
236 bool is_equal(
const rangeset_t &aset)
const {
return bag == aset.bag; }
238 bool operator==(
const rangeset_t &aset)
const {
return is_equal(aset); }
239 bool operator!=(
const rangeset_t &aset)
const {
return !is_equal(aset); }
243 const_iterator begin(
void)
const {
return bag.
begin(); }
244 const_iterator
end(
void)
const {
return bag.
end(); }
245 iterator begin(
void) {
return bag.
begin(); }
246 iterator
end(
void) {
return bag.
end(); }
249 const_iterator lower_bound(
ea_t ea)
const {
return rangeset_t_lower_bound(
this, ea); }
252 const_iterator upper_bound(
ea_t ea)
const {
return rangeset_t_upper_bound(
this, ea); }
257 {
return rangeset_t_find_range(
this, ea); }
261 const range_t *cached_range(
void)
const {
return cache; }
270 ea_t next_range(
ea_t ea)
const {
return rangeset_t_next_range(
this, ea); }
273 ea_t prev_range(
ea_t ea)
const {
return rangeset_t_prev_range(
this, ea); }
idaman ea_t ida_export next_addr(ea_t ea)
Get next address in the program (i.e.
idaman ea_t ida_export prev_addr(ea_t ea)
Get previous address in the program.
Reimplementation of vector class from STL.
Definition pro.h:2250
void clear(void)
Destroy all elements and free memory.
Definition pro.h:2439
const range_t * const_iterator
Definition pro.h:2607
bool empty(void) const
Does the qvector have 0 elements?
Definition pro.h:2424
iterator end(void)
Get an iterator that points to the end of the qvector (NOT the last element)
Definition pro.h:2610
const T & back(void) const
Get the last element in the qvector.
Definition pro.h:2431
qvector(void)
Definition pro.h:2328
range_t * iterator
Definition pro.h:2606
iterator begin(void)
Get an iterator that points to the first element in the qvector.
Definition pro.h:2609
void push_back(T &&x)
Append a new element to the end the qvector with a move semantics.
Definition pro.h:2361
size_t size(void) const
Get the number of elements in the qvector.
Definition pro.h:2423
idaman const char * end
Definition pro.h:1001
idaman int64 size_t count
Definition kernwin.hpp:1366
asize_t size
Definition kernwin.hpp:6339
unsigned __int64 uint64
Definition llong.hpp:13
uint64 asize_t
Definition pro.h:423
uint64 ea_t
Definition pro.h:421
idaman size_t bufsize
Definition pro.h:600
qvector< range_t > rangevec_base_t
Definition range.hpp:91
range_kind_t
Definition range.hpp:101
@ RANGE_KIND_FUNC
func_t
Definition range.hpp:103
@ RANGE_KIND_SEGMENT
segment_t
Definition range.hpp:104
@ RANGE_KIND_UNKNOWN
Definition range.hpp:102
@ RANGE_KIND_HIDDEN_RANGE
hidden_range_t
Definition range.hpp:105
RANGESET_HELPER_DEFINITIONS(idaman) class rangeset_t
An ordered set of non-overlapping address ranges.
Definition range.hpp:135
qvector< const rangeset_t * > rangeset_crefvec_t
Definition range.hpp:287
qvector< rangeset_t > array_of_rangesets
Array of rangeset_t objects.
Definition range.hpp:286
DECLARE_TYPE_AS_MOVABLE(range_t)
idaman size_t ida_export range_t_print(const range_t *, char *buf, size_t bufsize)
Helper function. Should not be called directly!
uint64 end
Definition range.hpp:293
bool contains(uint64 x) const
Definition range.hpp:297
void clear()
Definition range.hpp:300
uint64 size() const
Definition range.hpp:302
bool overlaps(const range64_t &r) const
Definition range.hpp:299
bool empty() const
Definition range.hpp:301
range64_t(uint64 _start=0, uint64 _end=0)
Definition range.hpp:295
uint64 start
Definition range.hpp:292
void intersect(const range64_t &r)
Definition range.hpp:303
bool contains(const range64_t &r) const
Definition range.hpp:298
DECLARE_COMPARISONS(range64_t)
Definition range.hpp:296
void extend(uint64 ea)
Definition range.hpp:312
const range64_t * find_range(uint64 off) const
Definition range.hpp:324
Base class for an range.
Definition range.hpp:35
bool contains(const range_t &r) const
Is every ea in 'r' also in this range_t?
Definition range.hpp:51
bool empty() const
Is the size of the range_t <= 0?
Definition range.hpp:60
void extend(ea_t ea)
Ensure that the range_t includes 'ea'.
Definition range.hpp:77
ea_t end_ea
end_ea excluded
Definition range.hpp:38
size_t print(char *buf, size_t bufsize) const
Print the range_t.
Definition range.hpp:88
bool contains(ea_t ea) const
Is 'ea' in the address range?
Definition range.hpp:48
ea_t start_ea
start_ea included
Definition range.hpp:37
asize_t size() const
Get end_ea - start_ea.
Definition range.hpp:63
range_t(ea_t ea1=0, ea_t ea2=0)
Definition range.hpp:39
void intersect(const range_t &r)
Assign the range_t to the intersection between the range_t and 'r'.
Definition range.hpp:66
bool overlaps(const range_t &r) const
Is there an ea in 'r' that is also in this range_t?
Definition range.hpp:54
friend size_t ida_export range_t_print(const range_t *cb, char *buf, size_t bufsize)
Helper function. Should not be called directly!
void clear()
Set start_ea, end_ea to 0.
Definition range.hpp:57
DECLARE_COMPARISONS(range_t)
Compare two range_t instances, based on the start_ea.
Definition range.hpp:42
Vector of range_t instances.
Definition range.hpp:93