Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Talos-0.3/Date.hxx

00001 // Copyright (C) 2004 Vivien Mallet 00002 // 00003 // This file is part of Talos library. 00004 // Talos library provides miscellaneous tools to make up for C++ 00005 // lacks and to ease C++ programming. 00006 // 00007 // Talos is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Talos is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License (file "license") for more details. 00016 // 00017 // For more information, please see the Talos home page: 00018 // http://spacetown.free.fr/lib/talos/ 00019 00020 00021 #ifndef TALOS_FILE_DATE_HXX 00022 00023 00024 namespace Talos 00025 { 00026 00028 class Date 00029 { 00030 private: 00032 int year_; 00034 int month_; 00036 int day_; 00038 int hour_; 00040 int minutes_; 00042 int seconds_; 00044 vector<int> month_lengths_; 00045 00046 void LeapYearAdjust(); 00047 void Adjust(); 00048 00049 public: 00050 Date(); 00051 Date(int yyyymmdd); 00052 Date(int yyyy, int mm, int dd = 1, 00053 int hh = 0, int mn = 0, int sc = 0); 00054 00055 void SetDate(int yyyymmdd); 00056 void SetDate(int yyyy, int mm, int dd = 1, 00057 int hh = 0, int mn = 0, int sc = 0); 00058 00059 bool LeapYear(int year) const; 00060 bool LeapYear() const; 00061 00062 int GetDate() const; 00063 00064 string GetDate(const string& format) const; 00065 template <class T> 00066 void GetDate(const string& format, T& date) const; 00067 00068 int GetYear() const; 00069 int GetMonth() const; 00070 int GetDay() const; 00071 int GetHour() const; 00072 int GetMinutes() const; 00073 int GetSeconds() const; 00074 00075 void AddYears(int nb_yy); 00076 void AddMonths(int nb_mm); 00077 void AddDays(int nb_dd); 00078 void AddHours(int nb_hh); 00079 void AddMinutes(int nb_mn); 00080 void AddSeconds(int nb_sc); 00081 00082 void SetYear(int yyyy); 00083 void SetMonth(int mm); 00084 void SetDay(int dd); 00085 void SetHour(int hh); 00086 void SetMinutes(int mn); 00087 void SetSeconds(int sc); 00088 00089 int GetDayNumber() const; 00090 int GetNumberOfDays() const; 00091 int GetDaysFrom(Date date) const; 00092 00093 int GetNumberOfHours() const; 00094 int GetNumberOfMinutes() const; 00095 int GetNumberOfSeconds() const; 00096 00097 int GetWeekDay() const; 00098 }; 00099 00100 } // namespace Talos. 00101 00102 00103 #define TALOS_FILE_DATE_HXX 00104 #endif

Generated on Sun Oct 3 19:22:03 2004 for Talos by doxygen 1.3.8