zipios::VirtualSeeker(3) | zipios | zipios::VirtualSeeker(3) |
NAME¶
zipios::VirtualSeeker - A virtual class used to see in a file embedded in another.
SYNOPSIS¶
#include <virtualseeker.hpp>
Public Member Functions¶
VirtualSeeker (offset_t start_offset=0,
offset_t end_offset=0)
Create a virtual seeker. offset_t endOffset () const
Return the end offset. void getOffsets (offset_t
&start_offset, offset_t &end_offset) const
Retrieve the current offsets. void setOffsets (offset_t
start_offset, offset_t end_offset)
Set the offsets of the virtual seeker. offset_t startOffset ()
const
Return the start offset. void vseekg (std::istream &is,
offset_t offset, std::ios::seekdir sd) const
Seek within the embedded file. std::streampos vtellg (std::istream
&is) const
Current position within the sub-file.
Private Attributes¶
offset_t m_end_offset = 0
offset_t m_start_offset = 0
Detailed Description¶
The virtual seeker class is a simple definition of an object that keeps track of a set of specified (virtual) file pointers that mark start and end of a file inside another.
An example of its use (and its reason for existence) is to keep track of the file endings of a Zip file embedded in another file (see the appendzip tool and the ZipFile::openEmbeddedZipFile() function).
Bug
Definition at line 46 of file virtualseeker.hpp.
Constructor & Destructor Documentation¶
zipios::VirtualSeeker::VirtualSeeker (offset_t start_offset = 0, offset_t end_offset = 0)¶
This constructor defines a virtual seeker start and end offsets on initialization. By default it is initialized to a transparent seeker since the start and end are set to zero.
Note
Warning
The class is not attached to one specific input stream so there is no way to verify that the offsets are valid (i.e. not representing an empty virtual file or having offsets completely outside of the available range.)
Exceptions
Parameters
end_offset The end offset of the embedded file.
Definition at line 92 of file virtualseeker.cpp.
References m_end_offset, and m_start_offset.
Member Function Documentation¶
offset_t zipios::VirtualSeeker::endOffset () const¶
This function returns a copy of the end offset.
Returns
Definition at line 161 of file virtualseeker.cpp.
References m_end_offset.
void zipios::VirtualSeeker::getOffsets (offset_t & start_offset, offset_t & end_offset) const¶
This function retrieves the start and end offsets from the virtual seeker object.
Parameters
end_offset Returns the end offset.
Definition at line 136 of file virtualseeker.cpp.
References m_end_offset, and m_start_offset.
void zipios::VirtualSeeker::setOffsets (offset_t start_offset, offset_t end_offset)¶
This function can be used to change the virtual seeker offsets.
Exceptions
Parameters
end_offset The new end offset.
Definition at line 115 of file virtualseeker.cpp.
References m_end_offset, and m_start_offset.
offset_t zipios::VirtualSeeker::startOffset () const¶
This function returns a copy of the start offset.
Returns
Definition at line 149 of file virtualseeker.cpp.
References m_start_offset.
Referenced by zipios::ZipFile::getInputStream().
void zipios::VirtualSeeker::vseekg (std::istream & is, offset_t offset, std::ios::seekdir sd) const¶
This function changes the file pointer in is to the position specified in offset.
The direction can be indicated by sd.
Parameters
offset Relative position to set the input pointer to.
sd The stream direction to use to apply offset.
Definition at line 178 of file virtualseeker.cpp.
References m_end_offset, and m_start_offset.
Referenced by zipios::BackBuffer::BackBuffer(), zipios::ZipFile::init(), and zipios::BackBuffer::readChunk().
std::streampos zipios::VirtualSeeker::vtellg (std::istream & is) const¶
This function calculates the position (file current pointer) within the embedded file in the specified stream.
If the position in the existing file is too large or too small, then the function returns -1.
Parameters
Returns
Todo
Definition at line 218 of file virtualseeker.cpp.
References m_start_offset.
Referenced by zipios::BackBuffer::BackBuffer(), and zipios::ZipFile::init().
Member Data Documentation¶
offset_t zipios::VirtualSeeker::m_end_offset = 0 [private]¶
Definition at line 60 of file virtualseeker.hpp.
Referenced by VirtualSeeker(), endOffset(), getOffsets(), setOffsets(), and vseekg().
offset_t zipios::VirtualSeeker::m_start_offset = 0 [private]¶
Definition at line 59 of file virtualseeker.hpp.
Referenced by VirtualSeeker(), getOffsets(), setOffsets(), startOffset(), vseekg(), and vtellg().
Author¶
Generated automatically by Doxygen for zipios from the source code.
Sat Dec 30 2023 01:18:29 | Version 2.3.2 |