xtd - Reference Guide  0.1.1
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;
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 }
Implements a xtd::io::text_writer for writing characters to a string.
Definition: string_writer.h:19
const std::ostream & base_stream() const noexcept
Returns the underlying stream.
string_writer(const xtd::ustring &str)
Initializes a new instance of the stream_writer class for the specified string.
void write(const xtd::ustring &value) override
Writes the specified string value to the text stream.
string_writer()=default
Initializes a new instance of the stream_writer class .
xtd::ustring to_string() const noexcept override
Returns a std::string that represents the current object.
void flush() override
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
Represents a writer that can write a sequential series of characters.
Definition: text_writer.h:29
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::io::text_writer class.