Move the position associated with this object according to the specified offset and whence:
Synopsis
Declared in <bdlde_utf8checkinginstreambufwrapper.h>
virtual
pos_type
seekoff(
off_type offset,
std::ios_base::seekdir whence,
std::ios_base::openmode mode) override;
Description
* If whence is bsl::ios_base::beg, set the position to offset bytes from the beginning. * If whence is bsl::ios_base::cur, advance the position by offset bytes (note that offset is signed). * whence == bsl::ios_base::end is unsupported and a seek fail will result.
A seek can fail if
* the object was already in a failed seek state and the seek was not an absolute seek to the beginning, * the object is not bound to a held streambuf, * whence is not bsl::ios_base::beg or bsl::ios_base::cur, * the destination is negative, * the destination is forward of the current position, or * a seek on the held streambuf is necessary and that streambuf does not support seeking,
which will put the object into a failed seek state. When the object is in a failed seek state, errorStatus() will equal k_SEEK_FAIL and the object will no longer have a valid position, meaning that input and relative seeks will fail, until the object is made to recover by either calling reset or an absolute seek to position 0.
If a seek is performed on the held streambuf, the specified mode will be propagated to it. The behavior is undefined unless bsl::ios_base::in is set in mode. Note that this function is forwarded to by the public method pubseekoff in the base class.
seekoff(0, bsl::ios_base::cur, mode) is permissible whether the held streambuf is seekable or not and will never result in a seek on the held streambuf, returning the position in terms of the held streambuf if that streambuf is seekable and returning the position relative to when the held streambuf was bound to this object otherwise.
Some non‐zero seeks will be performed without a seek on the held streambuf, but there is no simple way for the client to predict when this will be the case.
Created with MrDocs