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 "../../ustring.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
40 public:
42
45 using ifstream_ref = std::reference_wrapper<std::ifstream>;
47
49
53
57 explicit send_packets_element(const std::vector<xtd::byte>& buffer);
58
66 send_packets_element(const xtd::ustring& file_path, size_t offset, size_t count, bool end_of_packet);
67
74 send_packets_element(const std::vector<xtd::byte>& buffer, size_t offset, size_t count, bool end_of_packet);
75
82 send_packets_element(const xtd::ustring& file_path, size_t offset, size_t count);
83
90 send_packets_element(std::ifstream& file_stream, size_t offset, size_t count, bool end_of_packet);
91
97 send_packets_element(const std::vector<xtd::byte>& buffer, size_t offset, size_t count);
98
103 explicit send_packets_element(const xtd::ustring& file_path);
104
108 explicit send_packets_element(std::ifstream& file_stream);
110
115
117
122 std::vector<xtd::byte> buffer() const noexcept;
123
128 size_t count() const noexcept;
129
133 bool end_of_packet() const noexcept;
134
139 const xtd::ustring& file_path() const noexcept;
140
144 std::optional<ifstream_ref> file_stream() const noexcept;
145
149 size_t offset() const noexcept;
151
152 private:
153 std::vector<xtd::byte> buffer_;
154 size_t count_ = 0;
155 bool end_of_packet_ = false;
156 xtd::ustring file_path_;
157 std::ifstream* file_stream_ = nullptr;
158 size_t offset_ = 0;
159 bool delete_file_stream_when_destroy_ = false;
160 };
161 }
162 }
163}
Represents an element in a xtd::net::sockets::send_packets_element array.
Definition send_packets_element.h:39
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::ustring &file_path)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified f...
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(const xtd::ustring &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 xtd::ustring &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()=default
Initializes a new instance of the xtd::net::sockets::send_packets_element class.
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:45
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:71
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define core_export_
Define shared library export.
Definition core_export.h:13
@ 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