xtd 0.2.0
send_packets_element.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../ip_address.hpp"
6#include "../../array.hpp"
7#include "../../string.hpp"
8#include <fstream>
9#include <functional>
10#include <vector>
11
13#undef unix
15
17namespace xtd {
19 namespace net {
21 namespace sockets {
23 class socket;
25
43 public:
45
48 using ifstream_ref = std::reference_wrapper<std::ifstream>;
50
52
56
61
69 send_packets_element(const xtd::string& file_path, size_t offset, size_t count, bool end_of_packet);
70
77 send_packets_element(const xtd::array<xtd::byte>& buffer, size_t offset, size_t count, bool end_of_packet);
78
85 send_packets_element(const xtd::string& file_path, size_t offset, size_t count);
86
93 send_packets_element(std::ifstream& file_stream, size_t offset, size_t count, bool end_of_packet);
94
100 send_packets_element(const xtd::array<xtd::byte>& buffer, size_t offset, size_t count);
101
106 explicit send_packets_element(const xtd::string& file_path);
107
111 explicit send_packets_element(std::ifstream& file_stream);
113
118
120
126
131 size_t count() const noexcept;
132
136 bool end_of_packet() const noexcept;
137
142 const xtd::string& file_path() const noexcept;
143
147 std::optional<ifstream_ref> file_stream() const noexcept;
148
152 size_t offset() const noexcept;
154
155 private:
156 xtd::array<xtd::byte> buffer_;
157 size_t count_ = 0;
158 bool end_of_packet_ = false;
159 xtd::string file_path_;
160 std::ifstream* file_stream_ = nullptr;
161 size_t offset_ = 0;
162 bool delete_file_stream_when_destroy_ = false;
163 };
164 }
165 }
166}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents text as a sequence of character units.
Definition basic_string.hpp:71
Represents an element in a xtd::net::sockets::send_packets_element array.
Definition send_packets_element.hpp:42
send_packets_element(std::ifstream &file_stream, size_t offset, size_t count, bool end_of_packet)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
send_packets_element(const xtd::array< xtd::byte > &buffer, size_t offset, size_t count)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
send_packets_element()=default
Initializes a new instance of the xtd::net::sockets::send_packets_element class.
send_packets_element(const xtd::string &file_path, size_t offset, size_t count)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
send_packets_element(const xtd::array< xtd::byte > &buffer, size_t offset, size_t count, bool end_of_packet)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
std::reference_wrapper< std::ifstream > ifstream_ref
Represent ta std::ifstream reference.
Definition send_packets_element.hpp:48
send_packets_element(const xtd::array< xtd::byte > &buffer)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified b...
send_packets_element(const xtd::string &file_path)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified f...
send_packets_element(const xtd::string &file_path, size_t offset, size_t count, bool end_of_packet)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
send_packets_element(std::ifstream &file_stream)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified F...
xtd::array< xtd::byte > buffer() const noexcept
Gets the buffer to be sent if the xtd::net::sockets::send_packets_element object was initialized with...
Implements the Berkeley sockets interface.
Definition socket.hpp:77
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
@ socket
The socket is not valid.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.hpp:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10