1 #ifndef IMAGE_IO_BASE_OSTREAM_DATA_DESTINATION_H_ // NOLINT 2 #define IMAGE_IO_BASE_OSTREAM_DATA_DESTINATION_H_ // NOLINT 3 4 #include <memory> 5 #include <utility> 6 7 #include "image_io/base/ostream_ref_data_destination.h" 8 9 namespace photos_editing_formats { 10 namespace image_io { 11 12 /// A DataDestination that writes its output to an ostream. 13 class OStreamDataDestination : public OStreamRefDataDestination { 14 public: 15 /// Constructs an OStreamDataDestination using the given ostream. 16 /// @param ostream_ptr The ostream to which data is written. 17 /// @param message_handler An option message handler for writing messages. OStreamDataDestination(std::unique_ptr<std::ostream> ostream_ptr,MessageHandler * message_handler)18 OStreamDataDestination(std::unique_ptr<std::ostream> ostream_ptr, 19 MessageHandler* message_handler) 20 : OStreamRefDataDestination(*ostream_ptr, message_handler), 21 ostream_(std::move(ostream_ptr)) {} 22 23 private: 24 /// The ostream that is owned by this data destination. 25 std::unique_ptr<std::ostream> ostream_; 26 }; 27 28 } // namespace image_io 29 } // namespace photos_editing_formats 30 31 #endif // IMAGE_IO_BASE_OSTREAM_DATA_DESTINATION_H_ // NOLINT 32