NeBuild dev
Loading...
Searching...
No Matches
date_time Struct Reference

A date-time. More...

#include <date_time.hpp>

Public Member Functions

TOML_NODISCARD_CTOR date_time () noexcept=default
 Default constructor. Does not initialize the members.
 
TOML_NODISCARD_CTOR constexpr date_time (const toml::date &d, const toml::time &t) noexcept
 Constructs a local date-time.
 
TOML_NODISCARD_CTOR constexpr date_time (const toml::date &d) noexcept
 Constructs a local date-time.
 
TOML_NODISCARD_CTOR constexpr date_time (const toml::time &t) noexcept
 Constructs a local date-time.
 
TOML_NODISCARD_CTOR constexpr date_time (const toml::date &d, const toml::time &t, const toml::time_offset &off) noexcept
 Constructs an offset date-time.
 
TOML_PURE_INLINE_GETTER constexpr bool is_local () const noexcept
 Returns true if this date_time does not contain timezone offset information.
 

Public Attributes

toml::date date
 The date component.
 
toml::time time
 The time component.
 
optional< toml::time_offset > offset
 The timezone offset component.
 

Friends

TOML_PURE_GETTER friend constexpr bool operator== (const date_time &lhs, const date_time &rhs) noexcept
 Equality operator.
 
TOML_PURE_INLINE_GETTER friend constexpr bool operator!= (const date_time &lhs, const date_time &rhs) noexcept
 Inequality operator.
 
TOML_PURE_GETTER friend constexpr bool operator< (const date_time &lhs, const date_time &rhs) noexcept
 Less-than operator.
 
TOML_PURE_GETTER friend constexpr bool operator<= (const date_time &lhs, const date_time &rhs) noexcept
 Less-than-or-equal-to operator.
 
TOML_PURE_INLINE_GETTER friend constexpr bool operator> (const date_time &lhs, const date_time &rhs) noexcept
 Greater-than operator.
 
TOML_PURE_INLINE_GETTER friend constexpr bool operator>= (const date_time &lhs, const date_time &rhs) noexcept
 Greater-than-or-equal-to operator.
 
std::ostream & operator<< (std::ostream &lhs, const date_time &rhs)
 Prints a date_time out to a stream in RFC 3339 format. \detail \cpp std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 } } << "\n"; std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 }, { -2, -30 } } << "\n"; std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 }, {} } << "\n"; \ecpp.
 

Detailed Description

A date-time.

Constructor & Destructor Documentation

◆ date_time() [1/5]

TOML_NODISCARD_CTOR date_time::date_time ( )
defaultnoexcept

Default constructor. Does not initialize the members.

◆ date_time() [2/5]

TOML_NODISCARD_CTOR constexpr date_time::date_time ( const toml::date &  d,
const toml::time &  t 
)
inlineconstexprnoexcept

Constructs a local date-time.

Parameters
dThe date component.
tThe time component.

◆ date_time() [3/5]

TOML_NODISCARD_CTOR constexpr date_time::date_time ( const toml::date &  d)
inlineexplicitconstexprnoexcept

Constructs a local date-time.

Parameters
dThe date component.

◆ date_time() [4/5]

TOML_NODISCARD_CTOR constexpr date_time::date_time ( const toml::time &  t)
inlineexplicitconstexprnoexcept

Constructs a local date-time.

Parameters
tThe time component.

◆ date_time() [5/5]

TOML_NODISCARD_CTOR constexpr date_time::date_time ( const toml::date &  d,
const toml::time &  t,
const toml::time_offset &  off 
)
inlineconstexprnoexcept

Constructs an offset date-time.

Parameters
dThe date component.
tThe time component.
offThe timezone offset.

Member Function Documentation

◆ is_local()

TOML_PURE_INLINE_GETTER constexpr bool date_time::is_local ( ) const
inlineconstexprnoexcept

Returns true if this date_time does not contain timezone offset information.

Friends And Related Symbol Documentation

◆ operator!=

TOML_PURE_INLINE_GETTER friend constexpr bool operator!= ( const date_time lhs,
const date_time rhs 
)
friend

Inequality operator.

◆ operator<

TOML_PURE_GETTER friend constexpr bool operator< ( const date_time lhs,
const date_time rhs 
)
friend

Less-than operator.

◆ operator<<

std::ostream & operator<< ( std::ostream &  lhs,
const date_time rhs 
)
friend

Prints a date_time out to a stream in RFC 3339 format. \detail \cpp std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 } } << "\n"; std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 }, { -2, -30 } } << "\n"; std::cout << toml::date_time{ { 1987, 3, 16 }, { 10, 20, 34 }, {} } << "\n"; \ecpp.

\out 1987-03-16T10:20:34 1987-03-16T10:20:34-02:30 1987-03-16T10:20:34Z \eout

◆ operator<=

TOML_PURE_GETTER friend constexpr bool operator<= ( const date_time lhs,
const date_time rhs 
)
friend

Less-than-or-equal-to operator.

◆ operator==

TOML_PURE_GETTER friend constexpr bool operator== ( const date_time lhs,
const date_time rhs 
)
friend

Equality operator.

◆ operator>

TOML_PURE_INLINE_GETTER friend constexpr bool operator> ( const date_time lhs,
const date_time rhs 
)
friend

Greater-than operator.

◆ operator>=

TOML_PURE_INLINE_GETTER friend constexpr bool operator>= ( const date_time lhs,
const date_time rhs 
)
friend

Greater-than-or-equal-to operator.

Member Data Documentation

◆ date

toml::date date_time::date

The date component.

◆ offset

optional<toml::time_offset> date_time::offset

The timezone offset component.

Remarks
The date_time is said to be 'local' if the offset is empty.

◆ time

toml::time date_time::time

The time component.


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