pdfium/testing/string_write_stream.h
Tom Sepez e1c2bcf6c1 Use more spans in streams, part 3.
Change-Id: I2f49fb07f21c49938aef1748b2c88eebf9d1d630
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100532
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
2022-11-02 19:29:55 +00:00

28 lines
658 B
C++

// Copyright 2018 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TESTING_STRING_WRITE_STREAM_H_
#define TESTING_STRING_WRITE_STREAM_H_
#include <sstream>
#include <string>
#include "core/fxcrt/fx_stream.h"
class StringWriteStream final : public IFX_RetainableWriteStream {
public:
StringWriteStream();
~StringWriteStream() override;
// IFX_WriteStream:
bool WriteBlock(pdfium::span<const uint8_t> buffer) override;
std::string ToString() const { return stream_.str(); }
private:
std::ostringstream stream_;
};
#endif // TESTING_STRING_WRITE_STREAM_H_