std::basic_stringstream
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 定义于头文件 <sstream>
|
||
| template< class CharT, |
(C++11 前) | |
| template< class CharT, |
(C++11 起) | |
类模板
basic_stringstream实现了基于流的内存(std::basic_string)上的输入操作。它的实质是将一个原始字符串设备的实现(basic_stringbuf)包装为更高级别的接口(basic_iostream)。它提供了basic_stringbuf成员的完整接口。原文:
The class template
basic_stringstream implements input/output operations on memory (std::basic_string) based streams. It essentially wraps a raw string device implementation (basic_stringbuf) into a higher-level interface (basic_iostream). The complete interface to unique basic_stringbuf members is provided.为常见的字符类型定义了两个特化:
原文:
Two specializations for common character types are also defined:
| 定义于头文件
<sstream> | |
| 类型
|
定义 |
stringstream
|
basic_stringstream<char> |
wstringstream
|
basic_stringstream<wchar_t> |
[编辑] 成员类型
| 成员类型
|
定义 |
char_type
|
CharT |
traits_type
|
Traits |
int_type
|
Traits::int_type |
pos_type
|
Traits::pos_type |
off_type
|
Traits::off_type |
allocator_type
|
Allocator (C++11 起) |
[编辑] 成员函数
| 构造字符串流 (公开成员函数) | |
| (C++11) |
移动字符串流 (公开成员函数) |
| (C++11) |
交换两个字符串流 (公开成员函数) |
| 返回底层的原始字符串设备对象 原文: returns the underlying raw string device object (公开成员函数) | |
| |
| 获取或设置底层字符串设备对象的内容 原文: gets or sets the contents of underlying string device object (公开成员函数) |
继承自 std::basic_istream
成员函数
| |
| 抽取带格式的数据 ( std::basic_istream 的公开成员函数)
| |
| |
| 读取字符 ( std::basic_istream 的公开成员函数)
| |
| 读取下一个字符,而不删除 原文: reads the next character without extracting it ( std::basic_istream 的公开成员函数)
| |
| 放回字符 ( std::basic_istream 的公开成员函数)
| |
| 将字符放到输入流中 ( std::basic_istream 的公开成员函数)
| |
| 读取字符,直到发现给定的字符 原文: extracts characters until the given character is found ( std::basic_istream 的公开成员函数)
| |
| 读取并丢弃字符,直到发现给定的字符 原文: extracts and discards characters until the given character is found ( std::basic_istream 的公开成员函数)
| |
| 读取字符块 ( std::basic_istream 的公开成员函数)
| |
| 读取已经可用的字符块 原文: extracts already available blocks of characters ( std::basic_istream 的公开成员函数)
| |
| 返回上次非格式化输入操作提取的字符数量 原文: returns number of characters extracted by last unformatted input operation ( std::basic_istream 的公开成员函数)
| |
| |
| 返回输入位置指示器 原文: returns the input position indicator ( std::basic_istream 的公开成员函数)
| |
| 设置输入位置指示器 ( std::basic_istream 的公开成员函数)
| |
| |
| 与底层存储设备同步 原文: synchronizes with the underlying storage device ( std::basic_istream 的公开成员函数)
|
成员类
| 实现这个流为输入操作准备的基本逻辑 ( std::basic_istream 的公开成员类)
|
继承自 std::basic_ostream
成员函数
| |
| 插入格式化的数据 ( std::basic_ostream 的公开成员函数)
| |
| |
| 插入字符 ( std::basic_ostream 的公开成员函数)
| |
| 插入字符块 ( std::basic_ostream 的公开成员函数)
| |
| |
| 返回输出位置指示器 原文: returns the output position indicator ( std::basic_ostream 的公开成员函数)
| |
| 设置输出位置指示器 ( std::basic_ostream 的公开成员函数)
| |
| |
| 与底层存储设备同步 原文: synchronizes with the underlying storage device ( std::basic_ostream 的公开成员函数)
|
成员类
| 实现这个流为输出操作准备的基本逻辑 原文: implements basic logic for preparation of the stream for output operations ( std::basic_ostream 的公开成员类)
|
继承自 std::basic_ios
成员类型
| 成员类型
|
定义 |
char_type
|
CharT |
traits_type
|
Traits |
int_type
|
Traits::int_type |
pos_type
|
Traits::pos_type |
off_type
|
Traits::off_type |
| |
| 检查是否没有发生错误,例如是否可执行I/O操作 ( std::basic_ios 的公开成员函数)
| |
| 检查是否到达了文件末尾 ( std::basic_ios 的公开成员函数)
| |
| 检查是否发生了可恢复的错误 ( std::basic_ios 的公开成员函数)
| |
| 检查,如果已经发生了不可恢复的错误 原文: checks if a non-recoverable error has occurred ( std::basic_ios 的公开成员函数)
| |
| 检查是否有错误发生(fail() 的同义词) ( std::basic_ios 的公开成员函数)
| |
| (C++11 前) (C++11 起) |
检查是否没有发生错误(!fail()的同义词) ( std::basic_ios 的公开成员函数)
|
| 返回状态标志 ( std::basic_ios 的公开成员函数)
| |
| 设置状态标志 ( std::basic_ios 的公开成员函数)
| |
| 清除错误和EOF标志 ( std::basic_ios 的公开成员函数)
| |
| |
| 复制格式化信息 ( std::basic_ios 的公开成员函数)
| |
| 管理填充字符 ( std::basic_ios 的公开成员函数)
| |
| |
| 管理异常掩码 ( std::basic_ios 的公开成员函数)
| |
| 设置语言环境 ( std::basic_ios 的公开成员函数)
| |
| 管理相关的流缓冲区 ( std::basic_ios 的公开成员函数)
| |
| 管理绑定的流 ( std::basic_ios 的公开成员函数)
| |
| 缩小字符 ( std::basic_ios 的公开成员函数)
| |
| 拓宽字符 ( std::basic_ios 的公开成员函数)
|
继承自 std::ios_base
成员函数
格式化 | |
| 管理格式的标志 ( std::ios_base 的公开成员函数)
| |
| 设置特定格式的标志 ( std::ios_base 的公开成员函数)
| |
| 清除特定格式的标志 ( std::ios_base 的公开成员函数)
| |
| 管理浮点操作的精度 ( std::ios_base 的公开成员函数)
| |
| 管理域的宽度 ( std::ios_base 的公开成员函数)
| |
语言环境 | |
| 设置区域 ( std::ios_base 的公开成员函数)
| |
| 返回当前的区域设置 ( std::ios_base 的公开成员函数)
| |
内部可扩展的数组 | |
| [静态] |
返回一个程序范围内唯一的整数,它可以安全用于 PWORD() 和 iword() 的下标 ( std::ios_base 的公开静态成员函数)
|
| 如果有必要的话,调整私有存储的大小,并且访问位于提供的下标的long元素 ( std::ios_base 的公开成员函数)
| |
| 如果有必要的话,调整私有存储的大小,并且访问位于提供的下标的void*元素 原文: resizes the private storage if necessary and access to the void* element at the given index ( std::ios_base 的公开成员函数)
| |
杂项 | |
| 注册事件回调函数 ( std::ios_base 的公开成员函数)
| |
| [静态] |
设置C++和C的IO库是否可以互操作 ( std::ios_base 的公开静态成员函数)
|
成员类 | |
| 流异常 ( std::ios_base 的公开成员类)
| |
| 初始化标准流对象 ( std::ios_base 的公开成员类)
|
成员类型和常量 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 类型 | 解释 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 流开放的模式类型
有以下常量的定义:
(typedef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 格式化标志类型
有以下常量的定义:
原文: formatting flags type
The following constants are also defined:
(typedef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 流类型的状态
有以下常量的定义:
(typedef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| seeking direction type
The following constants are also defined:
(typedef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 指定事件类型 (枚举) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 回调函数类型 (typedef) |


