Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
enums.mqh
Go to the documentation of this file.
1//+------------------------------------------------------------------+
2//| enums.mqh |
3//| Time Shield - MQL5 Enumerations |
4//| Copyright 2025, NewYaroslav |
5//| https://github.com/NewYaroslav/time-shield-cpp |
6//+------------------------------------------------------------------+
7#ifndef __TIME_SHIELD_ENUMS_MQH__
8#define __TIME_SHIELD_ENUMS_MQH__
9
15
16#property copyright "Copyright 2025, NewYaroslav"
17#property link "https://github.com/NewYaroslav/time-shield-cpp"
18#property strict
19
20namespace time_shield {
21
38
41 UPPERCASE_NAME = 0,
43 FULL_NAME,
44 };
45
47 enum Weekday {
48 SUN = 0,
49 MON,
50 TUE,
51 WED,
52 THU,
53 FRI,
54 SAT
55 };
56
62 string to_str(Weekday value, FormatType format = UPPERCASE_NAME) {
63 static const string uppercase_names[] = {
64 "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"
65 };
66 static const string short_names[] = {
67 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
68 };
69 static const string full_names[] = {
70 "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
71 };
72 switch(format) {
73 default:
74 case UPPERCASE_NAME:
75 return uppercase_names[(int)value];
76 case SHORT_NAME:
77 return short_names[(int)value];
78 case FULL_NAME:
79 return full_names[(int)value];
80 }
81 return "";
82 }
83
84
86 enum Month {
87 JAN = 1,
88 FEB,
89 MAR,
90 APR,
91 MAY,
92 JUN,
93 JUL,
94 AUG,
95 SEP,
96 OCT,
97 NOV,
98 DEC
99 };
100
106 string to_str(Month value, FormatType format = UPPERCASE_NAME) {
107 static const string uppercase_names[] = {
108 "",
109 "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
110 "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
111 };
112 static const string short_names[] = {
113 "",
114 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
115 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
116 };
117 static const string full_names[] = {
118 "",
119 "January", "February", "March", "April", "May", "June",
120 "July", "August", "September", "October", "November", "December"
121 };
122 switch(format) {
123 default:
124 case UPPERCASE_NAME:
125 return uppercase_names[(int)value];
126 case SHORT_NAME:
127 return short_names[(int)value];
128 case FULL_NAME:
129 return full_names[(int)value];
130 }
131 return "";
132 }
133
134
136 enum TimeZone {
137 GMT,
138 UTC,
139 EET,
140 CET,
141 WET,
142 EEST,
143 CEST,
144 WEST,
145 UNKNOWN
146 };
147
153 string to_str(TimeZone value, FormatType format = UPPERCASE_NAME) {
154 static const string uppercase_names[] = {
155 "GMT", "UTC", "EET", "CET", "WET", "EEST", "CEST", "WEST", "UNKNOWN"
156 };
157 static const string short_names[] = {
158 "GMT", "UTC", "EET", "CET", "WET", "EEST", "CEST", "WEST", "Unknown"
159 };
160 static const string full_names[] = {
161 "Greenwich Mean Time", "Coordinated Universal Time", "Eastern European Time",
162 "Central European Time", "Western European Time", "Eastern European Summer Time",
163 "Central European Summer Time", "Western European Summer Time", "Unknown Time Zone"
164 };
165 switch(format) {
166 default:
167 case UPPERCASE_NAME:
168 return uppercase_names[(int)value];
169 case SHORT_NAME:
170 return short_names[(int)value];
171 case FULL_NAME:
172 return full_names[(int)value];
173 }
174 return "";
175 }
176
177
189
202
204
205}; // namespace time_shield
206
207#endif // __TIME_SHIELD_ENUMS_MQH__
const std::string & to_str(Weekday value, FormatType format=UPPERCASE_NAME)
Converts a Weekday enum value to a string.
Definition enums.hpp:82
MoonPhase
Enumeration of the moon phases.
Definition enums.hpp:253
TimeFormatType
Enumeration of time format types.
Definition enums.hpp:265
FormatType
Enumeration of the format options for representing a weekday or month.
Definition enums.hpp:34
Month
Enumeration of the months of the year.
Definition enums.hpp:104
TimeZone
Enumeration of the time zones.
Definition enums.hpp:184
Weekday
Enumeration of the days of the week.
Definition enums.hpp:41
@ FULL_MOON
Full Moon.
Definition enums.hpp:257
@ NEW_MOON
New Moon.
Definition enums.hpp:261
@ WAXING_GIBBOUS
Waxing Gibbous Moon.
Definition enums.hpp:256
@ FIRST_QUARTER
First Quarter Moon.
Definition enums.hpp:255
@ WANING_CRESCENT
Waning Crescent Moon.
Definition enums.hpp:260
@ WAXING_CRESCENT
Waxing Crescent Moon.
Definition enums.hpp:254
@ LAST_QUARTER
Last Quarter Moon.
Definition enums.hpp:259
@ WANING_GIBBOUS
Waning Gibbous Moon.
Definition enums.hpp:258
@ EUROPEAN_TIME
European time format (e.g., "12:30")
Definition enums.hpp:274
@ ISO8601_NO_TZ
ISO8601 format without time zone (e.g., "2024-06-06T12:30:45")
Definition enums.hpp:267
@ AMERICAN_MONTH_DAY
American date format (e.g., "06/06/2024")
Definition enums.hpp:271
@ ISO8601_WITH_TZ
ISO8601 format with time zone (e.g., "2024-06-06T12:30:45+03:00")
Definition enums.hpp:266
@ MQL5_FULL
MQL5 time format (e.g., "2024.06.06 12:30:45")
Definition enums.hpp:268
@ MQL5_DATE_ONLY
MQL5 date format (e.g., "2024.06.06")
Definition enums.hpp:269
@ MQL5_TIME_ONLY
MQL5 time format (e.g., "12:30:45")
Definition enums.hpp:270
@ AMERICAN_TIME
American time format (e.g., "12:30 PM")
Definition enums.hpp:273
@ EUROPEAN_MONTH_DAY
European date format (e.g., "06.06.2024")
Definition enums.hpp:272
@ SHORT_NAME
Short name.
Definition enums.hpp:36
@ FULL_NAME
Full name.
Definition enums.hpp:37
@ UPPERCASE_NAME
Uppercase short name.
Definition enums.hpp:35
@ SEP
September.
Definition enums.hpp:113
@ OCT
October.
Definition enums.hpp:114
@ FEB
February.
Definition enums.hpp:106
@ JUN
June.
Definition enums.hpp:110
@ MAY
May.
Definition enums.hpp:109
@ NOV
November.
Definition enums.hpp:115
@ MAR
March.
Definition enums.hpp:107
@ AUG
August.
Definition enums.hpp:112
@ DEC
December.
Definition enums.hpp:116
@ APR
April.
Definition enums.hpp:108
@ JAN
January.
Definition enums.hpp:105
@ JUL
July.
Definition enums.hpp:111
@ EET
Eastern European Time.
Definition enums.hpp:187
@ CEST
Central European Summer Time.
Definition enums.hpp:191
@ WEST
Western European Summer Time.
Definition enums.hpp:192
@ WET
Western European Time.
Definition enums.hpp:189
@ UNKNOWN
Unknown Time Zone.
Definition enums.hpp:193
@ UTC
Coordinated Universal Time.
Definition enums.hpp:186
@ GMT
Greenwich Mean Time.
Definition enums.hpp:185
@ EEST
Eastern European Summer Time.
Definition enums.hpp:190
@ CET
Central European Time.
Definition enums.hpp:188
@ TUE
Tuesday.
Definition enums.hpp:44
@ SUN
Sunday.
Definition enums.hpp:42
@ MON
Monday.
Definition enums.hpp:43
@ FRI
Friday.
Definition enums.hpp:47
@ SAT
Saturday.
Definition enums.hpp:48
@ THU
Thursday.
Definition enums.hpp:46
@ WED
Wednesday.
Definition enums.hpp:45
Main namespace for the Time Shield library.