Laxkit  0.0.7.1
dateutils.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2011 by Tom Lechner
22 //
23 #ifndef _LAX_DATEUTILS_H
24 #define _LAX_DATEUTILS_H
25 
26 namespace Laxkit {
27 
28 //---------------------------- date functions -----------------------------------------
29 int is_leap_year(int year);
30 int days_in_month(int month, int year);
31 int days_in_year(int year);
32 const char *dayofweek(int day, int lvl, int sunday);
33 const char *monthname(int month,int lvl);
34 
35 
36 //---------------------------- LaxDate -----------------------------------------
37 
38 class LaxDate
39 {
40  protected:
41  int year,month,day;
42  int dayofweek, dayofyear;
43  public:
44  LaxDate();
45  LaxDate(int year, int month, int day);
46  LaxDate(const LaxDate &d);
47  LaxDate &operator=(LaxDate &d);
48  int Set(int year, int month, int day);
49  void SetToToday();
50 
51  //LaxDate plusDays(int days);
52  //LaxDate plusWeeks(int weeks);
53  //LaxDate plusMonths(int months);
54  //LaxDate plusYears(int years);
55 
56  int Year() { return year; }
57  int Month() { return month; }
58  int Day() { return day; }
59  int DayOfWeek();
60  int DayOfYear();
61 };
62 
63 int operator-(LaxDate d1,LaxDate d2); //number of days between dates
64 int operator<(LaxDate d1,LaxDate d2);
65 int operator>(LaxDate d1,LaxDate d2);
66 int operator<=(LaxDate d1,LaxDate d2);
67 int operator>=(LaxDate d1,LaxDate d2);
68 int operator==(LaxDate d1,LaxDate d2);
69 
70 } //namespace Laxkit
71 
72 #endif
73 
74 

Mon Feb 17 2014 11:52:56, Laxkit