Library: Input/output
Does not inherit
fpos() operator!=() operator+() |
operator+=() operator-() operator-=() |
operator==() state() state_type |
streamoff() |
Class that maintains position information for the iostream classes
#include <rw/iotraits> namespace std { template<class stateT> class fpos; }
The class template fpos is used by the iostream classes to maintain position information. It maintains the absolute position within the external sequence, and the conversion state at that position. Streams instantiated on narrow characters use streampos as their positioning type, whereas streams instantiated on wide characters use wstreampos.
namespace std { template <class stateT> class fpos { public: typedef stateT state_type; fpos(streamoff off = 0, state_type = state_type()); void state(state_type); state_type state() const; fpos& operator+=(streamoff); fpos& operator-=(streamoff); fpos& operator+(streamoff) const; fpos& operator-(streamoff) const; bool operator==(const fpos&) const; bool operator+=(const fpos&) const; }; }
state_type
The type state_type is an alias for the template parameter stateT.
fpos(streamoff off = 0, state_type st = state_type());
Constructs an fpos object, initializing its position with off and its conversion state with st.
state_type state() const;
Returns the conversion state stored in the fpos object.
void state(state_type st);
Stores st as the new conversion state in the fpos object.
operator streamoff() const;
Returns the offset part of the fpos object without the state information.
fpos& operator+=(streamoff off); fpos& operator-=(streamoff off);
Adds or subtracts off to or from an fpos object and assigns the result to it.
fpos& operator+(streamoff off) const; fpos& operator-(streamoff off) const;
Adds or subtracts off to or from an fpos object.
bool operator==(const fpos&) const; bool operator!=(const fpos&) const;
Compares two fpos objects for [in]equality.
In the following,
P refers to type fpos<stateT>
p and q refer to a value of type fpos<stateT>
O refers to the offset type (streamoff, wstreamoff, long ...)
o refers to a value of the offset type
i refers to a value of type int
Valid operations:
P p( i ); |
Constructs from int |
P p = i; |
Assigns from int |
P( o ) |
Converts from offset |
O( p ) |
Converts to offset |
p == q |
Tests for equality |
p != q |
Tests for inequality |
q = p + o |
Adds offset |
p += o |
Adds offset |
q = p -o |
Subtracts offset |
q -= o |
Subtracts offset |
o = p - q |
Returns offset |
ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 27.4.3. See also ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.