Skip to content

Commit 7c01fa9

Browse files
grammmikejengelh
authored andcommitted
ews: add struct initializers for timezones
Add default constructors and bias-based initialization for time zone structs, enabling creation without nodes and providing sensible defaults for missing data. References: GXL-576
1 parent d14c551 commit 7c01fa9

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

exch/ews/structures.hpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ struct sSyncState {
423423
* members.
424424
*/
425425
struct sTime {
426+
sTime() = default;
426427
sTime(const tinyxml2::XMLElement*);
427428

428-
uint8_t hour;
429-
uint8_t minute;
430-
uint8_t second;
429+
uint8_t hour = 0;
430+
uint8_t minute = 0;
431+
uint8_t second = 0;
431432
};
432433

433434
/**
@@ -2219,13 +2220,14 @@ struct tTasksFolderType : public tBaseFolderType {
22192220
* Types.xsd:6372
22202221
*/
22212222
struct tSerializableTimeZoneTime {
2223+
tSerializableTimeZoneTime() = default;
22222224
explicit tSerializableTimeZoneTime(const tinyxml2::XMLElement*);
22232225

2224-
int32_t Bias;
2225-
sTime Time;
2226-
int32_t DayOrder;
2227-
int32_t Month;
2228-
Enum::DayOfWeekType DayOfWeek;
2226+
int32_t Bias = 0;
2227+
sTime Time{};
2228+
int32_t DayOrder = 0;
2229+
int32_t Month = 0;
2230+
Enum::DayOfWeekType DayOfWeek{};
22292231
std::optional<int32_t> Year;
22302232

22312233
bool valid() const;
@@ -2261,11 +2263,13 @@ struct tSetItemField : public tChangeDescription {
22612263
* Types.xsd:6383
22622264
*/
22632265
struct tSerializableTimeZone {
2266+
tSerializableTimeZone() = default;
22642267
explicit tSerializableTimeZone(const tinyxml2::XMLElement*);
2268+
explicit tSerializableTimeZone(int32_t bias) : Bias(bias) {}
22652269

2266-
int32_t Bias;
2267-
tSerializableTimeZoneTime StandardTime;
2268-
tSerializableTimeZoneTime DaylightTime;
2270+
int32_t Bias = 0;
2271+
tSerializableTimeZoneTime StandardTime{};
2272+
tSerializableTimeZoneTime DaylightTime{};
22692273

22702274
std::chrono::minutes offset(time_point) const;
22712275
time_point apply(time_point) const;

0 commit comments

Comments
 (0)