.\" ident @(#)fpos.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH fpos 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2fpos\fP \ - Maintains position information fort he iostream classes. .SH SYNOPSIS .br #include .br template .br class fpos .SH DESCRIPTION The template class_fpos is used by the iostream classes to maintain position information. It maintains three kinds of information: the absolute position, the conversion state and the validity of the stored position. Streams instantiated on tiny characters use streampos_as their positioning type, whereas streams instantiated on wide characters use wstreampos, but both are defined as fpos. .SH INTERFACE .br template .br class fpos { .br .br public: .RE .RS 10 .RE .RS 1 typedef stateT state_type; .RE .RS 0 .RE .RS 1 fpos(long off = 0); .br fpos(state_type); .RE .RS 0 .RE .RS 1 bool good(); .br operator long(); .RE .RS 0 .RE .RS 1 long offset() cont; .br long offset(long); .RE .RS 0 .RE .RS 1 state_type state(state_type); .br state_type state () const; .RE .RS 0 .RE .RS 1 long pos() const; .br long pos(long); .RE .RS 0 .br }; .SH TYPES .br state_type .RE .RS 3 The type \f2state_type\fP holds the conversion state, and is compatible with the function \f2locale::codecvt()\fP. By default it is defined as \f2mbstate_t\fP. .RE .SH PUBLIC CONSTRUCTORS .br fpos(long off =0); .RE .RS 3 Constructs an \f2fpos\fP object, initializing its position with \f2off\fP and its conversion state with the default \f2stateT\fP constructor. This function is not described in the C++ standard. .RE .br fpos(state_type st); .RE .RS 3 Constructs an \f2fpos\fP object, initializing its conversion state with \f2st\fP, its position with the start position, and its status to \f2good\fP. .RE .SH PUBLIC MEMBER FUNCTIONS .br state_type .br state() const; .RE .RS 3 Returns the conversion state stored in the \f2fpos\fP object. .RE .br state_type .br state(state_type st); .RE .RS 3 Stores \f2st\fP as the new conversion state in the \f2fpos\fP object and returns its previous value. .RE .br bool good(); .RE .RS 3 Returns the status of the \f2fpos\fP object. Offset(\f2-1\fP) indicates an invalid value and returns \f2false\fP. .RE .br operator long(); .RE .RS 3 Converts \f2fpos\fP object to absolute displacement. This operator is handy when used with functions such as \f2tellp()\fP or \f2tellg()\fP to get absolute displacement. .RE .br long .br offset() const; .RE .RS 3 Returns the signed displacement in the fpos object. .RE .br long .br offset(long off); .RE .RS 3 Stores \f2off\fP as the new signed displacement in the \f2fpos\fP object and returns its previous value. .RE .br long .br pos() const; .RE .RS 3 Returns the absolute position in the fpos object. .RE .br long .br offset(long pos); .RE .RS 3 Stores \f2pos\fP as the new absolute position in the \f2fpos\fP object and returns its previous value. .RE .SH VALID OPERATIONS In the following, .HP .5i \(bu \f2P\fP refers to type\f2 fpos\fP .HP .5i \(bu \f2p\fP and \f2q\fP refer to a value of type \f2fpos\fP .HP .5i \(bu \f2O\fP refers to the offset type (\f2streamoff\fP, \f2wstreamoff\fP, \f2long\fP ) .HP .5i \(bu \f2o\fP refers to a value of the offset type .HP .5i \(bu \f2i\fP refers to a value of type \f2int\fP .HP 0 Valid operations: .HP 13 \f2P p( I ); \fPConstructs from \f2int\fP .HP 0 .HP 11 \f2P p = i; \fPAssigns from \f2int\fP .HP 0 .HP 9 \f2P( o ) \fPConverts from offset .HP 0 .HP 9 \f2O( p ) \fPConverts to offset .HP 0 .HP 9 \f2p == q \fPTests for equality .HP 0 .HP 9 \f2p != q \fPTests for inequality .HP 0 .HP 12 \f2q = p + o \fPAdds offset .HP 0 .HP 9 \f2p += o \fPAdds offset .HP 0 .HP 11 \f2q = p -o \fPSubtracts offset .HP 0 .HP 9 \f2q -= o \fPSubtracts offset .HP 0 .HP 12 \f2o = p - q \fPReturns offset .HP 0 .SH SEE ALSO iosfwd(3C++), char_traits(3C++) Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.4. Amendment 1 to the C Standard. .SH STANDARDS CONFORMANCE ANSI X3J16/ISO WG21 Joint C++ Committee