1 /* Copyright (C) 2000-2008 Thomas Bopp, Thorsten Hampel, Ludger Merkens, Martin Baehr
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 inherit "/classes/Object";
22 #include <exception.h>
23 #include <attributes.h>
25 //! The Date class features some DATE specific attributes. Dates are
26 //! usually found inside Calendars.
27 class Date : public Object{
34 int get_object_class()
36 return ::get_object_class() | CLASS_DATE;
39 string execute(mapping variables)
52 if ( mappingp(mReferences) ) {
53 foreach(indices(mReferences), object o) {
54 if ( !objectp(o) ) continue;
64 bool match(int start, int end)
66 int startdate, enddate;
67 startdate = (int)do_query_attribute(DATE_START_DATE);
68 enddate = (int)do_query_attribute(DATE_END_DATE);
69 if ( (startdate >= start && startdate <= end ) ||
70 (enddate >= start && enddate <= end) ||
71 ( start <= enddate && end >= startdate) )
76 bool match_time(int starttime, int endtime)
78 int startdate, enddate;
79 startdate = (int)do_query_attribute(DATE_START_TIME);
80 enddate = (int)do_query_attribute(DATE_END_TIME);
82 if ( (startdate >= starttime && startdate <= endtime) ||
83 (enddate >= starttime && enddate <= endtime) ||
84 ( starttime <= enddate && endtime >= startdate ) )