AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ISeekableInputStream.h
    1#pragma once
    2
    3#include "IInputStream.h"
    4
    5
    6enum class ASeekDir {
   10    BEGIN,
   11
   15    CURRENT,
   16
   20    END
   21};
   22
   28public:
   29    ~ISeekableInputStream() override = default;
   33    virtual void seek(std::streamoff offset, ASeekDir seekDir) = 0;
   34
   39    [[nodiscard]] virtual std::streampos tell() noexcept = 0;
   40
   45    virtual bool isEof() = 0;
   46
   51    size_t fileSize() {
   52        auto current = tell();
   53        seek(0, ASeekDir::END);
   54        auto size = tell();
   55        seek(current, ASeekDir::BEGIN);
   56        return size;
   57    }
   58};
Represents an input stream.
Definition IInputStream.h:26
Represents an input stream with updating reading position.
Definition ISeekableInputStream.h:27
size_t fileSize()
return size of the stream
Definition ISeekableInputStream.h:51
virtual bool isEof()=0
returns true if end of stream has been reached
virtual std::streampos tell() noexcept=0
return current reading position
virtual void seek(std::streamoff offset, ASeekDir seekDir)=0
change reading position, a way of changing depends on seekDir parameter