xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
string_writer.h
Go to the documentation of this file.
1 #pragma once
5 
6 #include <sstream>
7 #include "text_writer.h"
8 
10 namespace xtd {
12  namespace io {
20  public:
22  string_writer() = default;
25  string_writer(const xtd::ustring& str);
26 
29  const std::ostream& base_stream() const noexcept;
32  std::ostream& base_stream() noexcept;
33 
36  void flush() override;
37 
38  xtd::ustring to_string() const noexcept override;
39 
43  void write(const xtd::ustring& value) override;
44  private:
45  std::stringstream stream_;
46  };
47  }
48 }
xtd::ustring to_string() const noexcept override
Returns a std::string that represents the current object.
string_writer()=default
Initializes a new instance of the stream_writer class .
const std::ostream & base_stream() const noexcept
Returns the underlying stream.
void write(const xtd::ustring &value) override
Writes the specified string value to the text stream.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
void flush() override
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Represents a writer that can write a sequential series of characters.
Definition: text_writer.h:29
Implements a xtd::io::text_writer for writing characters to a string.
Definition: string_writer.h:19
Contains xtd::io::text_writer class.