Nebula
Loading...
Searching...
No Matches
calendartimebase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14#include "core/types.h"
15#include "io/filetime.h"
16#include "util/string.h"
17
18namespace Timing
19{
20 class CalendarTime;
21}
22
23//------------------------------------------------------------------------------
24namespace Base
25{
27{
28public:
30 typedef unsigned int Year;
31 typedef unsigned int Day;
32 typedef unsigned int Hour;
33 typedef unsigned int Minute;
34 typedef unsigned int Second;
35 typedef unsigned int MilliSecond;
36
64
68 void SetYear(Year y);
70 Year GetYear() const;
72 void SetMonth(Month m);
74 Month GetMonth() const;
76 void SetWeekday(Weekday wd);
78 Weekday GetWeekday() const;
80 void SetDay(Day d);
82 Day GetDay() const;
84 void SetHour(Hour h);
86 Hour GetHour() const;
88 void SetMinute(Minute m);
90 Minute GetMinute() const;
92 void SetSecond(Second s);
94 Second GetSecond() const;
99
113 static Util::String Format(const Util::String& fmtString, const Timing::CalendarTime& calTime);
117 static Month StringToMonth(const Util::String& str);
121 static Weekday StringToWeekday(const Util::String& str);
122
123protected:
132};
133
134} // namespace Base
135//------------------------------------------------------------------------------
Allows to obtain the current point in time as year, month, day, etc... down to milliseconds,...
Definition calendartimebase.h:27
static IO::FileTime LocalTimeToFileTime(const Timing::CalendarTime &localTime)
convert local time to file time
void SetYear(Year y)
set the year
Definition calendartimebase.cc:193
unsigned int Second
Definition calendartimebase.h:34
void SetSecond(Second s)
set second-of-minute
Definition calendartimebase.cc:301
static Timing::CalendarTime FileTimeToSystemTime(const IO::FileTime &fileTime)
convert file time to system time
unsigned int Year
typedefs
Definition calendartimebase.h:30
unsigned int MilliSecond
Definition calendartimebase.h:35
static Util::String WeekdayToString(Weekday d)
convert weekday to string
Definition calendartimebase.cc:154
Weekday weekday
Definition calendartimebase.h:126
void SetHour(Hour h)
set hour-of-day
Definition calendartimebase.cc:265
static Timing::CalendarTime GetLocalTime()
get the current local time
Weekday
weekdays enum
Definition calendartimebase.h:55
@ Sunday
Definition calendartimebase.h:56
@ Wednesday
Definition calendartimebase.h:59
@ Tuesday
Definition calendartimebase.h:58
@ Monday
Definition calendartimebase.h:57
@ Saturday
Definition calendartimebase.h:62
@ Friday
Definition calendartimebase.h:61
@ Thursday
Definition calendartimebase.h:60
static Weekday StringToWeekday(const Util::String &str)
convert string to weekday
Definition calendartimebase.cc:173
static Util::String MonthToString(Month m)
convert month to string
Definition calendartimebase.cc:105
Minute minute
Definition calendartimebase.h:129
unsigned int Day
Definition calendartimebase.h:31
unsigned int Hour
Definition calendartimebase.h:32
Hour GetHour() const
get hour-of-day
Definition calendartimebase.cc:274
void SetWeekday(Weekday wd)
set the day-of-week
Definition calendartimebase.cc:229
static Timing::CalendarTime FileTimeToLocalTime(const IO::FileTime &fileTime)
convert file time to local time
MilliSecond milliSecond
Definition calendartimebase.h:131
CalendarTimeBase()
constructor
Definition calendartimebase.cc:18
Second GetSecond() const
get second-of-minute
Definition calendartimebase.cc:310
void SetMilliSecond(MilliSecond ms)
set milliseconds
Definition calendartimebase.cc:319
Month month
Definition calendartimebase.h:125
unsigned int Minute
Definition calendartimebase.h:33
Day GetDay() const
get the day (of month)
Definition calendartimebase.cc:256
MilliSecond GetMilliSecond() const
get milliseconds
Definition calendartimebase.cc:328
Weekday GetWeekday() const
get the day-of-week
Definition calendartimebase.cc:238
Year GetYear() const
get the year
Definition calendartimebase.cc:202
Month GetMonth() const
get the month
Definition calendartimebase.cc:220
Day day
Definition calendartimebase.h:127
Month
months enum
Definition calendartimebase.h:39
@ February
Definition calendartimebase.h:41
@ November
Definition calendartimebase.h:50
@ January
Definition calendartimebase.h:40
@ July
Definition calendartimebase.h:46
@ August
Definition calendartimebase.h:47
@ March
Definition calendartimebase.h:42
@ April
Definition calendartimebase.h:43
@ December
Definition calendartimebase.h:51
@ May
Definition calendartimebase.h:44
@ June
Definition calendartimebase.h:45
@ October
Definition calendartimebase.h:49
@ September
Definition calendartimebase.h:48
void SetMinute(Minute m)
set minute-of-hour
Definition calendartimebase.cc:283
static IO::FileTime SystemTimeToFileTime(const Timing::CalendarTime &systemTime)
convert system time to file time
Year year
Definition calendartimebase.h:124
Second second
Definition calendartimebase.h:130
static Timing::CalendarTime GetSystemTime()
get the current system time
Minute GetMinute() const
get minute-of-hour
Definition calendartimebase.cc:292
void SetDay(Day d)
set the day (of month)
Definition calendartimebase.cc:247
static Month StringToMonth(const Util::String &str)
convert string to month
Definition calendartimebase.cc:129
Hour hour
Definition calendartimebase.h:128
void SetMonth(Month m)
set the month
Definition calendartimebase.cc:211
Defines a file-access timestamp.
Allows to obtain the current point in time as year, month, day, etc... down to milliseconds,...
Definition gamecontentserverbase.cc:10
Definition calendartimebase.h:19
auto Format
Definition string.h:1204
Nebula's universal string class.
Definition string.h:50