|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
字符串与数据类型之间的转换功能 更多...
函数 | |
| template<typename T, enable_if_t< is_base_of_v< istringify< T >, T >, int > = 0> | |
| constexpr string | neforce::to_string (const T &obj) |
| 将实现了istringify接口的对象转换为字符串 | |
| constexpr float32_t | neforce::to_float32 (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为32位浮点数 | |
| constexpr float64_t | neforce::to_float64 (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为64位浮点数 | |
| constexpr decimal_t | neforce::to_decimal (const string_view sv, size_t *idx=nullptr) |
| 将字符串转换为decimal浮点数 | |
| constexpr int64_t | neforce::to_int64 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为64位有符号整数 | |
| constexpr uint64_t | neforce::to_uint64 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为64位无符号整数 | |
| constexpr int32_t | neforce::to_int32 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为32位有符号整数 | |
| constexpr uint32_t | neforce::to_uint32 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为32位无符号整数 | |
| constexpr int16_t | neforce::to_int16 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为16位有符号整数 | |
| constexpr uint16_t | neforce::to_uint16 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为16位无符号整数 | |
| constexpr int8_t | neforce::to_int8 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为8位有符号整数 | |
| constexpr uint8_t | neforce::to_uint8 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为8位无符号整数 | |
| constexpr uint128_t | neforce::to_uint128 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为128位无符号整数 | |
| constexpr int128_t | neforce::to_int128 (const string_view sv, size_t *idx=nullptr, const int base=10) |
| 将字符串转换为128位有符号整数 | |
| template<typename T, typename P = package_t<T>, enable_if_t< is_packaged_v< T > &&is_base_of_v< istringify< P >, P >, int > = 0> | |
| constexpr string | neforce::to_string (const T &value) |
| 将可包装类型转换为字符串 | |
| constexpr string | neforce::to_string (nullptr_t np) |
| 将空指针转换为字符串 | |
| template<typename IfEmpty, typename T> | |
| constexpr string | neforce::to_string (const compressed_pair< IfEmpty, T, true > &obj) |
| 将压缩对(已压缩版本)转换为字符串 | |
| template<typename IfEmpty, typename T> | |
| constexpr string | neforce::to_string (const compressed_pair< IfEmpty, T, false > &obj) |
| 将压缩对(未压缩版本)转换为字符串 | |
| template<typename T1, typename T2> | |
| constexpr string | neforce::to_string (const pair< T1, T2 > &obj) |
| 将对转换为字符串 | |
| template<typename... Args> | |
| constexpr string | neforce::to_string (const tuple< Args... > &tup) |
| 将元组转换为字符串 | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | neforce::to_string_with_precision (T x, int precision, bool scientific=false) |
| 将浮点数转换为字符串(带精度控制) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | neforce::to_string_general (T x, int precision=6) |
| 将浮点数转换为字符串(通用格式) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | neforce::to_string_fixed (T x, int precision=6) |
| 将浮点数转换为字符串(固定小数格式) | |
| template<typename T, enable_if_t< is_floating_point< T >::value, int > = 0> | |
| constexpr string | neforce::to_string_scientific (T x, int precision=6) |
| 将浮点数转换为字符串(科学计数法格式) | |
字符串与数据类型之间的转换功能
|
nodiscardconstexpr |
将字符串转换为decimal浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 547 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_decimal().
被这些函数引用 to_decimal().
|
nodiscardconstexpr |
将字符串转换为32位浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 509 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_float32().
被这些函数引用 to_float32().
|
nodiscardconstexpr |
将字符串转换为64位浮点数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 528 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_float64().
被这些函数引用 to_float64().
|
nodiscardconstexpr |
将字符串转换为128位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 733 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_int128().
被这些函数引用 neforce::integer128::integer128(), operator""_i128(), neforce::integer128::parse() , 以及 to_int128().
|
nodiscardconstexpr |
将字符串转换为16位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 647 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max(), neforce::numeric_traits< T, Dummy >::min(), to_int16() , 以及 to_int32().
被这些函数引用 to_int16().
|
nodiscardconstexpr |
将字符串转换为32位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 607 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_int32().
被这些函数引用 neforce::boolean::parse(), to_int16(), to_int32() , 以及 to_int8().
|
nodiscardconstexpr |
将字符串转换为64位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 567 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_int64().
被这些函数引用 to_int64().
|
nodiscardconstexpr |
将字符串转换为8位有符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 680 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max(), neforce::numeric_traits< T, Dummy >::min(), to_int32() , 以及 to_int8().
被这些函数引用 to_int8().
|
nodiscardconstexpr |
将压缩对(未压缩版本)转换为字符串
| IfEmpty | 空基类类型 |
| T | 值类型 |
| obj | 压缩对 |
在文件 to_string.hpp 第 159 行定义.
引用了 to_string() , 以及 neforce::compressed_pair< IfEmpty, T, Compressed >::value.
|
nodiscardconstexpr |
将压缩对(已压缩版本)转换为字符串
| IfEmpty | 空基类类型 |
| T | 值类型 |
| obj | 压缩对 |
在文件 to_string.hpp 第 147 行定义.
引用了 to_string() , 以及 neforce::compressed_pair< IfEmpty, T, Compressed >::value.
|
nodiscardconstexpr |
将对转换为字符串
| T1 | 第一个类型 |
| T2 | 第二个类型 |
| obj | 对 |
在文件 to_string.hpp 第 171 行定义.
引用了 neforce::pair< T1, T2 >::first, neforce::pair< T1, T2 >::second , 以及 to_string().
|
nodiscardconstexpr |
将实现了istringify接口的对象转换为字符串
| T | 对象类型 |
| obj | 要转换的对象 |
全局辅助函数,用于方便地调用实现了istringify接口的对象的to_string方法。 仅当T是istringify<T>的派生类时可用。
在文件 istringify.hpp 第 68 行定义.
引用了 to_string().
|
nodiscardconstexpr |
将可包装类型转换为字符串
| T | 可包装类型 |
| value | 要转换的值 |
通过包装类型进行字符串转换,要求包装类型实现了istringify接口。
在文件 to_string.hpp 第 36 行定义.
引用了 to_string().
|
nodiscardconstexpr |
|
nodiscardconstexpr |
将浮点数转换为字符串(固定小数格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 503 行定义.
引用了 to_string_fixed().
被这些函数引用 neforce::formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()() , 以及 to_string_fixed().
|
nodiscardconstexpr |
将浮点数转换为字符串(通用格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 491 行定义.
引用了 to_string_general().
被这些函数引用 neforce::formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()() , 以及 to_string_general().
|
nodiscardconstexpr |
将浮点数转换为字符串(科学计数法格式)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
在文件 to_string.hpp 第 515 行定义.
被这些函数引用 neforce::formatter< T, enable_if_t< is_floating_point_v< T > > >::operator()() , 以及 to_string_scientific().
|
nodiscardconstexpr |
将浮点数转换为字符串(带精度控制)
| T | 浮点数类型 |
| x | 要转换的值 |
| precision | 精度 |
| scientific | 是否使用科学计数法 |
在文件 to_string.hpp 第 479 行定义.
引用了 to_string_with_precision().
被这些函数引用 to_string_with_precision().
|
nodiscardconstexpr |
将字符串转换为128位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 713 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_uint128().
被这些函数引用 operator""_u128(), neforce::uinteger128::parse(), to_uint128() , 以及 neforce::uinteger128::uinteger128().
|
nodiscardconstexpr |
将字符串转换为16位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 664 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max(), to_uint16() , 以及 to_uint32().
被这些函数引用 to_uint16().
|
nodiscardconstexpr |
将字符串转换为32位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 627 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_uint32().
被这些函数引用 to_uint16(), to_uint32() , 以及 to_uint8().
|
nodiscardconstexpr |
将字符串转换为64位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 587 行定义.
引用了 neforce::basic_string_view< CharT, Traits >::data() , 以及 to_uint64().
被这些函数引用 to_uint64().
|
nodiscardconstexpr |
将字符串转换为8位无符号整数
| sv | 要转换的字符串视图 |
| idx | 可选参数,存储转换结束位置索引 |
| base | 进制基数(0表示自动检测) |
| typecast_exception | 转换失败时 |
在文件 to_numerics.hpp 第 697 行定义.
引用了 neforce::numeric_traits< T, Dummy >::max(), to_uint32() , 以及 to_uint8().
被这些函数引用 to_uint8().