Skip to content

Commit d525412

Browse files
Comments updates (aws#90)
* Cleaned up interface and docs for the InputStream interface.
1 parent 4510a1f commit d525412

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

include/aws/crt/io/Stream.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ namespace Aws
4848
InputStream(InputStream &&) = delete;
4949
InputStream &operator=(InputStream &&) = delete;
5050

51-
explicit operator bool() const noexcept { return IsGood(); }
52-
53-
virtual bool IsGood() const noexcept = 0;
51+
explicit operator bool() const noexcept { return IsValid(); }
52+
virtual bool IsValid() const noexcept = 0;
5453

5554
aws_input_stream *GetUnderlyingStream() noexcept { return &m_underlying_stream; }
5655

@@ -67,8 +66,6 @@ namespace Aws
6766
* @return true on success, false otherwise. Return false, when there is nothing left to read.
6867
* You SHOULD raise an error via aws_raise_error()
6968
* if an actual failure condition occurs.
70-
* If you return false, GetStatusImpl() will be called to determine
71-
* the validity of the stream.
7269
*/
7370
virtual bool ReadImpl(ByteBuf &buffer) noexcept = 0;
7471

@@ -90,7 +87,7 @@ namespace Aws
9087
* all error's are cleared if possible.
9188
*
9289
* @return true on success, false otherwise. You SHOULD raise an error via aws_raise_error()
93-
* if a failure occurs. If you return false, the m_good flag will be set to false.
90+
* if a failure occurs.
9491
*/
9592
virtual bool SeekImpl(OffsetType offset, StreamSeekBasis seekBasis) noexcept = 0;
9693

@@ -114,7 +111,7 @@ namespace Aws
114111
std::shared_ptr<Aws::Crt::Io::IStream> stream,
115112
Aws::Crt::Allocator *allocator = DefaultAllocator()) noexcept;
116113

117-
bool IsGood() const noexcept override;
114+
bool IsValid() const noexcept override;
118115

119116
protected:
120117
bool ReadImpl(ByteBuf &buffer) noexcept override;

source/io/Stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ namespace Aws
109109
{
110110
}
111111

112-
bool StdIOStreamInputStream::IsGood() const noexcept
112+
bool StdIOStreamInputStream::IsValid() const noexcept
113113
{
114114
auto status = GetStatusImpl();
115115
return status.is_valid;

tests/StreamTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int s_StreamTestCreateDestroyWrapper(struct aws_allocator *allocator, voi
3232
auto stringStream = Aws::Crt::MakeShared<std::stringstream>(allocator, "SomethingInteresting");
3333
Aws::Crt::Io::StdIOStreamInputStream inputStream(stringStream, allocator);
3434

35-
ASSERT_TRUE(inputStream.IsGood());
35+
ASSERT_TRUE(static_cast<bool>(inputStream));
3636
ASSERT_NOT_NULL(inputStream.GetUnderlyingStream());
3737
}
3838

0 commit comments

Comments
 (0)