C++ ライブラリ・リファレンス

iostream ライブラリのインタフェースの変更

この項では、libC ライブラリを「MT-安全」にするために、libC ライブラリのインタフェースがどのように変更されたかを説明します。

新しいクラス

次の表は、iostream インタフェースに新しく追加されたクラスのリストです。


例 4-7 新しいクラス

stream_MT								
stream_locker								
unsafe_ios								
unsafe_istream								
unsafe_ostream								
unsafe_iostream								
unsafe_fstreambase								
unsafe_strstreambase								

新しいクラス階層

次の表は、iostream インタフェースに新しく追加されたクラス階層のリストです。


例 4-8 新しいクラス階層

class streambuf : public stream_MT { ... };
class unsafe_ios { ... };
class ios : virtual public unsafe_ios, public stream_MT  {...};
class unsafe_fstreambase : virtual public unsafe_ios { ... };
class fstreambase : virtual public ios, public unsafe_fstreambase { ... };
class unsafe_strstreambase : virtual public unsafe_ios { ... };
class strstreambase : virtual public ios, public unsafe_strstreambase { ... };
class unsafe_istream : virtual public unsafe_ios  { ... };
class unsafe_ostream : virtual public unsafe_ios  { ... };
class istream : virtual public ios, public unsafe_istream { ... };
class ostream : virtual public ios, public unsafe_ostream { ... };
class unsafe_iostream : public unsafe_istream, public unsafe_ostream { ... };

新しい関数

次の表は、libC インタフェースに新しく追加された関数のリストです。


例 4-9 新しい関数

class streambuf {
public:
     int sgetc_unlocked();
     void sgetn_unlocked(char *, int);
     int snextc_unlocked();
     int sbumpc_unlocked();
     void stossc_unlocked();
     int in_avail_unlocked();
     int sputbackc_unlocked(char);
     int sputc_unlocked(int);
     int sputn_unlocked(const char *, int);
     int out_waiting_unlocked();
protected:
     char* base_unlocked();
     char* ebuf_unlocked();
     int blen_unlocked();
     char* pbase_unlocked();
     char* eback_unlocked();
     char* gptr_unlocked();
     char* egptr_unlocked();					
     char* pptr_unlocked();						
     void setp_unlocked(char*, char*);				
     void setg_unlocked(char*, char*, char*);			
     void pbump_unlocked(int);					
     void gbump_unlocked(int);					
     void setb_unlocked(char*, char*, int);				
     int unbuffered_unlocked();					
     char *epptr_unlocked();						
     void unbuffered_unlocked(int);					
     int allocate_unlocked(int);					
};

class filebuf : public streambuf {
public:
     int is_open_unlocked();					
     filebuf* close_unlocked();					
     filebuf* open_unlocked(const char*, int, int=filebuf::openprot);

     filebuf* attach_unlocked(int);		
};

class strstreambuf : public streambuf {
public:
     int freeze_unlocked();		
     char* str_unlocked();				
};

unsafe_ostream& endl(unsafe_ostream&);					
unsafe_ostream& ends(unsafe_ostream&);					
unsafe_ostream& flush(unsafe_ostream&);					
unsafe_istream& ws(unsafe_istream&);
unsafe_ios& dec(unsafe_ios&);				
unsafe_ios& hex(unsafe_ios&);						
unsafe_ios& oct(unsafe_ios&);													
char* dec_r (char* buf, int buflen, long num, int width)
char* hex_r (char* buf, int buflen, long num, int width)
char* oct_r (char* buf, int buflen, long num, int width) 
char* chr_r (char* buf, int buflen, long chr, int width)
char* str_r (char* buf, int buflen, const char* format, int width = 0);
char* form_r (char* buf, int buflen, const char* format, ...)