|
Boost Users : |
From: Seweryn Habdank-Wojewódzki (shw_at_[hidden])
Date: 2007-05-27 15:06:09
Hi
Thanks for reply.
> I'm not entirely sure I understand your question, but it sounds to me like
> you want to use date generators. These allow you to specify part of a date
> and then generate a concrete date based on a final input. For example you
> can say
>
> partial_date pd(20, Jan);
> date d = pd.get_date(2007);
>
> Is that what you are trying to do?
More less. This (above) is a partial functionality. Please consider somethig
like setting up the schedule. You are open the organizer (virtual or paper
one). And you know that every month in 20 you have to go somewhere. And you
mark (in organizer) the day 20 in any month, then "click" on option every
month, and there is created list of all days which satisfies that, form the
point to the end of organizer (let's say in 2020).
Generation is easy, but the problem is that in particular situation user can
choose modifiers:
1. every week (it is easy because it is always 7 days, however there is a type
boost::gregorian::weeks);
2. every month (not easy because lengths of months are different, and for that
fact there is a special type b...::g...::months)
3. every year (type b...::g...::years)
4. other period (user can put any value in days how often he/she have to do
something) for example every 2 days user have to water flowers.
So to summarize I know one exact date (clicked one), and I want to generate
others. Below is small example:
bg::date const final_date(2020,12,31);
bg::months const every_month(1); // this TYPE is variable in runtime
bg::date d0(2007,3,4);
do
{
d0 += every_month;
cout << d0 << '\n';
}
while (d0 < final_date);
I am trying to use boost::variant for that purpose.
Regards.
-- |\/\/| Seweryn Habdank-Wojewódzki \/\/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net