mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
add sendfile method for streamsocket (#4007)
* add sendfile method for streamsocket * add mswsock.lib to the project files and templates * remove /DPOCO_NO_AUTOMATIC_LIBS for cmake windows build * merge from upstream * merge from upstream * fix code stile add NotImplemented exception for unsupported platforms exculude <sys/sendfile.h> for POCO_EMSCRIPTEN, because https:// github.com/emscripten-core/emscripten/pull/16234 * add iostream include for std::cout * fix compilation for emscripten (wrap sendfile)
This commit is contained in:
@@ -47,6 +47,9 @@ class Foundation_API FileIOS: public virtual std::ios
|
||||
/// On Windows platforms, UTF-8 encoded Unicode paths are correctly handled.
|
||||
{
|
||||
public:
|
||||
|
||||
using NativeHandle = FileStreamBuf::NativeHandle;
|
||||
|
||||
FileIOS();
|
||||
/// Creates the basic stream.
|
||||
|
||||
@@ -63,6 +66,12 @@ public:
|
||||
FileStreamBuf* rdbuf();
|
||||
/// Returns a pointer to the underlying streambuf.
|
||||
|
||||
NativeHandle nativeHandle() const;
|
||||
/// Returns native file descriptor handle
|
||||
|
||||
Poco::UInt64 size() const;
|
||||
/// Returns file size
|
||||
|
||||
protected:
|
||||
FileStreamBuf _buf;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,8 @@ class Foundation_API FileStreamBuf: public BufferedBidirectionalStreamBuf
|
||||
/// This stream buffer handles Fileio
|
||||
{
|
||||
public:
|
||||
using NativeHandle = int;
|
||||
|
||||
FileStreamBuf();
|
||||
/// Creates a FileStreamBuf.
|
||||
|
||||
@@ -50,6 +52,12 @@ public:
|
||||
std::streampos seekpos(std::streampos pos, std::ios::openmode mode = std::ios::in | std::ios::out);
|
||||
/// Change to specified position, according to mode.
|
||||
|
||||
NativeHandle nativeHandle() const;
|
||||
/// Returns native file descriptor handle
|
||||
|
||||
Poco::UInt64 size() const;
|
||||
/// Returns file size
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
@@ -61,7 +69,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
int _fd;
|
||||
NativeHandle _fd;
|
||||
std::streamoff _pos;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ class Foundation_API FileStreamBuf: public BufferedBidirectionalStreamBuf
|
||||
/// This stream buffer handles Fileio
|
||||
{
|
||||
public:
|
||||
using NativeHandle = HANDLE;
|
||||
|
||||
FileStreamBuf();
|
||||
/// Creates a FileStreamBuf.
|
||||
|
||||
@@ -49,6 +51,12 @@ public:
|
||||
std::streampos seekpos(std::streampos pos, std::ios::openmode mode = std::ios::in | std::ios::out);
|
||||
/// change to specified position, according to mode
|
||||
|
||||
NativeHandle nativeHandle() const;
|
||||
/// Returns native file descriptor handle
|
||||
|
||||
Poco::UInt64 size() const;
|
||||
/// Returns file size
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
@@ -60,7 +68,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::string _path;
|
||||
HANDLE _handle;
|
||||
NativeHandle _handle;
|
||||
UInt64 _pos;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user