[nemiver] Add more comments to nmv-range.h
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Add more comments to nmv-range.h
- Date: Mon, 6 Sep 2010 19:53:06 +0000 (UTC)
commit 46445c5376cb5ea8c500b3a904f08df43e50704f
Author: Dodji Seketeli <dodji redhat com>
Date: Sun Sep 5 18:12:12 2010 +0200
Add more comments to nmv-range.h
* src/common/nmv-range.h: Add comments.
src/common/nmv-range.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/common/nmv-range.h b/src/common/nmv-range.h
index aef1512..04de42f 100644
--- a/src/common/nmv-range.h
+++ b/src/common/nmv-range.h
@@ -31,6 +31,7 @@
NEMIVER_BEGIN_NAMESPACE (nemiver)
NEMIVER_BEGIN_NAMESPACE (common)
+/// This abstracts a range of integer values.
class Range {
size_t m_min;
size_t m_max;
@@ -69,14 +70,25 @@ public:
{
}
+ /// Accessors of the lower bound of the range.
size_t min () const {return m_min;}
void min (size_t a) {m_min = a;}
+
+ /// Accessors of the upper bound of the range.
size_t max () const {return m_max;}
void max (size_t a) {m_max = a;}
+
+ /// Returns true if a_value is within the range.
bool contains (size_t a_value) const
{
return (a_value >= m_min && a_value <= m_max);
}
+
+ /// Extends the range. If a_value is greater than the upper bound
+ /// of the range, then the range becomes [lower-bound, a_value].
+ /// If a_value is less than the lower bound of the range, then the
+ /// range becomes [a_value, upper-bound]. If a_value is within the
+ /// range, nothing happens.
void extend (size_t a_value)
{
if (!contains (a_value)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]