From d181c3bcd806ab1ff86bf04ef0311ebe8b8dbd2e Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Tue, 8 Jul 2008 11:32:24 +0000 Subject: [PATCH] [MERGE] libi2ncommon: (reinhard) added clear() method to Interval and Intervals. --- src/timefunc.cpp | 15 +++++++++++++++ src/timefunc.hxx | 4 ++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/timefunc.cpp b/src/timefunc.cpp index f54a11f..139862b 100644 --- a/src/timefunc.cpp +++ b/src/timefunc.cpp @@ -363,6 +363,16 @@ string get_month_name(unsigned char month) ** implementaion of Interval */ + +/** + * @brief clears the interval (make it empty). + */ +void Interval::clear() +{ + m_lower_bound = m_upper_bound = 0; +} // eo Interval::clear() + + /** * @brief tests if there is some overlapping with another interval * @param other the other interval @@ -404,6 +414,11 @@ Intervals::Intervals() } // eo Intervals::Intervals +void Intervals::clear() +{ + m_intervals.clear(); +} // eo Intervals::clear() + /** * @brief tests if one of the intervals of the list intersects with the given interval. * @param other the interval to check for intersection. diff --git a/src/timefunc.hxx b/src/timefunc.hxx index b4657b5..68fb538 100644 --- a/src/timefunc.hxx +++ b/src/timefunc.hxx @@ -92,6 +92,9 @@ class Interval { } // + + void clear(); + bool is_valid() const { return m_lower_bound <= m_upper_bound; @@ -171,6 +174,7 @@ class Intervals void add(const Interval& new_frame); void sub(const Interval& new_frame); + void clear(); const_iterator begin() const { return m_intervals.begin(); } const_iterator end() const { return m_intervals.end(); } -- 1.7.1