xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
stream_writer.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <fstream>
7#include <optional>
8#include "text_writer.h"
9
11namespace xtd {
13 namespace io {
21 public:
29 stream_writer(std::ostream& stream);
35 stream_writer(const xtd::ustring& path, bool append);
38 stream_writer(std::ostream& stream, bool append);
42
43 bool auto_flush() const;
44 void auto_flush(bool auto_flush);
45
48 std::optional<std::reference_wrapper<std::ostream>> base_stream() const;
49
51 void close() override;
52
55 void flush() override;
56
61 void write(const xtd::ustring& value) override;
62
63 private:
64 std::ostream* stream_ = nullptr;
65 bool auto_flush_ = false;
66 bool delete_when_destroy_ = false;
67 };
68 }
69}
Performs operations on std::basic_string instances that contain file or directory path information....
Definition path.h:29
Implements a xtd::io::text_writer for writing characters to a stream.
Definition stream_writer.h:20
stream_writer(std::ostream &stream)
Initializes a new instance of the stream_writer class for the specified stream.
void flush() override
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
stream_writer(const xtd::ustring &path)
Initializes a new instance of the stream_writer class for the specified file name.
std::optional< std::reference_wrapper< std::ostream > > base_stream() const
Returns the underlying stream.
void write(const xtd::ustring &value) override
Writes the specified string value to the text stream.
void close() override
Closes the stream_writer object and the underlying stream, and releases any system resources associat...
stream_writer(const xtd::ustring &path, bool append)
Initializes a new instance of the System::IO::StreamWriter class for the specified file on the specif...
stream_writer(std::ostream &stream, bool append)
Initializes a new instance of the stream_writer class for the specified stream.
Represents a writer that can write a sequential series of characters.
Definition text_writer.h:29
virtual void write(const xtd::ustring &value)
Writes the specified string value to the text stream.
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.