Add documentation, cosmetic changes
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 28 Jan 2009 10:01:01 +0000 (11:01 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 28 Jan 2009 10:01:01 +0000 (11:01 +0100)
doc/Doxyfile.in
src/cron.cpp
src/cron.hpp

index 8848dfc..e1e62b5 100644 (file)
@@ -302,7 +302,7 @@ EXTRACT_ALL            = YES
 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
 # will be included in the documentation.
 
-EXTRACT_PRIVATE        = NO
+EXTRACT_PRIVATE        = YES
 
 # If the EXTRACT_STATIC tag is set to YES all static members of a file 
 # will be included in the documentation.
index f31032d..77d9eb4 100644 (file)
 #include <cron.hpp>
 
 /**
-    @brief checks if the values are usable
-*/
+    * Constructor
+    * @param daystring String representing the active weekdays as numbers. 0 is Sunday.
+    * @param begin Start point of time in seconds since the start of the day
+    */
+WeekCron::WeekCron(const std::string& daystring, int begin)
+    : Begin(begin)
+    , End(0)
+    , Every(-1)
+    , Week(daystring)
+{
+}
+
+/**
+    * Constructor
+    * @param daystring String representing the active weekdays as numbers. 0 is Sunday.
+    * @param begin Start point of time in seconds since the start of the day
+    * @param end End point of time in seconds since the start of the day. Only used when every != -1
+    * @param every Repeat event every xxx seconds in the half-open interval of begin and end. -1 is disabled
+    */
+WeekCron::WeekCron(const std::string& daystring, int begin, int end, int every)
+    : Begin(begin)
+    , End(end)
+    , Every(every)
+    , Week(daystring)
+{
+}
+
+
+/**
+ * Checks if the input values are sane
+ * @return True if sane, false otherweise
+ */
 bool WeekCron::is_sane() const
 {
     if (Begin < 0 || Begin > 86399)
@@ -33,10 +63,11 @@ bool WeekCron::is_sane() const
 }
 
 /**
-    @brief returns the next point in time the item is scheduled for
-    @param calc_from unix-time to start calculating from (0 means now)
-    @note if it is scheduled for calc_from we return the next schedule, not now!
-*/
+ * Returns the next point in time the item is scheduled for. Also handles intervals.
+ * @note if it is scheduled for calc_from we return the next schedule, not now!
+ * @param calc_from unix-time to start calculating from (0 means now)
+ * @return Next point in time the item is scheduled for
+ */
 time_t WeekCron::get_next_run(time_t calc_from)
 {
     if (!calc_from)
@@ -83,6 +114,15 @@ time_t WeekCron::get_next_run(time_t calc_from)
     }
 }
 
+/**
+ * Returns the next point in time the item is scheduled for
+ * @param calc_from Point of time to start calculations from
+ * @param daysec Start point of time in seconds since the start of the day
+ * @param todaycheck If true we check if the calculated time point is before
+                                  our #calc_from calcucation start point.
+                                  If yes, we will advance to the next day.
+ * @return Next point in time
+ */
 time_t WeekCron::get_next_point(time_t calc_from, int daysec, bool todaycheck)
 {
     struct tm ft;
@@ -109,6 +149,16 @@ time_t WeekCron::get_next_point(time_t calc_from, int daysec, bool todaycheck)
     return target;
 }
 
+/**
+ * Returns the last point in time the item is scheduled for
+ * @param calc_from Point of time to start calculations from
+ * @param daysec Start point of time in seconds since the start of the day
+ * @param todaycheck If true we check if the calculated time point is before
+                                  our #calc_from calcucation start point.
+                                  If yes, we will advance to the next day.
+ * @return Last point in time
+ * FIXME: Is the description correct?
+ */
 time_t WeekCron::get_lastnow_point(time_t calc_from, int daysec, bool todaycheck)
 {
     struct tm ft;
@@ -135,4 +185,3 @@ time_t WeekCron::get_lastnow_point(time_t calc_from, int daysec, bool todaycheck
 
     return target;
 }
-
index dcc0dbd..91fdc23 100644 (file)
 
 #include <timefunc.hxx>
 
+/// Time points and intervals repeating each week
 /**
-    @brief time-points and intervals repeating each week
-    @note begin and end are given in seconds since start of the day
+    This class represents recurring time points and intervals
+    which can be repeated on configurable days of the week.
 */
 class WeekCron
 {
     private:
-
+        /// Start point of time in seconds since the start of the day
         int Begin;
+        /// End point of time in seconds since the start of the day. Only used when #Every != -1
         int End;
+        /// Repeat event every xxx seconds in the half-open interval of #Begin and #End. -1 is disabled
         int Every;
+        /// Stores the active days this WeekCron is valid for
         WEEK Week;
 
         time_t get_next_point(time_t calc_from, int daysec,bool todaycheck);
         time_t get_lastnow_point(time_t calc_from, int daysec,bool todaycheck);
 
     public:
-
-        WeekCron(void)
-            : Begin(0), End(0), Every(-1)
-            { }
-
-        WeekCron(const std::string& daystring, int begin)
-            : Begin(begin), End(0), Every(-1), Week(daystring)
-            { }
-
-        WeekCron(const std::string& daystring, int begin, int end, int every)
-            : Begin(begin), End(end), Every(every), Week(daystring)
-            { }
+        WeekCron(const std::string& daystring, int begin);
+        WeekCron(const std::string& daystring, int begin, int end, int every);
 
         bool is_sane() const;