1 #ifndef IMAGE_IO_BASE_ISTREAM_DATA_SOURCE_H_ // NOLINT 2 #define IMAGE_IO_BASE_ISTREAM_DATA_SOURCE_H_ // NOLINT 3 4 #include <memory> 5 #include <utility> 6 7 #include "image_io/base/istream_ref_data_source.h" 8 9 namespace photos_editing_formats { 10 namespace image_io { 11 12 /// A DataSource that obtains data from an istream that it owns. 13 class IStreamDataSource : public IStreamRefDataSource { 14 public: 15 /// Constructs an IStreamDataSource using the given istream. 16 /// @param istram_ptr The istream from which to read. 17 explicit IStreamDataSource(std::unique_ptr<std::istream> istream_ptr) 18 : IStreamRefDataSource(*istream_ptr), istream_(std::move(istream_ptr)) {} 19 20 private: 21 /// The istream that is owned by this data source. 22 std::unique_ptr<std::istream> istream_; 23 }; 24 25 } // namespace image_io 26 } // namespace photos_editing_formats 27 28 #endif // IMAGE_IO_BASE_ISTREAM_DATA_SOURCE_H_ // NOLINT 29