merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig
2020-01-09 10:08:09 +01:00
parent 7c177b6f89
commit 1bf40a0cd2
389 changed files with 3029 additions and 4111 deletions

View File

@@ -27,7 +27,7 @@ namespace Poco {
namespace Net {
typedef Poco::BasicBufferedStreamBuf<char, std::char_traits<char>, HTTPBufferAllocator> HTTPBasicStreamBuf;
using HTTPBasicStreamBuf = Poco::BasicBufferedStreamBuf<char, std::char_traits<char>, HTTPBufferAllocator>;
} } // namespace Poco::Net

View File

@@ -38,7 +38,7 @@ class Net_API HTTPChunkedStreamBuf: public HTTPBasicStreamBuf
/// HTTP message bodies in chunked transfer coding.
{
public:
typedef HTTPBasicStreamBuf::openmode openmode;
using openmode = HTTPBasicStreamBuf::openmode;
HTTPChunkedStreamBuf(HTTPSession& session, openmode mode);
~HTTPChunkedStreamBuf();

View File

@@ -39,12 +39,12 @@ class Net_API HTTPFixedLengthStreamBuf: public HTTPBasicStreamBuf
/// At most a given number of bytes are read or written.
{
public:
typedef HTTPBasicStreamBuf::openmode openmode;
using openmode = HTTPBasicStreamBuf::openmode;
#if defined(POCO_HAVE_INT64)
typedef Poco::Int64 ContentLength;
using ContentLength = Poco::Int64;
#else
typedef std::streamsize ContentLength;
using ContentLength = std::streamsize;
#endif
HTTPFixedLengthStreamBuf(HTTPSession& session, ContentLength length, openmode mode);

View File

@@ -38,7 +38,7 @@ class Net_API HTTPHeaderStreamBuf: public HTTPBasicStreamBuf
/// in a HTTPSession.
{
public:
typedef HTTPBasicStreamBuf::openmode openmode;
using openmode = HTTPBasicStreamBuf::openmode;
HTTPHeaderStreamBuf(HTTPSession& session, openmode mode);
~HTTPHeaderStreamBuf();

View File

@@ -38,7 +38,7 @@ class Net_API HTTPRequestHandlerFactory
/// method.
{
public:
typedef Poco::SharedPtr<HTTPRequestHandlerFactory> Ptr;
using Ptr = Poco::SharedPtr<HTTPRequestHandlerFactory>;
HTTPRequestHandlerFactory();
/// Creates the HTTPRequestHandlerFactory.

View File

@@ -33,7 +33,7 @@ class Net_API HTTPServerParams: public TCPServerParams
/// Subclasses may add new parameters to the class.
{
public:
typedef Poco::AutoPtr<HTTPServerParams> Ptr;
using Ptr = Poco::AutoPtr<HTTPServerParams>;
HTTPServerParams();
/// Creates the HTTPServerParams.

View File

@@ -38,7 +38,7 @@ class Net_API HTTPStreamBuf: public HTTPBasicStreamBuf
/// HTTP message bodies.
{
public:
typedef HTTPBasicStreamBuf::openmode openmode;
using openmode = HTTPBasicStreamBuf::openmode;
HTTPStreamBuf(HTTPSession& session, openmode mode);
~HTTPStreamBuf();

View File

@@ -34,8 +34,8 @@ class Net_API HostEntry
/// of IP addresses.
{
public:
typedef std::vector<std::string> AliasList;
typedef std::vector<IPAddress> AddressList;
using AliasList = std::vector<std::string>;
using AddressList = std::vector<IPAddress>;
HostEntry();
/// Creates an empty HostEntry.

View File

@@ -54,12 +54,12 @@ class Net_API IPAddress
/// supports IPv6.
{
public:
typedef std::vector<IPAddress> List;
using List = std::vector<IPAddress>;
// The following declarations keep the Family type
// backwards compatible with the previously used
// enum declaration.
typedef AddressFamily::Family Family;
using Family = AddressFamily::Family;
static const Family IPv4 = AddressFamily::IPv4;
#if defined(POCO_HAVE_IPv6)
static const Family IPv6 = AddressFamily::IPv6;

View File

@@ -32,7 +32,7 @@ namespace Impl {
class IPAddressImpl : public Poco::RefCountedObject
{
public:
typedef AddressFamily::Family Family;
using Family = AddressFamily::Family;
virtual ~IPAddressImpl();

View File

@@ -52,7 +52,7 @@ class Net_API MailMessage: public MessageHeader
/// and base64.
{
public:
typedef std::vector<MailRecipient> Recipients;
using Recipients = std::vector<MailRecipient>;
enum ContentDisposition
{
@@ -76,7 +76,7 @@ public:
ContentTransferEncoding encoding;
};
typedef std::vector<Part> PartVec;
using PartVec = std::vector<Part>;
MailMessage(PartStoreFactory* pStoreFactory = 0);
/// Creates an empty MailMessage.

View File

@@ -44,11 +44,17 @@ public:
MediaType(const MediaType& mediaType);
/// Creates a MediaType from another one.
MediaType(MediaType&& mediaType) noexcept;
/// Creates a MediaType by moving another one.
~MediaType();
/// Destroys the MediaType.
MediaType& operator = (const MediaType& mediaType);
/// Assigns another media type.
MediaType& operator = (MediaType&& mediaType) noexcept;
/// Assigns another media type.
MediaType& operator = (const std::string& mediaType);
/// Assigns another media type.

View File

@@ -38,9 +38,9 @@ class Net_API NameValueCollection
/// same name.
{
public:
typedef Poco::ListMap<std::string, std::string> HeaderMap;
typedef HeaderMap::Iterator Iterator;
typedef HeaderMap::ConstIterator ConstIterator;
using HeaderMap = Poco::ListMap<std::string, std::string>;
using Iterator = HeaderMap::Iterator;
using ConstIterator = HeaderMap::ConstIterator;
NameValueCollection();
/// Creates an empty NameValueCollection.
@@ -48,11 +48,17 @@ public:
NameValueCollection(const NameValueCollection& nvc);
/// Creates a NameValueCollection by copying another one.
NameValueCollection(NameValueCollection&& nvc) noexcept;
/// Creates a NameValueCollection by moving another one.
virtual ~NameValueCollection();
/// Destroys the NameValueCollection.
NameValueCollection& operator = (const NameValueCollection& nvc);
/// Assigns the name-value pairs of another NameValueCollection to this one.
NameValueCollection& operator = (NameValueCollection&& nvc) noexcept;
/// Moves the name-value pairs of another NameValueCollection to this one.
void swap(NameValueCollection& nvc);
/// Swaps the NameValueCollection with another one.

View File

@@ -52,7 +52,7 @@ public:
int size;
};
typedef std::vector<MessageInfo> MessageInfoVec;
using MessageInfoVec = std::vector<MessageInfo>;
explicit POP3ClientSession(const StreamSocket& socket);
/// Creates the POP3ClientSession using

View File

@@ -53,8 +53,8 @@ class ParallelSocketAcceptor
/// details.
{
public:
typedef Poco::Net::ParallelSocketReactor<SR> ParallelReactor;
typedef Poco::Observer<ParallelSocketAcceptor, ReadableNotification> Observer;
using ParallelReactor = Poco::Net::ParallelSocketReactor<SR>;
using Observer = Poco::Observer<ParallelSocketAcceptor, ReadableNotification>;
explicit ParallelSocketAcceptor(ServerSocket& socket,
unsigned threads = Poco::Environment::processorCount()):

View File

@@ -46,7 +46,7 @@ template <class SR>
class ParallelSocketReactor: public SR
{
public:
typedef Poco::SharedPtr<ParallelSocketReactor> Ptr;
using Ptr = Poco::SharedPtr<ParallelSocketReactor>;
ParallelSocketReactor()
{

View File

@@ -44,7 +44,7 @@ public:
POLL_ERROR = 0x04
};
typedef std::map<Poco::Net::Socket, int> SocketModeMap;
using SocketModeMap = std::map<Poco::Net::Socket, int>;
PollSet();
/// Creates an empty PollSet.

View File

@@ -23,6 +23,7 @@
#include "Poco/Mutex.h"
#include "Poco/Net/DatagramSocket.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/AutoPtr.h"
namespace Poco {
@@ -45,6 +46,8 @@ class Net_API RemoteSyslogChannel: public Poco::Channel
/// msg.set("structured-data", "[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]");
{
public:
using Ptr = Poco::AutoPtr<RemoteSyslogChannel>;
static const std::string BSD_TIMEFORMAT;
static const std::string SYSLOG_TIMEFORMAT;

View File

@@ -21,6 +21,7 @@
#include "Poco/Net/Net.h"
#include "Poco/Channel.h"
#include "Poco/String.h"
#include "Poco/AutoPtr.h"
namespace Poco {
@@ -31,6 +32,8 @@ class Net_API SMTPChannel: public Poco::Channel
/// This Channel implements SMTP (email) logging.
{
public:
using Ptr = Poco::AutoPtr<SMTPChannel>;
SMTPChannel();
/// Creates a SMTPChannel.

View File

@@ -37,7 +37,7 @@ class Net_API SMTPClientSession
/// client for sending e-mail messages.
{
public:
typedef std::vector<std::string> Recipients;
using Recipients = std::vector<std::string>;
enum
{

View File

@@ -35,7 +35,7 @@ class Net_API Socket
/// It provides operations common to all socket types.
{
public:
typedef SocketBufVec BufVec;
using BufVec = SocketBufVec;
enum SelectMode
/// The mode argument to poll() and select().
@@ -45,7 +45,7 @@ public:
SELECT_ERROR = 4
};
typedef std::vector<Socket> SocketList;
using SocketList = std::vector<Socket>;
Socket();
/// Creates an uninitialized socket.

View File

@@ -68,7 +68,7 @@ class SocketAcceptor
/// if special steps are necessary to create a ServiceHandler object.
{
public:
typedef Poco::Observer<SocketAcceptor, ReadableNotification> Observer;
using Observer = Poco::Observer<SocketAcceptor, ReadableNotification>;
explicit SocketAcceptor(ServerSocket& socket):
_socket(socket),

View File

@@ -44,7 +44,7 @@ public:
// The following declarations keep the Family type
// backwards compatible with the previously used
// enum declaration.
typedef AddressFamily::Family Family;
using Family = AddressFamily::Family;
static const Family IPv4 = AddressFamily::IPv4;
#if defined(POCO_HAVE_IPv6)
static const Family IPv6 = AddressFamily::IPv6;

View File

@@ -32,7 +32,7 @@ namespace Impl {
class Net_API SocketAddressImpl : public Poco::RefCountedObject
{
public:
typedef AddressFamily::Family Family;
using Family = AddressFamily::Family;
virtual ~SocketAddressImpl();

View File

@@ -26,9 +26,7 @@
#include "Poco/Observer.h"
#include "Poco/AutoPtr.h"
#include <map>
#ifdef POCO_ENABLE_CPP11
#include <atomic>
#endif
namespace Poco {
@@ -224,11 +222,7 @@ private:
DEFAULT_TIMEOUT = 250000
};
#ifdef POCO_ENABLE_CPP11
std::atomic<bool> _stop;
#else
bool _stop;
#endif
Poco::Timespan _timeout;
EventHandlerMap _handlers;
PollSet _pollSet;

View File

@@ -47,7 +47,7 @@ class Net_API TCPServerConnectionFilter: public Poco::RefCountedObject
/// Subclasses must override the accept() method.
{
public:
typedef Poco::AutoPtr<TCPServerConnectionFilter> Ptr;
using Ptr = Poco::AutoPtr<TCPServerConnectionFilter>;
virtual bool accept(const StreamSocket& socket) = 0;
/// Returns true if the given StreamSocket connection should

View File

@@ -43,7 +43,7 @@ class Net_API TCPServerConnectionFactory
/// of TCPServerConnection.
{
public:
typedef Poco::SharedPtr<TCPServerConnectionFactory> Ptr;
using Ptr = Poco::SharedPtr<TCPServerConnectionFactory>;
virtual ~TCPServerConnectionFactory();
/// Destroys the TCPServerConnectionFactory.

View File

@@ -36,7 +36,7 @@ class Net_API TCPServerParams: public Poco::RefCountedObject
/// Subclasses may add new parameters to the class.
{
public:
typedef Poco::AutoPtr<TCPServerParams> Ptr;
using Ptr = Poco::AutoPtr<TCPServerParams>;
TCPServerParams();
/// Creates the TCPServerParams.

View File

@@ -34,7 +34,7 @@ namespace Net {
template <std::size_t S = POCO_UDP_BUF_SIZE,
typename P = SingleSocketPoller<S> >
typename P = SingleSocketPoller<S>>
class UDPServerImpl: public Poco::Runnable
/// UDP server, runs in its own thread and owns a poller, to which
/// data arrival and discovery is delegated. See SingleSocketPoller and
@@ -96,8 +96,8 @@ private:
};
typedef UDPServerImpl<POCO_UDP_BUF_SIZE, SingleSocketPoller<POCO_UDP_BUF_SIZE> > UDPServer;
typedef UDPServerImpl<POCO_UDP_BUF_SIZE, MultiSocketPoller<POCO_UDP_BUF_SIZE> > UDPMultiServer;
using UDPServer = UDPServerImpl<POCO_UDP_BUF_SIZE, SingleSocketPoller<POCO_UDP_BUF_SIZE>>;
using UDPMultiServer = UDPServerImpl<POCO_UDP_BUF_SIZE, MultiSocketPoller<POCO_UDP_BUF_SIZE>>;
} } // namespace Poco::Net