Wednesday, January 20, 2010

The basic_ostream(ostream) Class








Class Name basic_ostream

Header File <ostream>

Classification Input/Output (Format Class)

Class Relationship Diagram



Class Description

Member Classes



basic_ios

sentry


Methods




explicit basic_ostream(basic_streambuf* Sb)

virtual ~basic_ostream()

basic_ostream& put(char_type CharValue)

basic_ostream& write(const char_type* Str, streamsize Num)

basic_ostream& flush()

pos_type tellp()

basic_ostream& seekp(pos_type Pos)

basic_ostream& seekp(off_type Pos, ios_base::seekdir Dir)





Class Description




The basic_ostream class implements the notion of the object oriented output stream. This
object oriented output stream can be a binary stream or a text stream. The object
oriented stream can be buffered, or unbuffered. The basic_ostream class has facilities
to process single characters, or blocks of characters. When characters or blocks of
characters are sent to an basic_ostream object the operation is referred to as insertion.
The cout and wcout objects are examples of basic_ostream objects that have been pre-defined.






Method basic_ostream()

Access Public

Classification Constructor

Syntax explicit basic_ostream(basic_streambuf* Sb)

Parameters Sb is the buffer object that will be used for the ostream
object.

Return None



Description



This basic_ostream() method is used to construct an object of type basic_ostream.







Method basic_ostream()

Access Public

Classification Constructor

Syntax virtual ~basic_ostream()

Parameters None

Return None



Description



This basic_ostream() method is used to destruct an object of type basic_ostream.







Method put()

Access Public

Classification Modifier

Syntax basic_ostream<charT,traits>& put(char_type CharValue)

Parameters CharValue is the character that is inserted into the
output stream

Return This method returns a reference to the current ostream object.



Description



The put() method is used to insert a character into the output stream.







Method write()

Access Public

Classification Modifier

Syntax basic_ostream<charT,traits>& write(const char_type* Str, streamsize Num)

Parameters Num characters are inserted into the output stream starting at the location
pointed to by Str.


Return This method returns a reference to the current ostream object.



Description



The write() method is used to insert a character into the output stream. The insertion
operation will continue until Num characters are inserted into the output stream or
until an error condition occurs. If the output operation fails an exception may
be thrown e.g.



ios_base::failure








Method flush()

Access Public

Classification Modifier

Syntax basic_ostream<charT,traits>& flush()

Parameters None

Return This method returns a reference to the current ostream object.



Description



The flush() method has the effect of calling sync.







Method tellp()

Access Public

Classification Accessor

Syntax pos_type tellp()

Parameters None

Return This method returns the current put position.



Description



The tellp() method returns the current position of put pointer in the output stream.







Method seekp()

Access Public

Classification Modifier

Syntax basic_ostream<charT,traits>& seekp(pos_type Pos)

Parameters Pos is the position in the output stream that the point pointer
will be moved to.

Return This method returns a reference to the current ostream object.



Description



The seekp() method performs an absolute seek Pos from the beginning of the output
stream.







Method seekp()

Access Public

Classification Modifier

Syntax basic_ostream<charT,traits>& seekp(off_type Pos, ios_base::seekdir Dir)

Parameters Pos is the position in the output stream that the point pointer
will be moved to relative Dir. Dir can have the following
values

ios_base::beg
ios_base::cur
ios_base::end

Return This method returns a reference to the current ostream object.



Description



The seekp() method performs an relative seek to Pos from the direction specified by
Dir.




The Class Relationship Diagram of basic_ostream






No comments: