xtd 0.2.0
Loading...
Searching...
No Matches
send_packets_element.h
Go to the documentation of this file.
1
4#pragma once
5#include "../ip_address.h"
6#include "../../string.h"
7#include <fstream>
8#include <functional>
9#include <vector>
10
12#undef unix
14
16namespace xtd {
18 namespace net {
20 namespace sockets {
22 class socket;
24
42 public:
44
47 using ifstream_ref = std::reference_wrapper<std::ifstream>;
49
51
55
59 explicit send_packets_element(const std::vector<xtd::byte>& buffer);
60
68 send_packets_element(const xtd::string& file_path, size_t offset, size_t count, bool end_of_packet);
69
76 send_packets_element(const std::vector<xtd::byte>& buffer, size_t offset, size_t count, bool end_of_packet);
77
84 send_packets_element(const xtd::string& file_path, size_t offset, size_t count);
85
92 send_packets_element(std::ifstream& file_stream, size_t offset, size_t count, bool end_of_packet);
93
99 send_packets_element(const std::vector<xtd::byte>& buffer, size_t offset, size_t count);
100
105 explicit send_packets_element(const xtd::string& file_path);
106
110 explicit send_packets_element(std::ifstream& file_stream);
112
117
119
124 std::vector<xtd::byte> buffer() const noexcept;
125
130 size_t count() const noexcept;
131
135 bool end_of_packet() const noexcept;
136
141 const xtd::string& file_path() const noexcept;
142
146 std::optional<ifstream_ref> file_stream() const noexcept;
147
151 size_t offset() const noexcept;
153
154 private:
155 std::vector<xtd::byte> buffer_;
156 size_t count_ = 0;
157 bool end_of_packet_ = false;
158 xtd::string file_path_;
159 std::ifstream* file_stream_ = nullptr;
160 size_t offset_ = 0;
161 bool delete_file_stream_when_destroy_ = false;
162 };
163 }
164 }
165}
Represents text as a sequence of character units.
Definition basic_string.h:79
Represents an element in a xtd::net::sockets::send_packets_element array.
Definition send_packets_element.h:41
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 std::vector< xtd::byte > &buffer)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified b...
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...
std::vector< xtd::byte > buffer() const noexcept
Gets the buffer to be sent if the xtd::net::sockets::send_packets_element object was initialized with...
send_packets_element(const std::vector< 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.h:47
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(const std::vector< 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(std::ifstream &file_stream)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified F...
Implements the Berkeley sockets interface.
Definition socket.h:74
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define core_export_
Define shared library export.
Definition core_export.h:13
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.h:181
@ socket
Socket options apply to all sockets.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10