xtd 0.2.0
Loading...
Searching...
No Matches
stream_reader.h
Go to the documentation of this file.
1
4#pragma once
5#include "text_reader.h"
6#include "../optional.h"
7#include <fstream>
8
10namespace xtd {
12 namespace io {
29 public:
31
36 explicit stream_reader(const xtd::string& path);
39 explicit stream_reader(std::istream& stream);
42 stream_reader(const stream_reader&) = delete;
43 stream_reader& operator =(const stream_reader&) = delete;
46
48
52 std::optional<std::reference_wrapper<std::istream>> base_stream() const;
53
56 bool end_of_stream() const;
58
60
63 void close() override;
64
67 int32 peek() const override;
68
71 int32 read() override;
73
74 private:
75 std::istream* stream_ = nullptr;
76 bool delete_when_destroy_ = false;
77 };
78 }
79}
Represents text as a sequence of character units.
Definition basic_string.h:79
Performs operations on std::basic_string instances that contain file or directory path information....
Definition path.h:36
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition stream_reader.h:28
int32 read() override
Reads the next character from the input stream and advances the character position by one character.
int32 peek() const override
Reads the next character without changing the state of the reader or the character source....
stream_reader(const xtd::string &path)
Initializes a new instance of the stream_reader class for the specified file name.
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.
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:36
#define core_export_
Define shared library export.
Definition core_export.h:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::io::text_reader class.