From: Thomas Jarosch Date: Tue, 8 Jul 2008 11:43:40 +0000 (+0000) Subject: [MERGE] libi2ncommon: (reinhard) added contains_exact method to interval classes. X-Git-Tag: v2.6~163 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=e156de7c857e0762d9990b5a2ba936a5724c48f3;p=libi2ncommon [MERGE] libi2ncommon: (reinhard) added contains_exact method to interval classes. --- diff --git a/src/timefunc.cpp b/src/timefunc.cpp index a676a3f..26fe10a 100644 --- a/src/timefunc.cpp +++ b/src/timefunc.cpp @@ -648,6 +648,29 @@ bool Intervals::contains(const Interval& other) const /** + * @brief returns if we contain an exact interval. + * @param other the interval to check. + * @return @a true if we axactly contains the given interval. + * + * @note thsi differs from contain in the way, that we return only @a true + * iff we have the given interval in our list; not only cover it. + */ +bool Intervals::contains_exact(const Interval& other) const +{ + for(const_iterator it= begin(); + it != end(); + ++it) + { + if ( *it == other) + { + return true; + } + } + return false; +} // eo Intervals::contains_exact(const Interval&)const + + +/** * @brief returns if we contain another interval combination. * @param other the intervals to check. * @return @a true if we cover the given intervals, too. diff --git a/src/timefunc.hxx b/src/timefunc.hxx index 42b1275..c7b4e95 100644 --- a/src/timefunc.hxx +++ b/src/timefunc.hxx @@ -286,6 +286,8 @@ class Intervals bool contains(const Interval& other) const; bool contains(const Intervals& other) const; + bool contains_exact(const Interval& other) const; + bool operator==(const Intervals& other) const; bool operator!=(const Intervals& other) const { return not (*this == other) ; }