[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepimlibs/kcal
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2007-11-27 8:50:11
Message-ID: 1196153411.321664.15574.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 742137 by djarvie:

Add methods to multiply and divide by an integer.


 M  +12 -0     duration.cpp  
 M  +30 -0     duration.h  


--- trunk/KDE/kdepimlibs/kcal/duration.cpp #742136:742137
@@ -160,6 +160,18 @@
   return operator+=( -duration );
 }
 
+Duration &Duration::operator*=( int value )
+{
+  d->mDuration *= value;
+  return *this;
+}
+
+Duration &Duration::operator/=( int value )
+{
+  d->mDuration /= value;
+  return *this;
+}
+
 KDateTime Duration::end( const KDateTime &start ) const
 {
   return d->mDaily ? start.addDays( d->mDuration )
--- trunk/KDE/kdepimlibs/kcal/duration.h #742136:742137
@@ -214,6 +214,36 @@
     { return Duration( *this ) += other; }
 
     /**
+      Multiplies this duration by a value.
+      @param value value to multiply by
+    */
+    Duration &operator*=( int value );
+
+    /**
+      Multiplies a duration by a value.
+
+      @param value value to multiply by
+      @return resultant duration
+    */
+    Duration operator*( int value ) const
+    { return Duration( *this ) *= value; }
+
+    /**
+      Divides this duration by a value.
+      @param value value to divide by
+    */
+    Duration &operator/=( int value );
+
+    /**
+      Divides a duration by a value.
+
+      @param value value to divide by
+      @return resultant duration
+    */
+    Duration operator/( int value ) const
+    { return Duration( *this ) /= value; }
+
+    /**
       Computes a duration end time by adding the number of seconds or
       days in the duration to the specified @p start time.
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic