xtd 0.2.0
stream_reader.h
Go to the documentation of this file.
1 #pragma once
5 #include "text_reader.h"
6 #include "../optional.h"
7 #include <fstream>
8 
10 namespace xtd {
12  namespace io {
26  class core_export_ stream_reader : public xtd::io::text_reader {
27  public:
29 
34  explicit stream_reader(const xtd::ustring& path);
37  explicit stream_reader(std::istream& stream);
40  stream_reader(const stream_reader&) = delete;
41  stream_reader& operator =(const stream_reader&) = delete;
42  ~stream_reader();
44 
46 
50  std::optional<std::reference_wrapper<std::istream>> base_stream() const;
51 
54  bool end_of_stream() const;
56 
58 
61  void close() override;
62 
65  int32 peek() const override;
66 
69  int32 read() override;
71 
72  private:
73  std::istream* stream_ = nullptr;
74  bool delete_when_destroy_ = false;
75  };
76  }
77 }
Contains xtd::io::text_reader class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition: stream_reader.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Performs operations on std::basic_string instances that contain file or directory path information...
Definition: path.h:34
Represents a reader that can read a sequential series of characters.
Definition: text_reader.h:34
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Read access to the file. Data can be read from the file. Combine with Write for read/write access...