xtd - Reference Guide  0.1.0
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_reader.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <fstream>
7#include <optional>
8#include "text_reader.h"
9
11namespace xtd {
13 namespace io {
21 public:
28 stream_reader(std::istream& stream);
32
35 std::optional<std::reference_wrapper<std::istream>> base_stream() const;
36
39 bool end_of_stream() const;
40
42 void close() override;
43
46 int32_t peek() const override;
47
50 int32_t read() override;
51
52 private:
53 std::istream* stream_ = nullptr;
54 bool delete_when_destroy_ = false;
55 };
56 }
57}
Performs operations on std::basic_string instances that contain file or directory path information....
Definition: path.h:29
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition: stream_reader.h:20
stream_reader(const xtd::ustring &path)
Initializes a new instance of the stream_reader class for the specified file name.
int32_t read() override
Reads the next character from the input stream and advances the character position by one character.
stream_reader(std::istream &stream)
Initializes a new instance of the stream_reader class for the specified stream.
std::optional< std::reference_wrapper< std::istream > > base_stream() const
Returns the underlying stream.
int32_t peek() const override
Reads the next character without changing the state of the reader or the character source....
void close() override
Closes the stream_reader object and the underlying stream, and releases any system resources associat...
bool end_of_stream() const
Gets a value that indicates whether the current stream position is at the end of the stream.
Represents a reader that can read a sequential series of characters.
Definition: text_reader.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_reader class.