NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
boolean结构体 参考

布尔值包装类 更多...

#include <packages.hpp>

类 boolean 继承关系图:
[图例]

Public 成员函数

NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string to_string () const
 将当前对象转换为字符串
constexpr boolean operator! () const noexcept
 逻辑非操作符
Public 成员函数 继承自 ipackage< boolean, bool >
NEFORCE_NODISCARD constexpr operator package_type () const noexcept
 类型转换操作符
NEFORCE_NODISCARD constexpr package_type value () const noexcept
 获取数值
NEFORCE_NODISCARD constexpr int64_t to_int64 () const noexcept
 转换为64位整数
NEFORCE_NODISCARD constexpr size_t to_hash () const noexcept
 计算哈希值
constexpr void swap (boolean &other) noexcept
 交换内容
NEFORCE_NODISCARD constexpr bool operator== (const boolean &other) const noexcept
 相等比较操作符
NEFORCE_NODISCARD constexpr bool operator< (const boolean &other) const noexcept
 小于比较操作符
constexpr booleanoperator+= (const boolean &other) noexcept
 加法赋值操作符
constexpr booleanoperator-= (const boolean &other) noexcept
 减法赋值操作符
constexpr booleanoperator*= (const boolean &other) noexcept
 乘法赋值操作符
constexpr booleanoperator/= (const boolean &other)
 除法赋值操作符
constexpr booleanoperator%= (const boolean &other)
 取模赋值操作符
NEFORCE_NODISCARD constexpr boolean operator- () const noexcept
 一元负号操作符
constexpr booleanoperator++ () noexcept
 前置递增操作符
constexpr booleanoperator-- () noexcept
 前置递减操作符
constexpr boolean operator~ () const noexcept
 按位取反操作符
constexpr booleanoperator&= (const boolean &other) noexcept
 按位与赋值操作符
constexpr booleanoperator|= (const boolean &other) noexcept
 按位或赋值操作符
constexpr booleanoperator^= (const boolean &other) noexcept
 按位异或赋值操作符
constexpr booleanoperator<<= (const uint32_t shift)
 左移赋值操作符
constexpr booleanoperator>>= (const uint32_t shift)
 右移赋值操作符
Public 成员函数 继承自 icomparable< boolean >
NEFORCE_NODISCARD constexpr bool operator== (const boolean &rhs) const noexcept(noexcept(derived()==rhs))
 相等比较运算符
NEFORCE_NODISCARD constexpr bool operator!= (const boolean &rhs) const noexcept(noexcept(!(*this==rhs)))
 不等比较运算符
NEFORCE_NODISCARD constexpr bool operator< (const boolean &rhs) const noexcept(noexcept(derived()< rhs))
 小于比较运算符
NEFORCE_NODISCARD constexpr bool operator> (const boolean &rhs) const noexcept(noexcept(rhs< derived()))
 大于比较运算符
NEFORCE_NODISCARD constexpr bool operator<= (const boolean &rhs) const noexcept(noexcept(!(derived() > rhs)))
 小于等于比较运算符
NEFORCE_NODISCARD constexpr bool operator>= (const boolean &rhs) const noexcept(noexcept(!(derived()< rhs)))
 大于等于比较运算符
Public 成员函数 继承自 ihashable< boolean >
NEFORCE_NODISCARD constexpr size_t to_hash () const noexcept(noexcept(derived().to_hash()))
 获取对象的哈希值
Public 成员函数 继承自 iarithmetic< boolean >
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator+ (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator+=(other)))
 加法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator- (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator-=(other)))
 减法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator* (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator*=(other)))
 乘法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator/ (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator/=(other)))
 除法运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator% (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator%=(other)))
 取模运算符
NEFORCE_CONSTEXPR14 booleanoperator+= (const boolean &other) noexcept(noexcept(derived().operator+=(other)))
 加法赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator-= (const boolean &other) noexcept(noexcept(derived().operator-=(other)))
 减法赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator*= (const boolean &other) noexcept(noexcept(derived().operator*=(other)))
 乘法赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator/= (const boolean &other)
 除法赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator%= (const boolean &other)
 取模赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator++ () noexcept(noexcept(derived().operator++()))
 前置自增运算符
NEFORCE_CONSTEXPR14 booleanoperator-- () noexcept(noexcept(derived().operator--()))
 前置自减运算符
Public 成员函数 继承自 ibinary< boolean >
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator& (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator&=(other)))
 按位与运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator| (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator|=(other)))
 按位或运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator^ (const boolean &other) const noexcept(noexcept(const_cast< boolean & >(derived()).operator^=(other)))
 按位异或运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator~ () const noexcept(noexcept(derived().operator~()))
 按位取反运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator<< (const uint32_t shift) const
 左移运算符
NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 boolean operator>> (const uint32_t shift) const
 右移运算符
NEFORCE_CONSTEXPR14 booleanoperator&= (const boolean &other) noexcept(noexcept(derived().operator&=(other)))
 按位与赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator|= (const boolean &other) noexcept(noexcept(derived().operator|=(other)))
 按位或赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator^= (const boolean &other) noexcept(noexcept(derived().operator^=(other)))
 按位异或赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator<<= (const uint32_t shift)
 左移赋值运算符
NEFORCE_CONSTEXPR14 booleanoperator>>= (const uint32_t shift)
 右移赋值运算符
Public 成员函数 继承自 iobject< boolean >
NEFORCE_CONSTEXPR20 bool try_parse (const string_view str) noexcept
 尝试从字符串解析对象
Public 成员函数 继承自 istringify< boolean >
NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string to_string () const
 转换为字符串

静态 Public 成员函数

static NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string to_string (const value_type value)
 将布尔值转换为字符串
static NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 boolean parse (const string_view lower)
 从字符串解析布尔值
静态 Public 成员函数 继承自 ipackage< boolean, bool >
static NEFORCE_NODISCARD constexpr size_t bytes () noexcept
 获取类型字节大小
static NEFORCE_NODISCARD constexpr size_t bits () noexcept
 获取类型位大小
静态 Public 成员函数 继承自 iobject< boolean >
static NEFORCE_NODISCARD constexpr boolean parse (const string_view str)
 从字符串解析对象

额外继承的成员函数

Public 类型 继承自 ipackage< boolean, bool >
using package_type
 包装类型
Protected 成员函数 继承自 ipackage< boolean, bool >
NEFORCE_CONSTEXPR20 ~ipackage ()=default
 受保护的析构函数
Protected 属性 继承自 ipackage< boolean, bool >
package_type value_
 存储的数值

详细描述

布尔值包装类

提供布尔值的包装,支持从字符串解析、转换为字符串、逻辑运算等功能。

在文件 packages.hpp29 行定义.

成员函数说明

◆ operator!()

boolean boolean::operator! ( ) const
inlineconstexprnoexcept

逻辑非操作符

返回
取反后的布尔对象

在文件 packages.hpp96 行定义.

引用了 ipackage< boolean, bool >::value_.

◆ parse()

NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 boolean boolean::parse ( const string_view lower)
inlinestatic

从字符串解析布尔值

参数
lower要解析的字符串视图
返回
解析得到的布尔对象
异常
typecast_exception解析失败时

支持多种格式:"true"/"false"、"yes"/"no"、"y"/"n", 以及数字(非零为真,零为假)。

在文件 packages.hpp74 行定义.

引用了 basic_string< CharT, Traits, Alloc >::lowercase(), to_int32(), basic_string_view< CharT, Traits >::trim() , 以及 basic_string< CharT, Traits, Alloc >::view().

◆ to_string() [1/2]

NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string boolean::to_string ( ) const
inline

将当前对象转换为字符串

返回
字符串表示("true"或"false")

在文件 packages.hpp63 行定义.

引用了 ipackage< boolean, bool >::value_.

◆ to_string() [2/2]

NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string boolean::to_string ( const value_type value)
inlinestatic

将布尔值转换为字符串

参数
value要转换的布尔值
返回
字符串表示("true"或"false")

在文件 packages.hpp55 行定义.

引用了 ipackage< boolean, bool >::value().


该结构体的文档由以下文件生成: