diff options
author | Eli Lipsitz <elipsitz@google.com> | 2022-08-09 01:57:55 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-09 01:57:55 +0000 |
commit | 557254a6ac704058a29e0d6f4f908d76327b2be6 (patch) | |
tree | 85e9c4d752e8a92b55fb0bda8efa19732e3d1085 /pw_string | |
parent | d645b9248bcc56c2df3ffc2063988ebd6ebf9989 (diff) | |
download | pigweed-557254a6ac704058a29e0d6f4f908d76327b2be6.tar.gz |
pw_software_update: Make OpenableReader::reader virtual
OpenableReader is a wrapper around a StreamReader that needs open/close
management. It exposes a method, `reader`, to access the reader, with
the contract that this may only be used when the OpenableReader is open.
OpenableReader stores a reference to the underlying reader inside of
itself (and it must take the reference in the superclass constructor).
However, it's entirely possible that the underlying StreamReader doesn't
exist until Open is called (for example, if the underlying reader is a
StdFileReader, reading from the filesystem).
This commit addresses this use-case by making the `reader()` accessor
virtual, and clarifies how it must be used in the header.
This commit also adds a default virtual destructor to OpenableReader,
which was missing.
Change-Id: I31d462ca8cb6a68d8dffd91d0c69a315cd91c67d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/105177
Pigweed-Auto-Submit: Eli Lipsitz <elipsitz@google.com>
Reviewed-by: Ali Zhang <alizhang@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'pw_string')
0 files changed, 0 insertions, 0 deletions