Namespaces
Variants

Standard library header <streambuf>

From cppreference.net
Standard library headers

이 헤더는 Input/Output 라이브러리의 일부입니다.

목차

클래스

원시 장치를 추상화함
(클래스 템플릿)
streambuf std:: basic_streambuf < char >
(typedef)
wstreambuf std:: basic_streambuf < wchar_t >
(typedef)

시놉시스

namespace std {
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_streambuf;
  using streambuf  = basic_streambuf<char>;
  using wstreambuf = basic_streambuf<wchar_t>;
}

클래스 템플릿 std::basic_streambuf

namespace std {
  template<class CharT, class Traits = char_traits<CharT>>
  class basic_streambuf {
  public:
    using char_type   = CharT;
    using int_type    = typename Traits::int_type;
    using pos_type    = typename Traits::pos_type;
    using off_type    = typename Traits::off_type;
    using traits_type = Traits;
    virtual ~basic_streambuf();
    // 로케일
    locale   pubimbue(const locale& loc);
    locale   getloc() const;
    // 버퍼 및 위치 지정
    basic_streambuf* pubsetbuf(char_type* s, streamsize n);
    pos_type pubseekoff(off_type off, ios_base::seekdir way,
                        ios_base::openmode which
                          = ios_base::in | ios_base::out);
    pos_type pubseekpos(pos_type sp,
                        ios_base::openmode which
                          = ios_base::in | ios_base::out);
    int      pubsync();
    // 읽기 및 쓰기 영역
    // 읽기 영역
    streamsize in_avail();
    int_type snextc();
    int_type sbumpc();
    int_type sgetc();
    streamsize sgetn(char_type* s, streamsize n);
    // 되돌리기
    int_type sputbackc(char_type c);
    int_type sungetc();
    // 쓰기 영역
    int_type   sputc(char_type c);
    streamsize sputn(const char_type* s, streamsize n);
  protected:
    basic_streambuf();
    basic_streambuf(const basic_streambuf& rhs);
    basic_streambuf& operator=(const basic_streambuf& rhs);
    void swap(basic_streambuf& rhs);
    // 읽기 영역 접근
    char_type* eback() const;
    char_type* gptr()  const;
    char_type* egptr() const;
    void       gbump(int n);
    void       setg(char_type* gbeg, char_type* gnext, char_type* gend);
    // 쓰기 영역 접근
    char_type* pbase() const;
    char_type* pptr() const;
    char_type* epptr() const;
    void       pbump(int n);
    void       setp(char_type* pbeg, char_type* pend);
    // 가상 함수
    // 로케일
    virtual void imbue(const locale& loc);
    // 버퍼 관리 및 위치 지정
    virtual basic_streambuf* setbuf(char_type* s, streamsize n);
    virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                             ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual pos_type seekpos(pos_type sp,
                             ios_base::openmode which
                               = ios_base::in | ios_base::out);
    virtual int      sync();
    // 읽기 영역
    virtual streamsize showmanyc();
    virtual streamsize xsgetn(char_type* s, streamsize n);
    virtual int_type   underflow();
    virtual int_type   uflow();
    // 되돌리기
    virtual int_type   pbackfail(int_type c = Traits::eof());
    // 쓰기 영역
    virtual streamsize xsputn(const char_type* s, streamsize n);
    virtual int_type   overflow(int_type c = Traits::eof());
  };
}

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 56 C++98 showmanyc 의 반환 타입이 개요에서 int 로 되어 있었음 streamsize 로 수정됨