|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
时间类 更多...
#include <datetime.hpp>
Public 类型 | |
| using | time_type = int32_t |
| 时间分量类型 | |
Public 成员函数 | |
| constexpr | time () noexcept=default |
| 默认构造函数,创建00:00:00 | |
| constexpr | ~time ()=default |
| 析构函数 | |
| constexpr | time (const time_type hour, const time_type minute, const time_type second) noexcept |
| 构造函数 | |
| constexpr time_type | hours () const noexcept |
| 获取小时 | |
| constexpr time_type | minutes () const noexcept |
| 获取分钟 | |
| constexpr time_type | seconds () const noexcept |
| 获取秒 | |
| constexpr bool | is_valid () const noexcept |
| 检查时间是否有效 | |
| constexpr void | clear () noexcept |
| 重置为00:00:00 | |
| constexpr time_type | to_seconds () const noexcept |
| 转换为总秒数 | |
| constexpr bool | equal_to (const time &other) const noexcept |
| 相等比较 | |
| constexpr bool | less_than (const time &other) const noexcept |
| 小于比较 | |
| constexpr time & | operator+= (const time_type seconds) |
| 时间加秒数 | |
| constexpr time & | operator-= (const time_type seconds) noexcept |
| 时间减秒数 | |
| constexpr time | operator+ (const time_type seconds) const noexcept |
| 时间加秒数 | |
| constexpr time | operator- (const time_type seconds) const noexcept |
| 时间减秒数 | |
| constexpr time & | operator++ () |
| 前置递增(加1秒) | |
| constexpr time | operator++ (int) |
| 后置递增(加1秒) | |
| constexpr time & | operator-- () |
| 前置递减(减1秒) | |
| constexpr time | operator-- (int) |
| 后置递减(减1秒) | |
| constexpr time_type | operator- (const time &other) const noexcept |
| 时间差(秒数) | |
| constexpr size_t | to_hash () const noexcept |
| 计算哈希值 | |
| constexpr string | to_string () const |
| 转换为字符串 | |
| constexpr void | swap (time &other) noexcept |
| 交换两个时间 | |
| Public 成员函数 继承自 iobject< time > | |
| constexpr bool | try_parse (const string_view str) noexcept |
| 尝试从字符串解析对象 | |
| Public 成员函数 继承自 istringify< time > | |
| constexpr string | to_string () const |
| 转换为字符串 | |
| Public 成员函数 继承自 icomparable< time > | |
| constexpr bool | operator== (const time &rhs) const noexcept(noexcept(derived().equal_to(rhs))) |
| 相等比较运算符 | |
| constexpr bool | operator!= (const time &rhs) const noexcept(noexcept(!(derived().equal_to(rhs)))) |
| 不等比较运算符 | |
| constexpr bool | operator< (const time &rhs) const noexcept(noexcept(derived().less_than(rhs))) |
| 小于比较运算符 | |
| constexpr bool | operator> (const time &rhs) const noexcept(noexcept(rhs.less_than(derived()))) |
| 大于比较运算符 | |
| constexpr bool | operator<= (const time &rhs) const noexcept(noexcept(!(rhs.less_than(derived())))) |
| 小于等于比较运算符 | |
| constexpr bool | operator>= (const time &rhs) const noexcept(noexcept(!(derived().less_than(rhs)))) |
| 大于等于比较运算符 | |
| Public 成员函数 继承自 ihashable< time > | |
| constexpr size_t | to_ihash () const noexcept(noexcept(derived().to_hash())) |
| 获取对象的哈希值 | |
静态 Public 成员函数 | |
| static constexpr bool | is_valid (time_type hour, time_type minute, time_type second) noexcept |
| 检查时间是否有效 | |
| static constexpr time | parse (const string_view view) |
| 从字符串解析 | |
| 静态 Public 成员函数 继承自 iobject< time > | |
| static constexpr time | parse (const string_view str) |
| 从字符串解析对象 | |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinestaticnodiscardconstexpr |
从字符串解析
| view | 格式为 HH:MM:SS 的字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 701 行定义.
引用了 basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
被这些函数引用 datetime::parse(), datetime::parse_ISO8601() , 以及 datetime::parse_RFC3339().
|
inlinenodiscardconstexprnoexcept |
获取秒
在文件 datetime.hpp 第 509 行定义.
被这些函数引用 operator+(), operator+=(), operator-() , 以及 operator-=().
|
inlineconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexpr |