libCZI
Reading and Writing CZI documents made easy
libCZI::XmlDateTime Struct Reference

This structure specifies the information in an XSD-DateTime field (cf. https://www.w3schools.com/XML/schema_dtypes_date.asp). More...

#include <libCZI_Metadata.h>

Public Member Functions

void Clear ()
 Clears this object to its blank/initial state.
 
bool HasTimeZoneOffset () const
 
std::string ToXmlString () const
 
std::wstring ToXmlWstring () const
 
bool IsValid () const
 

Static Public Member Functions

static bool TryParse (const char *sz, XmlDateTime *ptrDateTime)
 
static bool TryParse (const wchar_t *szw, XmlDateTime *ptrDateTime)
 

Public Attributes

int sec
 Seconds after the minute - [0, 60] including leap second.
 
int min
 minutes after the hour - [0, 59]
 
int hour
 hours since midnight - [0, 23]
 
int mday
 day of the month - [1, 31]
 
int mon
 months since January - [0, 11]
 
int year
 year [-9999 - 9999]
 
bool isUTC
 True if this object is specifying the time-date in UTC.
 
int offsetHours
 The hours of the timezone-offset. If greater than 24 or less than -24, it indicates an invalid timezone-offset.
 
int offsetMinutes
 The minutes of the timezone-offset. If greater than 60 or negative, it indicates an invalid timezone-offset.
 

Detailed Description

This structure specifies the information in an XSD-DateTime field (cf. https://www.w3schools.com/XML/schema_dtypes_date.asp).

Member Function Documentation

◆ HasTimeZoneOffset()

bool libCZI::XmlDateTime::HasTimeZoneOffset ( ) const
inline

Query if this object uses a "time zone offset". This is the case of the fields offsetHours and offsetMinutes contain valid values and "isUTC" is false.

Returns
True if a "time zone offset" is specified and it is used, false if not.

◆ IsValid()

bool libCZI::XmlDateTime::IsValid ( ) const

Query if this object contains valid information.

Returns
True if valid, false if not.

◆ ToXmlString()

std::string libCZI::XmlDateTime::ToXmlString ( ) const

Converts the information into a string conforming to the XSD-specification for the DateTime data type. If this object does not contain valid information, an exception of type illegal_argument is thrown.

Returns
This object as a string.

◆ ToXmlWstring()

std::wstring libCZI::XmlDateTime::ToXmlWstring ( ) const

Converts the information into a string conforming to the XSD-specification for the DateTime data type. If this object does not contain valid information, an exception of type illegal_argument is thrown.

Returns
This object as a string.

◆ TryParse() [1/2]

static bool libCZI::XmlDateTime::TryParse ( const char *  sz,
XmlDateTime ptrDateTime 
)
static

Attempts to parse an XmlDateTime from the given string. The string needs to conform to ISO8601.

Parameters
szThe string to parse.
[in,out]ptrDateTimeIf non-null and the parsing was successful, the information will be put here.
Returns
True if it succeeds, false if it fails.

◆ TryParse() [2/2]

static bool libCZI::XmlDateTime::TryParse ( const wchar_t *  szw,
XmlDateTime ptrDateTime 
)
static

Attempts to parse an XmlDateTime from the given string. The string needs to conform to ISO8601.

Parameters
szwThe string to parse.
[in,out]ptrDateTimeIf non-null and the parsing was successful, the information will be put here.
Returns
True if it succeeds, false if it fails.

The documentation for this struct was generated from the following file: