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
send_packets_element.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <fstream>
7#include <functional>
8#include <vector>
9#include "../../ustring.h"
10#include "../ip_address.h"
11
13#undef unix
15
17namespace xtd {
19 namespace net {
21 namespace sockets {
23 class socket;
25
34 public:
36 using ifstream_ref = std::reference_wrapper<std::ifstream>;
37
40
44 send_packets_element(const std::vector<byte_t>& buffer);
45
54
61 send_packets_element(const std::vector<byte_t>& buffer, size_t offset, size_t count, bool end_of_packet);
62
70
77 send_packets_element(std::ifstream& file_stream, size_t offset, size_t count, bool end_of_packet);
78
84 send_packets_element(const std::vector<byte_t>& buffer, size_t offset, size_t count);
85
91
96
101
105 std::vector<byte_t> buffer() const noexcept;
106
111 size_t count() const noexcept;
112
116 bool end_of_packet() const noexcept;
117
122 const xtd::ustring& file_path() const noexcept;
123
127 std::optional<ifstream_ref> file_stream() const noexcept;
128
132 size_t offset() const noexcept;
133
134 private:
135 std::vector<byte_t> buffer_;
136 size_t count_ = 0;
137 bool end_of_packet_ = false;
138 xtd::ustring file_path_;
139 std::ifstream* file_stream_ = nullptr;
140 size_t offset_ = 0;
141 bool delete_file_stream_when_destroy_ = false;
142 };
143 }
144 }
145}
Represents an element in a xtd::net::sockets::send_packets_element array.
Definition send_packets_element.h:33
size_t count() const noexcept
Gets the count of bytes to be sent.
std::vector< byte_t > 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< byte_t > &buffer)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified b...
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< byte_t > &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::optional< ifstream_ref > file_stream() const noexcept
Gets the object representation of the file to send if the xtd::net::sockets::send_packets_element obj...
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::reference_wrapper< std::ifstream > ifstream_ref
Represent ta std::ifstream reference.
Definition send_packets_element.h:36
send_packets_element(const std::vector< byte_t > &buffer, size_t offset, size_t count)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified r...
const xtd::ustring & file_path() const noexcept
Gets the filename of the file to send if the xtd::net::sockets::send_packets_element object was initi...
bool end_of_packet() const noexcept
Gets a bool value that indicates if this element should not be combined with the next element in a si...
send_packets_element(std::ifstream &file_stream)
Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified F...
size_t offset() const noexcept
Gets the offset, in bytes, from the beginning of the data buffer or file to the location in the buffe...
Implements the Berkeley sockets interface.
Definition socket.h:63
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
@ socket
Socket options apply to all sockets.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17