5#define __XTD_STD_INTERNAL__
7#undef __XTD_STD_INTERNAL__
12#include "../read_only_span"
96 [[nodiscard]] virtual auto
tell() -> std::streampos;
102 virtual auto
write(
bool value) ->
void;
114 virtual auto
write(
char value) ->
void;
122 for (
auto b : buffer)
130 template<xtd::size size>
131 auto write(
const std::array<char, size>& buffer) ->
void {
132 for (
auto c : buffer)
170 virtual auto write(
double value) -> void;
200 virtual auto write(
float value) -> void;
208 virtual auto write(
const std::string& value) -> void;
209 virtual auto write(
const std::u8string& value) -> void;
210 virtual auto write(
const std::u16string& value) -> void;
211 virtual auto write(
const std::u32string& value) -> void;
212 virtual auto write(
const std::wstring& value) -> void;
213 virtual auto write(
const char* value) -> void;
248 auto operator <<(
char value) -> binary_writer& {write(value);
return *
this;}
249 template<xtd::size size>
251 template<xtd::size size>
252 auto operator <<(
const xtd::fixed_array<char, size>& value) -> binary_writer& {
write(value);
return *
this;}
253 auto operator <<(
const xtd::array<xtd::byte>& value) -> binary_writer& {
write(value, 0, value.length());
return *
this;}
254 auto operator <<(
const xtd::array<char>& value) -> binary_writer& {
write(value, 0, value.length());
return *
this;}
255 auto operator <<(
double value) -> binary_writer& {
write(value);
return *
this;}
256 auto operator <<(int16 value) -> binary_writer& {
write(value);
return *
this;}
257 auto operator <<(int32 value) -> binary_writer& {
write(value);
return *
this;}
258 auto operator <<(int64 value) -> binary_writer& {
write(value);
return *
this;}
259 auto operator <<(sbyte value) -> binary_writer& {
write(value);
return *
this;}
260 auto operator <<(
float value) -> binary_writer& {
write(value);
return *
this;}
261 auto operator <<(
const string& value) -> binary_writer& {
write(value);
return *
this;}
262 auto operator <<(
const char* value) -> binary_writer& {
write(value);
return *
this;}
263 auto operator <<(
const char8* value) -> binary_writer& {
write(value);
return *
this;}
264 auto operator <<(
const char16* value) -> binary_writer& {
write(value);
return *
this;}
265 auto operator <<(
const char32* value) -> binary_writer& {
write(value);
return *
this;}
266 auto operator <<(
const wchar* value) -> binary_writer& {
write(value);
return *
this;}
267 auto operator <<(uint16 value) -> binary_writer& {
write(value);
return *
this;}
268 auto operator <<(uint32 value) -> binary_writer& {
write(value);
return *
this;}
269 auto operator <<(uint64 value) -> binary_writer& {
write(value);
return *
this;}
273 auto write_7bit_encoded_int(int32 value) -> void;
274 std::ostream* stream_ =
nullptr;
275 bool delete_when_destroy_ =
false;
Contains __xtd_std_version definitions.
Contains xtd::array class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents a fixed array class.
Definition fixed_array.hpp:23
Writes primitive types in binary to a stream and supports writing strings.
Definition binary_writer.hpp:47
virtual auto write(const xtd::read_only_span< xtd::byte > &buffer) -> void
Writes a byte array to the underlying stream.
virtual auto close() -> void
Closes the xtd::io::binary_writer object and the underlying stream, and releases any system resources...
virtual auto tell() -> std::streampos
Tell the current seek position of the readers stream;.
virtual auto write(double value) -> void
Writes an eight-byte floating-point value to the current stream and advances the stream position by e...
virtual auto write(const xtd::array< char > &buffer, xtd::size index, xtd::size count) -> void
Writes a region of a character array to the current stream.
virtual auto write(float value) -> void
Writes an four-byte floating-point value to the current stream and advances the stream position by fo...
binary_writer(const xtd::string &path)
Initializes a new instance of the binary_writer class for the specified file name.
virtual auto write(xtd::sbyte value) -> void
Writes an signed byte to the current stream and advances the stream position by one byte.
virtual auto seek(xtd::size offset, std::ios::seekdir origin) -> xtd::size
Sets the position within the current stream.
virtual auto write(xtd::uint32 value) -> void
Writes a four-byte unsigned integer to the current stream and advances the stream position by four by...
virtual auto write(bool value) -> void
Writes a one-byte boolean value to the current stream, with 0 representing false and 1 representing t...
virtual auto write(const xtd::array< xtd::byte > &buffer, xtd::size index, xtd::size count) -> void
Writes a region of a byte array to the current stream.
virtual auto write(xtd::uint64 value) -> void
Writes a eight-byte unsigned integer to the current stream and advances the stream position by eight ...
virtual auto write(const xtd::string &value) -> void
Writes a length-prefixed string to this stream, and advances the current position of the stream and t...
virtual auto write(xtd::int32 value) -> void
Writes a four-byte signed integer to the current stream and advances the stream position by four byte...
auto base_stream() const -> std::optional< xtd::ref< std::ostream > >
Returns the underlying stream.
virtual auto write(const xtd::read_only_span< char > &buffer) -> void
Writes a character array to the underlying stream.
auto write(const std::array< char, size > &buffer) -> void
Writes a character array to the underlying stream.
Definition binary_writer.hpp:131
binary_writer(std::ostream &stream)
Initializes a new instance of the binary_writer class for the specified stream.
virtual auto flush() -> void
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
virtual auto write(int16 value) -> void
Writes a two-byte signed integer to the current stream and advances the stream position by two bytes.
virtual auto write(xtd::int64 value) -> void
Writes a eight-byte signed integer to the current stream and advances the stream position by eight by...
virtual auto write(xtd::uint16 value) -> void
Writes a two-byte unsigned integer to the current stream and advances the stream position by two byte...
Performs operations on std::basic_string instances that contain file or directory path information....
Definition path.hpp:37
Provides a generic view of a sequence of bytes. This is an abstract class.
Definition stream.hpp:40
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains xtd::fixed_array class.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.hpp:27
std::int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.hpp:23
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.hpp:27
std::uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
std::int16_t int16
Represents a 16-bit signed integer.
Definition int16.hpp:23
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
std::uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.hpp:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
@ write
Write access to the file. Data can be written to the file. Combine with Read for read/write access.
Definition file_access.hpp:19
@ ios
The operating system is iOS Apple.
Definition platform_id.hpp:36
@ c
The C key.
Definition console_key.hpp:92
@ b
The B key.
Definition console_key.hpp:90
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr read_only_span(const element_type(&array)[len]) noexcept
Creates an xtd::read_only_span with specified native array.
Definition read_only_span.hpp:112
Contains xtd::object class.
Contains xtd::optional type.
Contains xtd::string alias.