Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

basic_stringbuf


basic_stringbufinherits frombasic_streambuf

Summary

Associates the input or output sequence with a sequence of arbitrary characters.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <sstream> 
template<class charT, class traits = char_traits<charT>,
         class Allocator = allocator<charT> >
class basic_stringbuf
: public basic_streambuf<charT, traits>

Description

The class basic_stringbuf is derived from basic_streambuf. Its purpose is to associate the input or output sequence with a sequence of arbitrary characters. The sequence can be initialized from, or made available as, an object of class basic_string. Each object of type basic_stringbuf<charT, traits,Allocator> controls two character sequences:

Note: see basic_streambuf.

The two sequences are related to each other, but are manipulated separately. This allows you to read and write characters at different positions in objects of type basic_stringbuf without any conflict (as opposed to the basic_filebuf objects, in which a joint file position is maintained).

Interface

Types

char_type
ios_type
off_type
pos_type
string_type
stringbuf 
traits_type
wstringbuf

Constructors

explicit basic_stringbuf(ios_base::openmode which =
                ios_base::in | ios_base::out); 
explicit basic_stringbuf(const string_type& str,
                ios_base::openmode which =
                ios_base::in | ios_base::out); 

Destructors

virtual ~basic_stringbuf();

Member Functions

int_type 
overflow(int_type c = traits::eof() ); 
int_type 
pbackfail( int_type c = traits::eof() ); 
pos_type 
seekoff(off_type off, ios_base::seekdir way,
        ios_base::openmode which = 
        ios_base::in | ios_base::out); 
pos_type 
seekpos(pos_type sp,ios_base::openmode which = 
        ios_base::in | ios_base::out); 
basic_streambuf<charT,traits>* 
setbuf(char_type*s, streamsize n); 
string_type 
str() const; 
void 
str(const string_type& str_arg); 
int_type 
underflow();
streamsize 
xsputn(const char_type* s, streamsize n); 

Example

See Also

char_traits(3C++),ios_base(3C++), basic_ios(3C++), basic_streambuf(3C++), basic_string(3C++), basic_istringstream(3C++), basic_ostringstream(3C++), basic_stringstream(3C++)

Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.7.1

Standards Conformance

ANSI X3J16/ISO WG21 Joint C++ Committee



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998