ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
dateandtime.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_expressions of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace expressions { namespace plugins {
9
10//==================================================================================================
11/// %Compiler plug-in that provides date an time related expression terms.
12///
13/// The identifiers, functions and operators offered by this compiler plug-in introduce \alib
14/// types \alib{time;DateTime} and \alib{time;TimePointBase::Duration} to be used with
15/// module \alib_expressions_nl.
16///
17/// All identifier and function names are defined case-insensitive.
18///
19/// <b>Constants:</b><br>
20///
21/// Type | Name |Min. Abbreviation| Description
22/// --------|-------|-----------------|-------------
23/// Integer |\b January | jan | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
24/// Integer |\b February | feb | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
25/// Integer |\b March | mar | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
26/// Integer |\b April | apr | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
27/// Integer |\b May | may | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
28/// Integer |\b June | jun | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
29/// Integer |\b July | jul | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
30/// Integer |\b August | aug | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
31/// Integer |\b September| sep | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
32/// Integer |\b October | oct | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
33/// Integer |\b November | nov | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
34/// Integer |\b December | dec | Used to compare the result of functions \p{GetMonth} and \p{GetUtcMonth}.
35///
36/// Integer |\b Sunday | sun | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
37/// Integer |\b Monday | mon | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
38/// Integer |\b Tuesday | tue | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
39/// Integer |\b Wednesday| wed | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
40/// Integer |\b Thursday | thu | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
41/// Integer |\b Friday | fri | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
42/// Integer |\b Saturday | sat | Used to compare the result of functions \p{GetDayOfWeek} and \p{GetUtcDayOfWeek}.
43///
44///
45/// <br>
46/// <b>Constant Constructor Functions:</b><br>
47///
48/// Return Type | Name |Min. Abbreviation| Signature | Description |
49/// ---------------|-----------|-----------------|-----------|-------------|
50/// DateTime |\b DateTime | times |int,...| Returns a time stamp representing the calendar date in local time zone, respecting daylight saving. The first parameter is required and provides the \p{year}. Further parameters are optional and provide \p{month} (defaults to \c 1), \p{dayOfMonth} (defaults to \c 1), \p{hour} (defaults to \c 0), \p{minute} (defaults to \c 0) and \p{millisecond} (defaults to \c 0).
51/// DateTime |\b UtcDateTime | utcti |int,...| Returns a time stamp representing the calendar date in UTC time, not respecting daylight saving. The first parameter is required and provides the \p{year}. Further parameters are optional and provide \p{month} (defaults to \c 1), \p{dayOfMonth} (defaults to \c 1), \p{hour} (defaults to \c 0), \p{minute} (defaults to \c 0) and \p{millisecond} (defaults to \c 0).
52/// Duration |\b NanoSecondS | ns |int | Returns a time span object representing the given number of nanoseconds.
53/// Duration |\b MicroSecondS | mics |int | Returns a time span object representing the given (absolute) number of microseconds.
54/// Duration |\b MicroSecondS | mics |double | Returns a time span object representing the given (rational) number of microseconds.
55/// Duration |\b MillisecondS | ms |int | Returns a time span object representing the given (absolute) number of milliseconds.
56/// Duration |\b MillisecondS | ms |double | Returns a time span object representing the given (rational) number of milliseconds.
57/// Duration |\b SecondS | sec |int | Returns a time span object representing the given (absolute) number of seconds.
58/// Duration |\b SecondS | sec |double | Returns a time span object representing the given (rational) number of seconds.
59/// Duration |\b MinuteS | min |int | Returns a time span object representing the given (absolute) number of minutes.
60/// Duration |\b MinuteS | min |double | Returns a time span object representing the given (rational) number of minutes.
61/// Duration |\b Hours | hour |int | Returns a time span object representing the given (absolute) number of hours.
62/// Duration |\b Hours | hour |double | Returns a time span object representing the given (rational) number of hours.
63/// Duration |\b Days | day |int | Returns a time span object representing the given (absolute) number of days.
64/// Duration |\b Days | day |double | Returns a time span object representing the given (rational) number of days.
65/// Duration |\b Weeks | wee |int | Returns a time span object representing the given (absolute) number of weeks.
66/// Duration |\b Weeks | wee |double | Returns a time span object representing the given (rational) number of weeks.
67/// Duration |\b Months | mon |int | Returns a time span object representing the given (absolute) number of months (30 days).
68/// Duration |\b Months | mon |double | Returns a time span object representing the given (rational) number of months (30 days).
69/// Duration |\b Years | year |int | Returns a time span object representing the given (absolute) number of years (365 days).
70/// Duration |\b Years | year |double | Returns a time span object representing the given (rational) number of years (365 days).
71///
72/// <br>
73/// <b>Functions:</b><br>
74///
75/// Return Type | Name | Min. Abbreviation| Signature | Description |
76/// ---------------|-----------|------------------|-----------|-------------|
77/// DateTime | \b Now |now | ./. | Returns the actual point in time.
78/// DateTime | \b Today |today | ./. | Returns the point in time that represents the current date local date at midnight, respecting the local time zone and daylight saving.
79/// DateTime | \b UtcToday |utoday | ./. | Returns the point in time that represents the current date local date at midnight, respecting UTC time zone without daylight saving.
80/// Duration | \b Age |age | DateTime | Returns the time span between the actual point in time and the given time stamp.
81/// Boolean | \b IsOlderThan |isot | DateTime ,Duration| Returns \c true if the time span between the actual point in time and the given point in time is greater than the given duration.
82/// Integer | \b GetYear |gy | DateTime | Returns the calendar year of the time stamp, respecting the local time zone and daylight saving.
83/// Integer | \b GetMonth |gmon | DateTime | Returns the calendar month of the time stamp, respecting the local time zone and daylight saving.
84/// Integer | \b GetDay |gd | DateTime | Returns the calendar day of the time stamp, respecting the local time zone and daylight saving.
85/// Integer | \b GetDayOfWeek |gdow | DateTime | Returns the calendar dayOfWeek of the time stamp, respecting the local time zone and daylight saving.
86/// Integer | \b GetHour |gh | DateTime | Returns the calendar hour of the time stamp, respecting the local time zone and daylight saving.
87/// Integer | \b GetMinute |gmin | DateTime | Returns the calendar Minute of the time stamp, respecting the local time zone and daylight saving.
88/// Integer | \b GetMilliSecond |gms | DateTime | Returns the calendar millisecond of the time stamp, respecting the local time zone and daylight saving.
89/// Integer | \b GetUtcYear |guy | DateTime | Returns the calendar year of the time stamp, respecting UTC time zone without daylight saving.
90/// Integer | \b GetUtcMonth |gumon | DateTime | Returns the calendar month of the time stamp, respecting UTC time zone without daylight saving.
91/// Integer | \b GetUtcDay |gud | DateTime | Returns the calendar day of the time stamp, respecting UTC time zone without daylight saving.
92/// Integer | \b GetUtcDayOfWeek |gudow | DateTime | Returns the calendar dayOfWeek of the time stamp, respecting UTC time zone without daylight saving.
93/// Integer | \b GetUtcHour |guh | DateTime | Returns the calendar hour of the time stamp, respecting UTC time zone without daylight saving.
94/// Integer | \b GetUtcMinute |gumin | DateTime | Returns the calendar minute of the time stamp, respecting UTC time zone without daylight saving.
95/// Integer | \b GetUtcMillisecond|gums | DateTime | Returns the calendar millisecond of the time stamp, respecting UTC time zone without daylight saving.
96/// Float | \b InDayS |ind | Duration | Returns the time span given in days.
97/// Float | \b InHourS |inh | Duration | Returns the time span given in hours.
98/// Float | \b InMinuteS |inmin | Duration | Returns the time span given in minutes.
99/// Float | \b InSecondS |ins | Duration | Returns the time span given in seconds.
100/// Float | \b InMilliSecondS |inms | Duration | Returns the time span given in milliseconds.
101/// Float | \b InMicroSecondS |inmics | Duration | Returns the time span given in microseconds.
102/// Float | \b InNanoSecondS |inns | Duration | Returns the time span given in nanoseconds.
103/// Float | \b InHertZ |inhz | Duration | Returns the time span given in hertz (1/second).
104///
105/// <br>
106/// <b>Binary Operators:</b><br>
107///
108/// Return Type | Lhs Type | Operator | Rhs Type | Description|
109/// ---------------|----------|----------|----------|------------|
110/// DateTime | DateTime |<c>+</c> | Duration | Adds a time span to a time stamp.
111/// DateTime | Duration |<c>+</c> | DateTime | Adds a time span to a time stamp.
112/// DateTime | DateTime |<c>-</c> | DateTime | Subtracts two time stamps resulting in a time span.
113/// DateTime | DateTime |<c>-</c> | Duration | Subtracts a time span from time stamp.
114/// Duration | Duration |<c>+</c> | Duration | Adds two time spans.
115/// Duration | Duration |<c>-</c> | Duration | Subtracts rhs-value from lhs-value.
116/// Duration | Duration |<c>*</c> | Float | Multiplies a time span by a given floating point value.
117/// Duration | Float |<c>*</c> | Duration | Multiplies a time span by a given floating point value.
118/// Duration | Duration |<c>*</c> | Integer | Multiplies a time span by a given integral value.
119/// Duration | Integer |<c>*</c> | Duration | Multiplies a time span by a given integral value.
120/// Duration | Duration |<c>/</c> | Float | Divides a time span by a given floating point value.
121/// Duration | Duration |<c>/</c> | Integer | Divides a time span by a given integral value.
122/// Boolean | DateTime |<c>==</c>| DateTime | Compares two time stamp objects.
123/// Boolean | Duration |<c>==</c>| Duration | Compares two time span objects.
124/// Boolean | DateTime |<c>!=</c>| DateTime | Compares two time stamp objects.
125/// Boolean | Duration |<c>!=</c>| Duration | Compares two time span objects.
126/// Boolean | DateTime |<c><</c> | DateTime | Compares two time stamp objects.
127/// Boolean | Duration |<c><</c> | Duration | Compares two time span objects.
128/// Boolean | DateTime |<c><=</c>| DateTime | Compares two time stamp objects.
129/// Boolean | Duration |<c><=</c>| Duration | Compares two time span objects.
130/// Boolean | DateTime |<c>></c> | DateTime | Compares two time stamp objects.
131/// Boolean | Duration |<c>></c> | Duration | Compares two time span objects.
132/// Boolean | DateTime |<c>>=</c>| DateTime | Compares two time stamp objects.
133/// Boolean | Duration |<c>>=</c>| Duration | Compares two time span objects.
134///
135/// # Reference Documentation #
136//==================================================================================================
138{
139 //==============================================================================================
140 /// Constructor. Creates the hash maps.
141 /// @param compiler The compiler we will get attached to.
142 //==============================================================================================
144
145 //==============================================================================================
146 /// Virtual destructor
147 //==============================================================================================
148 virtual ~DateAndTime() override {}
149
150 //==============================================================================================
151 /// Static initialization function.
152 /// Called once during \ref alib_mod_bs "library initialization".
153 //==============================================================================================
154 static ALIB_DLL
155 void Bootstrap();
156};
157
158}}} // namespace [alib::expressions::detail]
159
#define ALIB_DLL
Definition alib.inl:496
#define ALIB_EXPORT
Definition alib.inl:488
virtual ~DateAndTime() override
Virtual destructor.
ALIB_DLL DateAndTime(Compiler &compiler)