From: Thomas Jarosch Date: Tue, 8 Jul 2008 12:28:13 +0000 (+0000) Subject: [MERGE] libi2ncommon: (gerd) add WEEK::set(daystring) X-Git-Tag: v2.6~161 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=fd6697082b4b0f0cc8ba2c5eae0269e0fff1caf9;p=libi2ncommon [MERGE] libi2ncommon: (gerd) add WEEK::set(daystring) --- diff --git a/src/timefunc.cpp b/src/timefunc.cpp index 276a681..6792e20 100644 --- a/src/timefunc.cpp +++ b/src/timefunc.cpp @@ -165,7 +165,7 @@ std::string output_hour_minute(int hour, int minute, bool h_for_00) return out.str(); } -WEEK::WEEK(const std::string& daystring) +void WEEK::set(const std::string& daystring) { int len=daystring.length(); for (int p=0; p < len; p++) @@ -177,7 +177,7 @@ WEEK::WEEK(const std::string& daystring) int wnr=-1; if (!(c >> wnr) || wnr<0 || wnr >6) throw range_error("illegal weekday >"+string(nr)+"< in "+daystring); - + days.set(wnr); } } diff --git a/src/timefunc.hxx b/src/timefunc.hxx index 5ae357b..a3bc80b 100644 --- a/src/timefunc.hxx +++ b/src/timefunc.hxx @@ -47,7 +47,8 @@ class WEEK enum WEEKDAY { SU=0, MO=1, TU=2, WE=3, TH=4, FR=5, SA=6 }; // throws out_of_range if illegal week - WEEK(const std::string& daystring); + WEEK(const std::string& daystring) + { set(daystring); } WEEK(const std::bitset<7> &_days) : days(_days) @@ -62,6 +63,7 @@ class WEEK operator std::bitset<7>() const { return days; } + void set(const std::string& daystring); void set(WEEKDAY d, bool value=true) { days[d]=value; }