diff options
Diffstat (limited to 'common/substream.h')
-rw-r--r-- | common/substream.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/common/substream.h b/common/substream.h index ecf11c54c9..f4f79ff02f 100644 --- a/common/substream.h +++ b/common/substream.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef COMMON_SUBSTREAM_H @@ -102,6 +99,25 @@ public: } }; +/** + * A seekable substream that removes the exclusivity demand required by the + * normal SeekableSubReadStream, at the cost of seek()ing the parent stream + * before each read(). + * + * More than one SafeSubReadStream to the same parent stream can be used + * at the same time; they won't mess up each other. They will, however, + * reposition the parent stream, so don't depend on its position to be + * the same after a read() or seek() on one of its SafeSubReadStream. + */ +class SafeSubReadStream : public SeekableSubReadStream { +public: + SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO) : + SeekableSubReadStream(parentStream, begin, end, disposeParentStream) { + } + + virtual uint32 read(void *dataPtr, uint32 dataSize); +}; + } // End of namespace Common |