Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

basic_stringbuf

Library:  Input/output


basic_stringbuf basic_streambuf

Local Index

Members

Non-Members

Summary

Class that associates the input or output sequence with a sequence of arbitrary characters

Synopsis

#include <sstream> 

namespace std {
  template<class charT, class traits = char_traits<charT>,
           class Allocator = allocator<charT> >
  class basic_stringbuf;
}

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 controls two character sequences:

See basic_streambuf for more information.

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

Member Types

char_type
ios_type
off_type
pos_type
traits_type

Nonmember Types

stringbuf 
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); 

Member Functions

int_type 
overflow(int_type c = traits_type::eof()); 
int_type 
pbackfail(int_type c = traits_type::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); 
basic_string<char_type, traits_type, Allocator>
str() const; 
void 
str(const basic_string<char_type, traits_type, Allocator>& str);
int_type 
underflow();
streamsize 
xsputn(const char_type* s, streamsize n); 

Example

See Also

char_traits, ios_base, basic_ios, basic_streambuf, basic_string, basic_istringstream, basic_ostringstream, basic_stringstream

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 27.7.1



Previous fileTop of DocumentContentsIndex pageNext file