diff options
author | Max Kellermann <max@duempel.org> | 2014-05-11 18:34:09 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-05-12 18:59:46 +0200 |
commit | 0b4fa41aff35ac8d190e5daaeed12f12614a0e9c (patch) | |
tree | 02da5a37e93198e969a28072b555595292ce688b /src/input/InputStream.hxx | |
parent | e138e2c880d2e5ae4728bd821e3a2789cb605a11 (diff) | |
download | mpd-0b4fa41aff35ac8d190e5daaeed12f12614a0e9c.tar.gz mpd-0b4fa41aff35ac8d190e5daaeed12f12614a0e9c.tar.xz mpd-0b4fa41aff35ac8d190e5daaeed12f12614a0e9c.zip |
InputStream: "protect" attributes
Diffstat (limited to 'src/input/InputStream.hxx')
-rw-r--r-- | src/input/InputStream.hxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index 13f6af32b..5f754940b 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -64,6 +64,7 @@ public: */ Cond &cond; +protected: /** * indicates whether the stream is ready for reading and * whether the other attributes in this struct are valid @@ -80,7 +81,6 @@ public: */ offset_type size; -public: /** * the current offset within the stream */ @@ -218,6 +218,13 @@ public: } gcc_pure + bool KnownSize() const { + assert(ready); + + return size >= 0; + } + + gcc_pure offset_type GetSize() const { assert(ready); @@ -240,6 +247,15 @@ public: } gcc_pure + offset_type GetRest() const { + assert(ready); + assert(size >= 0); + assert(offset >= 0); + + return size - offset; + } + + gcc_pure bool IsSeekable() const { assert(ready); |