]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Utility/Range.h
MFV r337029:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Utility / Range.h
1 //===--------------------- Range.h ------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef utility_Range_h_
11 #define utility_Range_h_
12
13 #include <stdint.h>
14
15 namespace lldb_utility {
16
17 class Range {
18 public:
19   typedef uint64_t ValueType;
20
21   static const ValueType OPEN_END = UINT64_MAX;
22
23   Range(const Range &rng);
24
25   Range(ValueType low = 0, ValueType high = OPEN_END);
26
27   Range &operator=(const Range &rhs);
28
29   ValueType GetLow() { return m_low; }
30
31   ValueType GetHigh() { return m_high; }
32
33   void SetLow(ValueType low) { m_low = low; }
34
35   void SetHigh(ValueType high) { m_high = high; }
36
37   void Flip();
38
39   void Intersection(const Range &other);
40
41   void Union(const Range &other);
42
43   typedef bool (*RangeCallback)(ValueType index);
44
45   void Iterate(RangeCallback callback);
46
47   ValueType GetSize();
48
49   bool IsEmpty();
50
51 private:
52   void InitRange();
53
54   ValueType m_low;
55   ValueType m_high;
56 };
57
58 } // namespace lldb_private
59
60 #endif // #ifndef utility_Range_h_