xtd 0.2.0
Loading...
Searching...
No Matches
string_writer.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "text_writer.hpp"
6#include <sstream>
7
9namespace xtd {
11 namespace io {
28 public:
30
33 string_writer() = default;
36 explicit string_writer(const xtd::string& str);
38
40
44 [[nodiscard]] auto base_stream() const noexcept -> const std::ostream&;
47 [[nodiscard]] auto base_stream() noexcept -> std::ostream&;
49
51
55 auto flush() -> void override;
56
57 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
58
62 auto write(const xtd::string& value) -> void override;
64
65 private:
66 std::stringstream stream_;
67 };
68 }
69}
auto flush() -> void override
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
auto base_stream() const noexcept -> const std::ostream &
Returns the underlying stream.
string_writer(const xtd::string &str)
Initializes a new instance of the stream_writer class for the specified string.
string_writer()=default
Initializes a new instance of the stream_writer class .
auto write(const xtd::string &value) -> void override
Writes the specified string value to the text stream.
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
Represents a writer that can write a sequential series of characters.
Definition text_writer.hpp:36
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::io::text_writer class.