名前空間
変種
操作

std::basic_stringbuf::str

提供: cppreference.com
< cpp‎ | io‎ | basic stringbuf

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
ファイルI / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
文字列I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
アレイのI / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
エラーカテゴリインターフェース
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_stringbuf
パブリックメンバ関数
Original:
Public member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_stringbuf::basic_stringbuf
basic_stringbuf::operator=(C++11)
basic_stringbuf::swap(C++11)
basic_stringbuf::str
メンバ関数を保護しました
Original:
Protected member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_stringbuf::underflow
basic_stringbuf::pbackfail
basic_stringbuf::overflow
basic_stringbuf::setbuf
basic_stringbuf::seekoff
basic_stringbuf::seekpos
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap(std::basic_stringbuf)(C++11)
 
std::basic_string<CharT, Traits, Allocator> str() const;
(1)
void str( const std::basic_string<CharT, Traits, Allocator>& s);
(2)
基になる文字列を取得または設定します.
Original:
Gets and sets the underlying string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
作成し、このstd::basic_stringの基礎となる文字列のコピーを含むstd::basic_stringbufオブジェクトを返します。入力専用のストリームでは、返される文字列は、範囲[eback(), egptr())から文字が含まれています。入力/出力または出力専用のストリームでは、関係なくpbase()egptr()epptr()からシーケンスの最後の文字が含まれています.
Original:
Creates and returns a std::basic_string object containing a copy of this std::basic_stringbuf's underlying character sequence. For input-only streams, the returned string contains the characters from the range [eback(), egptr()). For input/output or output-only streams, contains the characters from pbase() to the last character in the sequence regardless of egptr() and epptr().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
削除このstd::basic_stringbuf全体の基礎となる文字列を、次にsの内容のコピーを含む新しい基礎となる文字列を設定します。 std::basic_streambufのポインタは次のように初期化されます
Original:
Deletes the entire underlying character sequence of this std::basic_stringbuf and then configures a new underlying character sequence containing a copy of the contents of s. The pointers of std::basic_streambuf are initialized as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
入力ストリーム(mode & ios_base::in == true)については、eback()最初の文字を指差し、gptr() == eback()、とegptr() == eback() + s.size():その後の入力はsからコピーされた最初の文字を読み取ります。.
Original:
For input streams (mode & ios_base::in == true), eback() points at the first character, gptr() == eback(), and egptr() == eback() + s.size(): the subsequent input will read the first character copied from s.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
出力ストリームのための(mode & ios_base::out == true)、最初の文字と、pbase()epptr() >= pbase() + s.size()ポイント(epptrが次sputc()は直ちにoverflow()を呼び出すことはありませんことを遠いので指すように許容されています)
Original:
For output streams (mode & ios_base::out == true), pbase() points at the first character and epptr() >= pbase() + s.size() (epptr is allowed to point farther so that the following sputc() wouldn't immediately call overflow())
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
追記ストリーム(mode & ios_base::ate == true)については、pptr() == pbase() + s.size()ので、後続の出力はs(C + + 11以来)からコピーされた最後の文字に付加されます
Original:
For append streams (mode & ios_base::ate == true), pptr() == pbase() + s.size(), so that subsequent output will be appended to the last character copied from s (C + + 11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
無付加機能出力ストリーム、pptr() == pbase()については、その結果、後続の出力がsからコピーした文字を上書きしてしまいます.
Original:
For no-appending output streams, pptr() == pbase(), so that subsequent output will overwrite the characters copied from s.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

s -
置換文字列を保持する文字列オブジェクト
Original:
a string object holding the replacement character sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

1)
文字列オブジェクトは、現在のバッファーの基礎となる文字列のコピーを保持している.
Original:
A string object holding a copy of this buffer's underlying character sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
(なし)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] ノート

この関数は、通常std::basic_stringstream::str()を介してアクセスされる.
Original:
This function is typically accessed through std::basic_stringstream::str().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <sstream>
#include <iostream>
int main()
{
    int n;
 
    std::istringstream in;  // could also use in("1 2")
    in.rdbuf()->str("1 2"); // set the get area
    in >> n;
    std::cout << "after reading the first int from \"1 2\", the int is " 
              << n << ", str() = \"" << in.rdbuf()->str() << "\"\n"; // or in.str()
 
    std::ostringstream out("1 2");
    out << 3;
    std::cout << "after writing the int '3' to output stream \"1 2\""
              << ", str() = \"" << out.str() << "\"\n";
 
    std::ostringstream ate("1 2", std::ios_base::ate); // C++11
    ate << 3;
    std::cout << "after writing the int '3' to append stream \"1 2\""
              << ", str() = \"" << ate.str() << "\"\n";
}

Output:

after reading the first int from "1 2", the int is 1, str() = "1 2"
after writing the int '3' to output stream "1 2", str() = "3 2"
after writing the int '3' to append stream "1 2", str() = "1 23"

[編集] も参照してください

基になる文字列デバイスオブジェクトの内容を取得または設定します
Original:
gets or sets the contents of underlying string device object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数of std::basic_stringstream) [edit]