Crashpad

Ensures that a range, composed of a base and size, does not overflow its data type. More...
#include "util/numeric/checked_range.h"
Public Member Functions  
CheckedRange (ValueType base, SizeType size)  
void  SetRange (ValueType base, SizeType size) 
Sets the range’s base and size to base and size, respectively.  
ValueType  base () const 
The range’s base.  
SizeType  size () const 
The range’s size.  
ValueType  end () const 
The range’s end (its base plus its size).  
bool  IsValid () const 
Returns the validity of the range. More...  
bool  ContainsValue (ValueType value) const 
Returns whether the range contains another value. More...  
bool  ContainsRange (const CheckedRange< ValueType, SizeType > &that) const 
Returns whether the range contains another range. More...  
bool  OverlapsRange (const CheckedRange< ValueType, SizeType > &that) const 
Returns whether the range overlaps another range. More...  
bool  operator< (const CheckedRange &other) const 
Ensures that a range, composed of a base and size, does not overflow its data type.

inline 
Returns whether the range contains another range.
[in]  that  The (possibly) contained range. 
true
if this
range, the containing range, contains that, the contained range. false
otherwise.A range contains another range when the contained range’s base is greater than or equal to the containing range’s base, and the contained range’s end is less than or equal to the containing range’s end.
This method must only be called if IsValid() would return true
for both CheckedRange objects involved.

inline 
Returns whether the range contains another value.
[in]  value  The (possibly) contained value. 
true
if the range contains value, false
otherwise.A range contains a value if the value is greater than or equal to its base, and less than its end (base plus size).
This method must only be called if IsValid() would return true
.

inline 
Returns the validity of the range.
true
if the range is valid, false
otherwise.A range is valid if its size can be converted to the range’s data type without data loss, and if its end (base plus size) can be computed without overflowing its data type.

inline 
Returns whether the range overlaps another range.
[in]  that  The (possibly) overlapping range. 
true
if this
range, the first range, overlaps that, the provided range. false
otherwise.Ranges are considered to be closedopen [base, end) for this test. Zero length ranges are never considered to overlap another range.
This method must only be called if IsValid() would return true
for both CheckedRange objects involved.