std::basic_istringstream
来自 cppreference.cn
定义于头文件 <sstream> |
||
template< class CharT, |
||
类模板 std::basic_istringstream
对基于字符串的流实现输入操作。它有效地存储 std::basic_string 的实例并对其执行输入操作。
在底层,该类实际上将 std::basic_stringbuf 的原始字符串设备实现封装到 std::basic_istream 的高级接口中。提供了 std::basic_stringbuf 唯一成员的完整接口。
继承图
提供了用于常见字符类型的几个 typedef
定义于头文件
<sstream> | |
类型 | 定义 |
std::istringstream
|
std::basic_istringstream<char> |
std::wistringstream
|
std::basic_istringstream<wchar_t> |
目录 |
[编辑] 成员类型
成员类型 | 定义 |
char_type
|
CharT |
traits_type
|
Traits ;若 Traits::char_type 非 CharT 则程序非良构。 |
int_type
|
Traits::int_type |
pos_type
|
Traits::pos_type |
off_type
|
Traits::off_type |
allocator_type
|
Allocator |
[编辑] 仅供说明的成员
名称 | 定义 |
sb |
用作底层缓冲区的 std::basic_stringbuf<CharT, Traits, Allocator> (仅用于阐释的成员对象*) |
[编辑] 成员函数
构造字符串流 (public member function) | |
(C++11) |
移动字符串流 (public member function) |
(C++11) |
交换两个字符串流 (public member function) |
返回底层原始字符串设备对象 (public member function) | |
字符串操作 | |
获取或设置底层字符串设备对象的内容 (public member function) | |
(C++20) |
获取底层字符串设备对象内容的视图 (public member function) |
[编辑] 非成员函数
特化 std::swap 算法 (function template) |
继承自 std::basic_istream
成员函数
格式化输入 | |
提取格式化数据 (public member function of std::basic_istream<CharT,Traits> ) | |
非格式化输入 | |
提取字符 (public member function of std::basic_istream<CharT,Traits> ) | |
读取下一个字符而不提取它 (public member function of std::basic_istream<CharT,Traits> ) | |
取消提取字符 (public member function of std::basic_istream<CharT,Traits> ) | |
将字符放入输入流 (public member function of std::basic_istream<CharT,Traits> ) | |
提取字符直到找到给定字符 (public member function of std::basic_istream<CharT,Traits> ) | |
提取并丢弃字符直到找到给定字符 (public member function of std::basic_istream<CharT,Traits> ) | |
提取字符块 (public member function of std::basic_istream<CharT,Traits> ) | |
提取已有的字符块 (public member function of std::basic_istream<CharT,Traits> ) | |
返回上次未格式化输入操作提取的字符数 (public member function of std::basic_istream<CharT,Traits> ) | |
定位 | |
返回输入位置指示符 (public member function of std::basic_istream<CharT,Traits> ) | |
设置输入位置指示符 (public member function of std::basic_istream<CharT,Traits> ) | |
杂项 | |
与底层存储设备同步 (public member function of std::basic_istream<CharT,Traits> ) |
成员类
为输入操作准备流实现基本逻辑 (public member class of std::basic_istream<CharT,Traits> ) |
继承自 std::basic_ios
成员类型
成员类型 | 定义 |
char_type
|
CharT
|
traits_type
|
特性
|
int_type
|
Traits::int_type
|
pos_type
|
Traits::pos_type
|
off_type
|
Traits::off_type
|
成员函数
状态函数 | |
检查是否没有发生错误,即 I/O 操作可用 (public member function of std::basic_ios<CharT,Traits> ) | |
检查是否已到达文件末尾 (public member function of std::basic_ios<CharT,Traits> ) | |
检查是否发生错误 (public member function of std::basic_ios<CharT,Traits> ) | |
检查是否发生不可恢复的错误 (public member function of std::basic_ios<CharT,Traits> ) | |
检查是否发生错误(fail() 的同义词) (public member function of std::basic_ios<CharT,Traits> ) | |
检查是否没有发生错误(! fail() 的同义词)(public member function of std::basic_ios<CharT,Traits> ) | |
返回状态标志 (public member function of std::basic_ios<CharT,Traits> ) | |
设置状态标志 (public member function of std::basic_ios<CharT,Traits> ) | |
修改状态标志 (public member function of std::basic_ios<CharT,Traits> ) | |
格式化 | |
复制格式化信息 (public member function of std::basic_ios<CharT,Traits> ) | |
管理填充字符 (public member function of std::basic_ios<CharT,Traits> ) | |
杂项 | |
管理异常掩码 (public member function of std::basic_ios<CharT,Traits> ) | |
设置区域设置 (public member function of std::basic_ios<CharT,Traits> ) | |
管理关联的流缓冲区 (public member function of std::basic_ios<CharT,Traits> ) | |
管理绑定的流 (public member function of std::basic_ios<CharT,Traits> ) | |
窄化字符 (public member function of std::basic_ios<CharT,Traits> ) | |
宽化字符 (public member function of std::basic_ios<CharT,Traits> ) |
继承自 std::ios_base
成员函数
格式化 | |
管理格式标志 (public member function of std::ios_base ) | |
设置特定格式标志 (public member function of std::ios_base ) | |
清除特定格式标志 (public member function of std::ios_base ) | |
管理浮点运算的十进制精度 (public member function of std::ios_base ) | |
管理字段宽度 (public member function of std::ios_base ) | |
区域设置 | |
设置区域设置 (public member function of std::ios_base ) | |
返回当前区域设置 (public member function of std::ios_base ) | |
内部可扩展数组 | |
[静态] |
返回一个程序范围内的唯一整数,可安全用作 pword() 和 iword() 的索引 (public static member function of std::ios_base ) |
如有必要,调整私有存储的大小,并访问给定索引处的 long 元素 (public member function of std::ios_base ) | |
如有必要,调整私有存储的大小,并访问给定索引处的 void* 元素 (public member function of std::ios_base ) | |
杂项 | |
注册事件回调函数 (public member function of std::ios_base ) | |
[静态] |
设置 C++ 和 C I/O 库是否可互操作 (public static member function of std::ios_base ) |
成员类 | |
流异常 (public member class of std::ios_base ) | |
初始化标准流对象 (public member class of std::ios_base ) |
成员类型和常量 | |||||||||||||||||||||||||||||||||||||||
类型 | 解释 | ||||||||||||||||||||||||||||||||||||||
流打开模式类型 还定义了以下常量
(typedef) | |||||||||||||||||||||||||||||||||||||||
格式化标志类型 还定义了以下常量
(typedef) | |||||||||||||||||||||||||||||||||||||||
流状态类型 还定义了以下常量
(typedef) | |||||||||||||||||||||||||||||||||||||||
定位方向类型 还定义了以下常量
(typedef) | |||||||||||||||||||||||||||||||||||||||
指定事件类型 (enum) | |||||||||||||||||||||||||||||||||||||||
回调函数类型 (typedef) |