标准库头文件 <strstream>

来自cppreference.com
< cpp‎ | header
 
 
 

此头文件是输入/输出库的一部分。

目录

(C++98 中弃用)
实现无修饰字符数组设备
(类) [编辑]
(C++98 中弃用)
实现字符数组输入操作
(类) [编辑]
(C++98 中弃用)
实现字符数组输出操作
(类) [编辑]
(C++98 中弃用)
实现字符数组输入/输出操作
(类) [编辑]

[编辑] 概要

namespace std {
    class strstreambuf;
    class istrstream;
    class ostrstream;
    class strstream;
}

[编辑] std::strstreambuf

class strstreambuf : public basic_streambuf<char> {
 public:
    explicit strstreambuf(streamsize alsize_arg = 0);
    strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
    strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
    strstreambuf(const char* gnext_arg, streamsize n);
    strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0);
    strstreambuf(const signed char* gnext_arg, streamsize n);
    strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);
    strstreambuf(const unsigned char* gnext_arg, streamsize n);
    virtual ~strstreambuf();
 
    void freeze(bool freezefl = true);
    char* str();
    int pcount();
 
 protected:
    virtual int_type overflow (int_type c = EOF);
    virtual int_type pbackfail(int_type c = EOF);
    virtual int_type underflow();
    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 streambuf* setbuf(char* s, streamsize n);
 
 private:
    typedef /*bitmask type*/ strstate; // 仅为说明
    static const strstate allocated; // 仅为说明
    static const strstate constant; // 仅为说明
    static const strstate dynamic; // 仅为说明
    static const strstate frozen; // 仅为说明
    strstate strmode; // 仅为说明
    streamsize alsize; // 仅为说明
    void* (*palloc)(size_t); // 仅为说明
    void (*pfree)(void*); // 仅为说明
};

[编辑] std::istrstream

class istrstream : public basic_istream<char> {
 public:
    explicit istrstream(const char* s);
    explicit istrstream(char* s);
    istrstream(const char* s, streamsize n);
    istrstream(char* s, streamsize n);
    virtual ~istrstream();
 
    strstreambuf* rdbuf() const;
    char *str();
 
 private:
    strstreambuf sb; // 仅为说明
};

[编辑] std::ostrstream

class ostrstream : public basic_ostream<char> {
 public:
    ostrstream();
    ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
    virtual ~ostrstream();
 
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    char* str();
    int pcount() const;
 
 private:
    strstreambuf sb; // 仅为说明
};

[编辑] std::strstream

class strstream : public basic_iostream<char> {
 public:
    // 类型
    typedef char char_type;
    typedef typename char_traits<char>::int_type int_type;
    typedef typename char_traits<char>::pos_type pos_type;
    typedef typename char_traits<char>::off_type off_type;
 
    // 构造函数/析构函数
    strstream();
    strstream(char* s, int n,
    ios_base::openmode mode = ios_base::in|ios_base::out);
    virtual ~strstream();
 
    // 成员:
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();
 
 private:
    strstreambuf sb; // 仅为说明
};