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
text_reader.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <cstdio>
7#include <istream>
8#include <mutex>
9#include <string>
10#include "../core_export.h"
11#include "../object.h"
12#include "../ustring.h"
13
15namespace xtd {
17 namespace io {
19 class null_text_reader;
20 class synchronized_text_reader;
22
30 public:
36 static null_text_reader& null() noexcept;
37
39 virtual void close();
40
43 virtual int32_t peek() const;
44
47 virtual int32_t read();
48
54 virtual size_t read(std::vector<char>& buffer, size_t index, size_t count);
55
61 virtual size_t read_block(std::vector<char>& buffer, size_t index, size_t count);
62
65 virtual xtd::ustring read_line();
66
70 virtual xtd::ustring read_to_end();
71
75 static synchronized_text_reader synchronised(text_reader& reader) noexcept;
76
77 protected:
79 text_reader() = default;
80 };
81
87 public:
88 int32_t read() override;
89 };
90
96 public:
97 int32_t read() override;
98
99 private:
100 friend class text_reader;
102 synchronized_text_reader() = delete;
103 xtd::io::text_reader& reader_;
104 std::mutex mutex_;
105 };
106 }
107}
Represents a null text reader.
Definition text_reader.h:86
int32_t read() override
Reads the next character from the input stream and advances the character position by one character.
Represents a synchronized text reader.
Definition text_reader.h:95
int32_t read() override
Reads the next character from the input stream and advances the character position by one character.
Represents a reader that can read a sequential series of characters.
Definition text_reader.h:29
static null_text_reader & null() noexcept
Provides a text_reader with no data to read from.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
#define core_export_
Define shared library export.
Definition core_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17