std::basic_stringstream
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <sstream> 中定义
|
||
template< class CharT, |
(until C++11) | |
template< class CharT, |
(since 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 (since 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
成员函数
| |
读取带格式的数据 (公共成员函数of std::basic_istream )
| |
| |
读取字符 (公共成员函数of std::basic_istream )
| |
读取下一个字符,而不删除 原文: reads the next character without extracting it (公共成员函数of std::basic_istream )
| |
放回字符 (公共成员函数of std::basic_istream )
| |
将字符放到输入流中 (公共成员函数of std::basic_istream )
| |
读取字符,直到发现给定的字符 原文: extracts characters until the given character is found (公共成员函数of std::basic_istream )
| |
读取并丢弃字符,直到发现给定的字符 原文: extracts and discards characters until the given character is found (公共成员函数of std::basic_istream )
| |
读取字符块 (公共成员函数of std::basic_istream )
| |
读取已经可用的字符块 原文: extracts already available blocks of characters (公共成员函数of std::basic_istream )
| |
返回上次非格式化输入操作提取的字符数量 原文: returns number of characters extracted by last unformatted input operation (公共成员函数of std::basic_istream )
| |
| |
返回输入位置指示器 原文: returns the input position indicator (公共成员函数of std::basic_istream )
| |
设置输入位置指示器 (公共成员函数of std::basic_istream )
| |
| |
与底层存储设备同步 原文: synchronizes with the underlying storage device (公共成员函数of std::basic_istream )
|
成员类
实现这个流为输入操作准备的基本逻辑 (公共成员类of std::basic_istream )
|
继承自 std::basic_ostream
成员函数
| |
插入格式化的数据 (公共成员函数of std::basic_ostream )
| |
| |
插入字符 (公共成员函数of std::basic_ostream )
| |
插入字符块 (公共成员函数of std::basic_ostream )
| |
| |
返回输出位置指示器 原文: returns the output position indicator (公共成员函数of std::basic_ostream )
| |
设置输出位置指示器 (公共成员函数of std::basic_ostream )
| |
| |
与底层存储设备同步 原文: synchronizes with the underlying storage device (公共成员函数of std::basic_ostream )
|
成员类
实现这个流为输出操作准备的基本逻辑 原文: implements basic logic for preparation of the stream for output operations (公共成员类of 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操作 (公共成员函数of std::basic_ios )
| |
检查是否到达了文件末尾 (公共成员函数of std::basic_ios )
| |
检查是否发生了可恢复的错误 (公共成员函数of std::basic_ios )
| |
检查,如果已经发生了不可恢复的错误 原文: checks if a non-recoverable error has occurred (公共成员函数of std::basic_ios )
| |
检查是否有错误发生(fail()的同义词) (公共成员函数of std::basic_ios )
| |
(until C++11) (since C++11) |
检查是否没有发生错误(!fail()的同义词) (公共成员函数of std::basic_ios )
|
返回状态标志 (公共成员函数of std::basic_ios )
| |
设置状态标志 (公共成员函数of std::basic_ios )
| |
清除错误和EOF标志 (公共成员函数of std::basic_ios )
| |
| |
复制格式化信息 (公共成员函数of std::basic_ios )
| |
管理填充字符 (公共成员函数of std::basic_ios )
| |
| |
管理异常掩码 (公共成员函数of std::basic_ios )
| |
设置语言环境 (公共成员函数of std::basic_ios )
| |
管理相关的流缓冲区 (公共成员函数of std::basic_ios )
| |
管理绑定的流 (公共成员函数of std::basic_ios )
| |
缩小字符 (公共成员函数of std::basic_ios )
| |
拓宽字符 (公共成员函数of std::basic_ios )
|
继承自 std::ios_base
成员函数
格式化 | |
管理格式的标志 (公共成员函数of std::ios_base )
| |
设置特定格式的标志 (公共成员函数of std::ios_base )
| |
清除特定格式的标志 (公共成员函数of std::ios_base )
| |
管理浮点操作的精度 (公共成员函数of std::ios_base )
| |
管理域的宽度 (公共成员函数of std::ios_base )
| |
语言环境 | |
设置区域 (公共成员函数of std::ios_base )
| |
返回当前的区域设置 (公共成员函数of std::ios_base )
| |
内部可扩展的数组 | |
[静态的]</div></div>
|
返回一个程序范围内唯一的整数,它可以安全用于 PWORD() 和 iword() 的下标 (公共静态成员函数of std::ios_base )
|
如果有必要的话,调整私有存储的大小,并且访问位于提供的下标的long元素 (公共成员函数of std::ios_base )
| |
如果有必要的话,调整私有存储的大小,并且访问位于提供的下标的void*元素 原文: resizes the private storage if necessary and access to the void* element at the given index (公共成员函数of std::ios_base )
| |
杂项 | |
注册事件回调函数 (公共成员函数of std::ios_base )
| |
[静态的]</div></div>
|
设置C++和C的IO库是否可以互操作 (公共静态成员函数of std::ios_base )
|
成员类 | |
流异常 (公共成员类of std::ios_base )
| |
初始化标准流对象 (公共成员类of 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) |
</div>