POD object indicating the position of an item in a stream. More...
#include <tpie/compressed/stream_position.h>
Public Member Functions | |
stream_position () | |
Default constructor resulting in a not-a-stream_position. More... | |
stream_size_type | offset () const |
The stream offset of the item pointed to. More... | |
bool | operator== (const stream_position &other) const |
bool | operator!= (const stream_position &other) const |
bool | operator< (const stream_position &other) const |
Total ordering of stream_position objects. More... | |
Static Public Member Functions | |
static stream_position | beginning () |
Convenience constructor returning a pointer to the beginning. More... | |
static stream_position | end () |
Special-value constructor returning a pointer to the end. More... | |
Friends | |
class | compressed_stream_base |
template<typename T > | |
class | file_stream |
std::ostream & | operator<< (std::ostream &s, const stream_position &p) |
POD object indicating the position of an item in a stream.
The object returned by stream_position::beginning is equal to any position object returned by a stream that points to the beginning of the stream.
On the other hand, the object returned by stream_position::end is special: It is never returned by file_stream::get_position; instead, the object tells set_position to perform the equivalent of seek(0, end). The object resulting from the default constructor stream_position() is also special and should never be passed to set_position.
The offset() method of an ordinary stream_position object indicates the offset of the item in the stream that is pointed to. The values stream_position().offset() and stream_position::end().offset() are not well-defined and should not be relied on to have any particular value; instead, check for equality to respectively stream_position() and stream_position::end().
The less-than operator defines a total order and is derived from the values returned by offset() with an implementation-defined tiebreaker in case offset() are equal.
It is guaranteed that any ordinary position is ordered before stream_position::end(), but the ordering of stream_position objects with regards to the special values stream_position() and stream_position::end() may otherwise be subject to change in the future.
Definition at line 72 of file stream_position.h.
|
inline |
Default constructor resulting in a not-a-stream_position.
Definition at line 101 of file stream_position.h.
Referenced by beginning(), and end().
|
inlinestatic |
Convenience constructor returning a pointer to the beginning.
Definition at line 85 of file stream_position.h.
References stream_position().
|
inlinestatic |
Special-value constructor returning a pointer to the end.
Definition at line 92 of file stream_position.h.
References stream_position().
Referenced by tpie::file_stream< tpie::stream_position >::set_position().
|
inline |
The stream offset of the item pointed to.
Definition at line 123 of file stream_position.h.
Referenced by tpie::file_stream< tpie::stream_position >::describe(), tpie::file_stream< tpie::stream_position >::set_position(), and tpie::file_stream< tpie::stream_position >::truncate().
|
inline |
Total ordering of stream_position objects.
See the class documentation for more information.
Definition at line 151 of file stream_position.h.