Make wxWebSessionFactory private
Having wxWebSessionFactory part of the public API implies keeping compatibility with the possible ways of implementing it which is too restrictive for no good reason, so move this class to the private header and don't document it nor wxWebSession::RegisterFactory() (which is now private).
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#ifndef _WX_MSW_WEBREQUEST_WINHTTP_H
|
||||
#define _WX_MSW_WEBREQUEST_WINHTTP_H
|
||||
|
||||
#include "wx/private/webrequest.h"
|
||||
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#include <winhttp.h>
|
||||
#include "wx/buffer.h"
|
||||
|
@@ -12,6 +12,8 @@
|
||||
|
||||
#if wxUSE_WEBREQUEST_URLSESSION
|
||||
|
||||
#include "wx/private/webrequest.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSession);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSessionTask);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxWebSessionDelegate);
|
||||
|
25
include/wx/private/webrequest.h
Normal file
25
include/wx/private/webrequest.h
Normal file
@@ -0,0 +1,25 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/private/webrequest.h
|
||||
// Purpose: wxWebRequest implementation classes
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2020-12-26
|
||||
// Copyright: (c) 2020 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_PRIVATE_WEBREQUEST_H_
|
||||
#define _WX_PRIVATE_WEBREQUEST_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWebSessionFactory
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
virtual wxWebSession* Create() = 0;
|
||||
|
||||
virtual ~wxWebSessionFactory() { }
|
||||
};
|
||||
|
||||
#endif // _WX_PRIVATE_WEBREQUEST_H_
|
@@ -12,6 +12,8 @@
|
||||
|
||||
#if wxUSE_WEBREQUEST_CURL
|
||||
|
||||
#include "wx/private/webrequest.h"
|
||||
|
||||
#include "wx/thread.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
class wxWebResponse;
|
||||
class wxWebSession;
|
||||
class wxWebSessionFactory;
|
||||
class wxWebAuthChallenge;
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP(wxString, wxWebRequestHeaderMap);
|
||||
@@ -195,14 +196,6 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebAuthChallenge);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
virtual wxWebSession* Create() = 0;
|
||||
|
||||
virtual ~wxWebSessionFactory() { }
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendDefault[];
|
||||
extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendWinHTTP[];
|
||||
extern WXDLLIMPEXP_DATA_NET(const char) wxWebSessionBackendURLSession[];
|
||||
@@ -228,9 +221,6 @@ public:
|
||||
|
||||
static wxWebSession* New(const wxString& backend = wxWebSessionBackendDefault);
|
||||
|
||||
static void RegisterFactory(const wxString& backend,
|
||||
const wxSharedPtr<wxWebSessionFactory>& factory);
|
||||
|
||||
static bool IsBackendAvailable(const wxString& backend);
|
||||
|
||||
protected:
|
||||
@@ -239,6 +229,9 @@ protected:
|
||||
const wxWebRequestHeaderMap& GetHeaders() const { return m_headers; }
|
||||
|
||||
private:
|
||||
static void RegisterFactory(const wxString& backend,
|
||||
const wxSharedPtr<wxWebSessionFactory>& factory);
|
||||
|
||||
// Make it a friend to allow accessing our m_headers.
|
||||
friend class wxWebRequest;
|
||||
|
||||
|
@@ -507,17 +507,6 @@ public:
|
||||
*/
|
||||
static wxWebSession* New(const wxString& backend = wxWebSessionBackendDefault);
|
||||
|
||||
/**
|
||||
Allows the registering of new backend for wxWebSession.
|
||||
|
||||
backend can be used as an argument to New().
|
||||
|
||||
@param backend The name for the new backend to be registered under
|
||||
@param factory A shared pointer to the factory which creates the appropriate backend.
|
||||
*/
|
||||
static void RegisterFactory(const wxString& backend,
|
||||
const wxSharedPtr<wxWebSessionFactory>& factory);
|
||||
|
||||
/**
|
||||
Allows to check if the specified backend is available at runtime.
|
||||
|
||||
@@ -527,29 +516,6 @@ public:
|
||||
static bool IsBackendAvailable(const wxString& backend);
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxWebSessionFactory
|
||||
|
||||
An abstract factory class for creation wxWebSession backends.
|
||||
|
||||
Each implementation of wxWebSession should have its own factory.
|
||||
|
||||
@since 3.1.5
|
||||
|
||||
@library{wxnet}
|
||||
@category{net}
|
||||
|
||||
@see wxWebSession
|
||||
*/
|
||||
class wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Creates a new web session object.
|
||||
*/
|
||||
virtual wxWebSession* Create();
|
||||
};
|
||||
|
||||
/**
|
||||
@class wxWebRequestEvent
|
||||
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#include "wx/utils.h"
|
||||
#endif
|
||||
|
||||
#include "wx/private/webrequest.h"
|
||||
|
||||
#if wxUSE_WEBREQUEST_WINHTTP
|
||||
#include "wx/msw/private/webrequest_winhttp.h"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user