XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
date.hpp
Aller à la documentation de ce fichier.
1 #ifndef __XIOS_CDate__
2 #define __XIOS_CDate__
3 
5 #include "xios_spl.hpp"
6 #include "exception.hpp"
7 #include "duration.hpp"
8 
9 namespace xios
10 {
12  class CCalendar;
13 
14  class CDate
15  {
16  public :
17 
20  CDate(void);
22  CDate(const CCalendar& cal);
24  CDate(const CCalendar& cal, int yr, int mth, int d,
25  int hr = 0, int min = 0, int sec = 0);
26  CDate(const CDate& odate);
27  CDate(const CDate* const odate); // Not implemented yet
28 
30  ~CDate(void);
31 
33  CDate& operator=(const CDate& date);
34  bool operator==(const CDate& date);
35  friend StdOStream& operator<<(StdOStream& out, const CDate& date);
36  friend StdIStream& operator>>(StdIStream& in, CDate& date);
37 
39  operator Time(void) const;
40 
42  bool checkDate(void); // Vérifie la validité de la date.
43 
45  int getYear (void) const;
46  int getMonth (void) const;
47  int getDay (void) const;
48  int getHour (void) const;
49  int getMinute(void) const;
50  int getSecond(void) const;
51 
53  const CCalendar& getRelCalendar(void) const;
54  bool hasRelCalendar(void) const;
55 
57  int getSecondOfYear() const;
59  double getDayOfYear() const;
61  double getFractionOfYear() const;
63  int getSecondOfDay() const;
65  double getFractionOfDay() const;
66 
68  void setYear (int newyear);
69  void setMonth (int newmonth);
70  void setDay (int newday);
71  void setHour (int newhour);
72  void setMinute(int newminute);
73  void setSecond(int newsecond);
74 
75  void setDate(int yr, int mth, int d,
76  int hr = 0, int min = 0, int sec = 0);
77 
78  void addMonth (int value);
79 
82 
84  StdString toString(void) const;
85  StdString getStryyyymmdd(void) const;
86  string getStr(const string& str) const;
87 
88 
89  public : /* static */
90 
91  static CDate FromString(const StdString& str, const CCalendar& calendar);
92 
93  private :
94 
97  int year, month, day, hour, minute, second; // Année, mois, ...
98 
99 
100  }; // class CDate;
101 
102 } // namespace xios
103 
104 #endif // __XIOS_CDate__
int getSecondOfDay() const
Get the fraction of the current day as a real number between 0 and 1.
Definition: date.cpp:199
int getSecond(void) const
Get the calendar associated to the date.
Definition: date.cpp:141
double getFractionOfYear() const
Get the number of seconds since the beginning of the day.
Definition: date.cpp:190
void setDate(int yr, int mth, int d, int hr=0, int min=0, int sec=0)
Definition: date.cpp:223
int year
Definition: date.hpp:97
const CCalendar & getRelCalendar(void) const
Definition: date.cpp:145
int getMonth(void) const
Definition: date.cpp:137
bool operator==(const CDate &date)
Definition: date.cpp:66
bool hasRelCalendar(void) const
Get the number of seconds since the beginning of the year.
Definition: date.cpp:153
void setMinute(int newminute)
Definition: date.cpp:220
static CDate FromString(const StdString &str, const CCalendar &calendar)
Definition: date.cpp:257
std::string StdString
Definition: xios_spl.hpp:48
#define xios(arg)
CDate & operator=(const CDate &date)
Opérateurs ///.
Definition: date.cpp:58
long long int Time
////////////////////// Déclarations ////////////////////// ///
Definition: duration.hpp:11
int day
Definition: date.hpp:97
std::istream StdIStream
Definition: xios_spl.hpp:47
int hour
Definition: date.hpp:97
int month
Definition: date.hpp:97
int minute
Definition: date.hpp:97
int getSecondOfYear() const
Get the number of days (expressed as a real number) since the beginning of the year.
Definition: date.cpp:162
int getDay(void) const
Definition: date.cpp:138
string getStr(const string &str) const
Definition: date.cpp:281
int getMinute(void) const
Definition: date.cpp:140
friend StdOStream & operator<<(StdOStream &out, const CDate &date)
Definition: date.cpp:74
bool setRelCalendar(const CCalendar &relCalendar)
Definition: date.cpp:249
const CCalendar * relCalendar
Propriétés privées ///.
Definition: date.hpp:96
void addMonth(int value)
Set the calendar associated to the date.
Definition: date.cpp:235
CDate(void)
Create an empty date associated to the specified calendar.
Definition: date.cpp:14
StdString getStryyyymmdd(void) const
Definition: date.cpp:267
int second
Definition: date.hpp:97
void setHour(int newhour)
Definition: date.cpp:219
int getHour(void) const
Definition: date.cpp:139
void setMonth(int newmonth)
Definition: date.cpp:217
int getYear(void) const
Divers accesseurs ///.
Definition: date.cpp:136
void setYear(int newyear)
Mutateurs ///.
Definition: date.cpp:216
double getDayOfYear() const
Get the fraction of the current year as a real number between 0 and 1.
Definition: date.cpp:181
bool checkDate(void)
Traitements ///.
Definition: date.cpp:128
StdString toString(void) const
Autres ///.
Definition: date.cpp:351
double getFractionOfDay() const
Get the fraction of the current day as a real number between 0 and 1.
Definition: date.cpp:209
void setSecond(int newsecond)
Definition: date.cpp:221
void setDay(int newday)
Definition: date.cpp:218
std::ostream StdOStream
Definition: xios_spl.hpp:46
friend StdIStream & operator>>(StdIStream &in, CDate &date)
Return the number of seconds since the time origin fixed when creating the calendar.
Definition: date.cpp:97
~CDate(void)
Destructeur ///.
Definition: date.cpp:53