Namespaces
Variants

std:: strstreambuf

From cppreference.net
< cpp ‎ | io
헤더에 정의됨 <strstream>
class strstreambuf : public std:: basic_streambuf < char >
(C++98에서 사용 중단됨)
(C++26에서 제거됨)

std::strstreambuf 는 연결된 문자 시퀀스가 문자 배열인 std::basic_streambuf 입니다. 이 배열은 상수(예: 문자열 리터럴), 수정 가능하지만 동적이지 않은(예: 스택 할당 배열), 또는 동적일 수 있습니다. 동적 배열의 경우 std::strstreambuf 는 출력을 수용하기 위해 필요에 따라 배열 재할당이 허용될 수 있습니다(예: delete [ ] new [ ] 호출 또는 사용자 제공 함수를 통해).

일반적인 std::strstreambuf 구현은 네 개의 비공개 데이터 멤버를 보유합니다:

1) 버퍼 상태, "할당됨(allocated)" (소멸자가 할당 해제함), "상수(constant)" (출력 허용 안됨), "동적(dynamic)" (출력 시 재할당 가능), 또는 "고정(frozen)" (할당 해제 및 재할당 불가)의 네 가지 값 중 임의의 조합을 나타낼 수 있는 비트마스크 타입
2) 할당된 버퍼 크기 (버퍼의 시작 부분은 특별한 데이터 멤버가 필요하지 않으며, 상속된 포인터 eback() 에 저장될 수 있음)
3) 사용자 제공 할당 함수에 대한 포인터
4) 사용자 제공 할당 해제 함수에 대한 포인터.

목차

참고 사항

동적 버퍼를 가진 스트림에서 str() 호출 후에는 freeze(false) 호출이 필요하며, 이는 strstreambuf 소멸자가 필요한 경우 버퍼를 할당 해제할 수 있도록 허용합니다.

strstreambuf 는 C++98부터 사용 중단되었으며 C++26부터 제거되었습니다 . 권장 대체자는 std::spanbuf (C++23부터) 입니다.

멤버 함수

Public member functions

strstreambuf 객체를 생성합니다
(public member function)
[virtual]
strstreambuf 객체를 소멸시키며, 선택적으로 문자 배열을 해제합니다
(virtual public member function)
버퍼의 고정 상태를 설정/해제합니다
(public member function)
버퍼를 고정 상태로 표시하고 입력 시퀀스의 시작 포인터를 반환합니다
(public member function)
출력 시퀀스에서 다음 포인터에서 시작 포인터를 뺀 값을 반환합니다: 기록된 문자 수
(public member function)

Protected member functions

[virtual]
다음 포인터를 이동시키지 않고 입력 시퀀스에서 문자를 읽습니다
(virtual protected member function)
[virtual]
입력 시퀀스를 되돌려 문자를 unget합니다
(virtual protected member function)
[virtual]
출력 시퀀스에 문자를 추가하며, 동적이고 고정되지 않은 경우 버퍼를 재할당하거나 초기 할당할 수 있습니다
(virtual protected member function)
[virtual]
제어되는 문자 시퀀스를 배열로 대체하려고 시도합니다
(virtual protected member function)
[virtual]
상대 주소 지정을 사용하여 입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터의 위치를 재조정합니다
(virtual protected member function)
[virtual]
절대 주소 지정을 사용하여 입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터의 위치를 재조정합니다
(virtual protected member function)

std:: basic_streambuf 에서 상속됨

멤버 타입

멤버 타입 정의
char_type CharT
traits_type Traits ; Traits::char_type CharT 가 아닌 경우 프로그램은 ill-formed입니다.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type

멤버 함수

[virtual]
basic_streambuf 객체를 파괴함
( std::basic_streambuf<CharT,Traits> 의 virtual public 멤버 함수)
로케일
연결된 로케일을 변경하고 imbue ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
연결된 로케일의 복사본을 얻음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
위치 지정
setbuf ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
seekoff ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
seekpos ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
sync ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 영역
입력 영역에서 즉시 사용 가능한 문자 수를 얻음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스를 진행시킨 후, 다시 진행하지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
(C++17에서 제거됨)
입력 시퀀스에서 한 문자를 읽고 시퀀스를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스에서 시퀀스를 진행시키지 않고 한 문자를 읽음
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
xsgetn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
출력 영역
출력 영역에 한 문자를 쓰고 다음 포인터를 진행시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
xsputn ( ) 를 호출함
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
되돌리기
입력 시퀀스에 한 문자를 되돌림
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)
입력 시퀀스의 다음 포인터를 하나 뒤로 이동시킴
( std::basic_streambuf<CharT,Traits> 의 public 멤버 함수)

보호된 멤버 함수

basic_streambuf 객체를 생성합니다
(protected 멤버 함수)
(C++11)
basic_streambuf 객체를 대체함
(보호된 멤버 함수)
(C++11)
두 개의 basic_streambuf 객체를 교환
(보호된 멤버 함수)
로케일
[virtual]
연결된 로캘 변경에 반응함
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
포지셔닝
[virtual]
사용자 정의 배열로 버퍼를 교체합니다(허용되는 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 상대 주소 지정을 사용하여 재위치합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected member function)
[virtual]
입력 시퀀스, 출력 시퀀스 또는 둘 모두에서 다음 포인터를 절대 주소 지정을 사용하여 재위치합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 문자 시퀀스와 버퍼를 동기화합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
영역 가져오기
[virtual]
연결된 입력 시퀀스에서 사용 가능한 문자 수를 확인합니다(알려진 경우)
( std::basic_streambuf<CharT,Traits> 의 virtual protected member function)
[virtual]
연관된 입력 시퀀스에서 문자를 읽어 get 영역으로 가져옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
연관된 입력 시퀀스로부터 문자를 읽어 get 영역으로 가져오고 다음 포인터를 전진시킴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
[virtual]
입력 시퀀스에서 여러 문자를 읽어옴
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
get 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(protected 멤버 함수)
입력 시퀀스의 다음 포인터를 전진시킴
(protected member function)
입력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(protected member function)
Put 영역
[virtual]
출력 시퀀스에 여러 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 가상 protected 멤버 함수)
[virtual]
put 영역에서 연관된 출력 시퀀스로 문자를 기록합니다
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)
출력 영역의 시작, 현재 문자 및 끝에 대한 포인터를 반환합니다
(보호된 멤버 함수)
출력 시퀀스의 다음 포인터를 전진시킴
(protected 멤버 함수)
출력 시퀀스의 시작, 다음, 끝 포인터 위치를 재설정합니다
(보호된 멤버 함수)
Putback
[virtual]
입력 시퀀스에 문자를 다시 넣으며, 입력 시퀀스를 수정할 수 있음
( std::basic_streambuf<CharT,Traits> 의 virtual protected 멤버 함수)