OLD | NEW |
---|---|
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 //! | 97 //! |
98 //! This method must only be called if IsValid() would return `true` for both | 98 //! This method must only be called if IsValid() would return `true` for both |
99 //! CheckedRange objects involved. | 99 //! CheckedRange objects involved. |
100 bool ContainsRange(const CheckedRange<ValueType, SizeType>& that) const { | 100 bool ContainsRange(const CheckedRange<ValueType, SizeType>& that) const { |
101 DCHECK(IsValid()); | 101 DCHECK(IsValid()); |
102 DCHECK(that.IsValid()); | 102 DCHECK(that.IsValid()); |
103 | 103 |
104 return that.base() >= base() && that.end() <= end(); | 104 return that.base() >= base() && that.end() <= end(); |
105 } | 105 } |
106 | 106 |
107 //! \brief Returns whether the range overlaps another range. | |
108 //! | |
109 //! \param[in] that The (possibly) overlapping range. | |
110 //! | |
111 //! \return `true` if `this` range, the first range, overlaps \a that, | |
112 //! the provided range. `false` otherwise. | |
113 //! | |
114 //! Ranges are considered to be open-closed [base, end) for this test. | |
Mark Mentovai
2015/10/01 17:38:58
Isn’t that closed-open?
scottmg
2015/10/01 18:10:02
Oops, done.
| |
115 //! | |
116 //! This method must only be called if IsValid() would return `true` for both | |
117 //! CheckedRange objects involved. | |
118 bool OverlapsRange(const CheckedRange<ValueType, SizeType>& that) const { | |
119 DCHECK(IsValid()); | |
120 DCHECK(that.IsValid()); | |
121 | |
122 return base() < that.end() && that.base() < end(); | |
123 } | |
124 | |
107 private: | 125 private: |
108 ValueType base_; | 126 ValueType base_; |
109 SizeType size_; | 127 SizeType size_; |
110 | |
111 DISALLOW_COPY_AND_ASSIGN(CheckedRange); | |
112 }; | 128 }; |
113 | 129 |
114 } // namespace crashpad | 130 } // namespace crashpad |
115 | 131 |
116 #endif // CRASHPAD_UTIL_NUMERIC_CHECKED_RANGE_H_ | 132 #endif // CRASHPAD_UTIL_NUMERIC_CHECKED_RANGE_H_ |
OLD | NEW |