FXSend/MobsetHttp/Poco/Net/HTTPIOStream.h
2025-02-28 17:05:50 +08:00

89 lines
1.3 KiB
C++

//
// HTTPIOStream.h
//
// Library: Net
// Package: HTTP
// Module: HTTPIOStream
//
// Definition of the HTTPIOStream class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Net_HTTPIOStream_INCLUDED
#define Net_HTTPIOStream_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/UnbufferedStreamBuf.h"
namespace Poco {
namespace Net {
class HTTPClientSession;
class Net_API HTTPResponseStreamBuf: public Poco::UnbufferedStreamBuf
{
public:
HTTPResponseStreamBuf(std::istream& istr);
~HTTPResponseStreamBuf();
private:
int readFromDevice();
std::istream& _istr;
};
inline int HTTPResponseStreamBuf::readFromDevice()
{
return _istr.get();
}
class Net_API HTTPResponseIOS: public virtual std::ios
{
public:
HTTPResponseIOS(std::istream& istr);
~HTTPResponseIOS();
HTTPResponseStreamBuf* rdbuf();
protected:
HTTPResponseStreamBuf _buf;
};
inline HTTPResponseStreamBuf* HTTPResponseIOS::rdbuf()
{
return &_buf;
}
class Net_API HTTPResponseStream: public HTTPResponseIOS, public std::istream
{
public:
HTTPResponseStream(std::istream& istr, HTTPClientSession* pSession);
~HTTPResponseStream();
private:
HTTPClientSession* _pSession;
};
} } // namespace Poco::Net
#endif // Net_HTTPIOStream_INCLUDED