Removed drogon's exports.h.

This commit is contained in:
Relintai 2021-06-20 15:08:35 +02:00
parent 13b2863908
commit 50c0f2115e
17 changed files with 52 additions and 129 deletions

View File

@ -1,42 +0,0 @@
#ifndef DROGON_EXPORT_H
#define DROGON_EXPORT_H
#ifdef DROGON_STATIC_DEFINE
# define DROGON_EXPORT
# define DROGON_NO_EXPORT
#else
# ifndef DROGON_EXPORT
# ifdef drogon_EXPORTS
/* We are building this library */
# define DROGON_EXPORT
# else
/* We are using this library */
# define DROGON_EXPORT
# endif
# endif
# ifndef DROGON_NO_EXPORT
# define DROGON_NO_EXPORT
# endif
#endif
#ifndef DROGON_DEPRECATED
# define DROGON_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef DROGON_DEPRECATED_EXPORT
# define DROGON_DEPRECATED_EXPORT DROGON_EXPORT DROGON_DEPRECATED
#endif
#ifndef DROGON_DEPRECATED_NO_EXPORT
# define DROGON_DEPRECATED_NO_EXPORT DROGON_NO_EXPORT DROGON_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef DROGON_NO_DEPRECATED
# define DROGON_NO_DEPRECATED
# endif
#endif
#endif /* DROGON_EXPORT_H */

View File

@ -1,35 +0,0 @@
link_libraries(${PROJECT_NAME})
set(benchmark_sources benchmark/BenchmarkCtrl.cc benchmark/JsonCtrl.cc
benchmark/main.cc)
add_executable(client client_example/main.cc)
add_executable(websocket_client websocket_client/WebSocketClient.cc)
add_executable(benchmark ${benchmark_sources})
add_executable(helloworld helloworld/main.cc
helloworld/HelloController.cc
helloworld/HelloViewController.cc)
drogon_create_views(helloworld
${CMAKE_CURRENT_SOURCE_DIR}/helloworld
${CMAKE_CURRENT_BINARY_DIR})
add_executable(file_upload file_upload/file_upload.cc)
drogon_create_views(file_upload
${CMAKE_CURRENT_SOURCE_DIR}/file_upload
${CMAKE_CURRENT_BINARY_DIR})
add_executable(login_session login_session/main.cc)
drogon_create_views(login_session
${CMAKE_CURRENT_SOURCE_DIR}/login_session
${CMAKE_CURRENT_BINARY_DIR})
set(example_targets
benchmark
client
websocket_client
helloworld
file_upload
login_session)
set_property(TARGET ${example_targets}
PROPERTY CXX_STANDARD ${DROGON_CXX_STANDARD})
set_property(TARGET ${example_targets} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${example_targets} PROPERTY CXX_EXTENSIONS OFF)

View File

@ -13,7 +13,7 @@
*/
#pragma once
#include <drogon/exports.h>
#include <trantor/utils/Date.h>
#include <limits>
#include <string>
@ -22,7 +22,7 @@ namespace drogon {
/**
* @brief this class represents a cookie entity.
*/
class DROGON_EXPORT Cookie {
class Cookie {
public:
/// Constructor
/**

View File

@ -21,7 +21,7 @@
#include <drogon/LocalHostFilter.h>
#include <drogon/MultiPart.h>
#include <drogon/drogon_callbacks.h>
#include <drogon/exports.h>
#include <drogon/plugins/Plugin.h>
#include <drogon/utils/HttpConstraint.h>
#include <drogon/utils/Utilities.h>
@ -59,7 +59,7 @@ using DefaultHandler =
std::function<void(const HttpRequestPtr &,
std::function<void(const HttpResponsePtr &)> &&)>;
class DROGON_EXPORT HttpAppFramework : public trantor::NonCopyable {
class HttpAppFramework : public trantor::NonCopyable {
public:
virtual ~HttpAppFramework() = default;
/// Get the instance of HttpAppFramework

View File

@ -18,7 +18,7 @@
#include <drogon/HttpResponse.h>
#include <drogon/HttpTypes.h>
#include <drogon/drogon_callbacks.h>
#include <drogon/exports.h>
#include <trantor/net/EventLoop.h>
#include <trantor/utils/NonCopyable.h>
#include <functional>
@ -63,7 +63,7 @@ private:
* response callbacks are invoked without fear of accidental deconstruction.
*
*/
class DROGON_EXPORT HttpClient : public trantor::NonCopyable {
class HttpClient : public trantor::NonCopyable {
public:
/**
* @brief Send a request asynchronously to the server

View File

@ -24,7 +24,7 @@ namespace drogon {
* @brief The abstract base class for filters
* For more details on the class, see the wiki site (the 'Filter' section)
*/
class DROGON_EXPORT HttpFilterBase {
class HttpFilterBase {
public:
/// This virtual function should be overrided in subclasses.
/**

View File

@ -18,7 +18,7 @@
#include <drogon/HttpTypes.h>
#include <drogon/Session.h>
#include <drogon/UploadFile.h>
#include <drogon/exports.h>
#include <drogon/utils/string_view.h>
#include <json/json.h>
#include <trantor/net/InetAddress.h>
@ -67,7 +67,7 @@ template <>
std::shared_ptr<Json::Value> fromRequest(const HttpRequest &req);
/// Abstract class for webapp developer to get or set the Http request;
class DROGON_EXPORT HttpRequest {
class HttpRequest {
public:
/**
* @brief This template enables implicit type conversion. For using this

View File

@ -16,7 +16,7 @@
#include <drogon/Cookie.h>
#include <drogon/HttpTypes.h>
#include <drogon/HttpViewData.h>
#include <drogon/exports.h>
#include <drogon/utils/string_view.h>
#include <json/json.h>
#include <memory>
@ -59,7 +59,7 @@ inline HttpResponsePtr toResponse<Json::Value &>(Json::Value &pJson) {
return toResponse((const Json::Value &)pJson);
}
class DROGON_EXPORT HttpResponse {
class HttpResponse {
public:
/**
* @brief This template enables automatic type conversion. For using this

View File

@ -14,7 +14,7 @@
#pragma once
#include <drogon/exports.h>
#include <drogon/utils/any.h>
#include <drogon/utils/string_view.h>
#include <stdarg.h>
@ -28,7 +28,7 @@
namespace drogon {
/// This class represents the data set displayed in views.
class DROGON_EXPORT HttpViewData {
class HttpViewData {
public:
/// The function template is used to get an item in the data set by the key
/// parameter.

View File

@ -15,13 +15,13 @@
#pragma once
#include <drogon/HttpFilter.h>
#include <drogon/exports.h>
namespace drogon {
/**
* @brief A filter that prohibit access from external networks
*/
class DROGON_EXPORT IntranetIpFilter : public HttpFilter<IntranetIpFilter> {
class IntranetIpFilter : public HttpFilter<IntranetIpFilter> {
public:
IntranetIpFilter() {
}

View File

@ -15,13 +15,13 @@
#pragma once
#include <drogon/HttpFilter.h>
#include <drogon/exports.h>
namespace drogon {
/**
* @brief A filter that prohibit access from other hosts.
*/
class DROGON_EXPORT LocalHostFilter : public HttpFilter<LocalHostFilter> {
class LocalHostFilter : public HttpFilter<LocalHostFilter> {
public:
LocalHostFilter() {
}

View File

@ -15,7 +15,7 @@
#pragma once
#include <drogon/HttpRequest.h>
#include <drogon/exports.h>
#include <drogon/utils/string_view.h>
#include <map>
#include <memory>
@ -29,7 +29,7 @@ class HttpFileImpl;
* @brief This class represents a uploaded file by a HTTP request.
*
*/
class DROGON_EXPORT HttpFile {
class HttpFile {
public:
HttpFile(std::shared_ptr<HttpFileImpl> &&implPtr);
/// Return the file name;
@ -110,7 +110,7 @@ private:
/// A parser class which help the user to get the files and the parameters in
/// the multipart format request.
class DROGON_EXPORT MultiPartParser {
class MultiPartParser {
public:
MultiPartParser(){};
~MultiPartParser(){};

View File

@ -53,7 +53,7 @@ private:
* @brief WebSocket client abstract class
*
*/
class DROGON_EXPORT WebSocketClient {
class WebSocketClient {
public:
/// Get the WebSocket connection that is typically used to send messages.
virtual WebSocketConnectionPtr getConnection() = 0;

View File

@ -76,7 +76,7 @@ namespace plugin {
* configuration file.
*
*/
class DROGON_EXPORT AccessLogger : public drogon::Plugin<AccessLogger> {
class AccessLogger : public drogon::Plugin<AccessLogger> {
public:
AccessLogger() {
}

View File

@ -6,7 +6,7 @@
#pragma once
#include <drogon/drogon_callbacks.h>
#include <drogon/exports.h>
#include <drogon/plugins/Plugin.h>
#include <regex>
@ -39,7 +39,7 @@ namespace plugin {
* configuration file.
*
*/
class DROGON_EXPORT SecureSSLRedirector
class SecureSSLRedirector
: public drogon::Plugin<SecureSSLRedirector> {
public:
SecureSSLRedirector() {

View File

@ -14,7 +14,7 @@
#pragma once
#include <drogon/exports.h>
#include <drogon/utils/string_view.h>
#include <trantor/utils/Date.h>
#include <trantor/utils/Funcs.h>
@ -31,24 +31,24 @@ time_t timegm(struct tm *tm);
namespace drogon {
namespace utils {
/// Determine if the string is an integer
DROGON_EXPORT bool isInteger(const std::string &str);
bool isInteger(const std::string &str);
/// Generate random a string
/**
* @param length The string length
* The returned string consists of uppercase and lowercase letters and numbers
*/
DROGON_EXPORT std::string genRandomString(int length);
std::string genRandomString(int length);
/// Convert a binary string to hex format
DROGON_EXPORT std::string binaryStringToHex(const unsigned char *ptr,
std::string binaryStringToHex(const unsigned char *ptr,
size_t length);
/// Get a binary string from hexadecimal format
DROGON_EXPORT std::string hexToBinaryString(const char *ptr, size_t length);
std::string hexToBinaryString(const char *ptr, size_t length);
/// Get a binary vector from hexadecimal format
DROGON_EXPORT std::vector<char> hexToBinaryVector(const char *ptr,
std::vector<char> hexToBinaryVector(const char *ptr,
size_t length);
/// Split the string into multiple separated strings.
@ -63,28 +63,28 @@ inline std::vector<std::string> splitString(const std::string &str,
return trantor::splitString(str, separator, acceptEmptyString);
}
DROGON_EXPORT std::set<std::string> splitStringToSet(
std::set<std::string> splitStringToSet(
const std::string &str,
const std::string &separator);
/// Get UUID string.
DROGON_EXPORT std::string getUuid();
std::string getUuid();
/// Encode the string to base64 format.
DROGON_EXPORT std::string base64Encode(const unsigned char *bytes_to_encode,
std::string base64Encode(const unsigned char *bytes_to_encode,
unsigned int in_len,
bool url_safe = false);
/// Decode the base64 format string.
DROGON_EXPORT std::string base64Decode(const std::string &encoded_string);
DROGON_EXPORT std::vector<char> base64DecodeToVector(
std::string base64Decode(const std::string &encoded_string);
std::vector<char> base64DecodeToVector(
const std::string &encoded_string);
/// Check if the string need decoding
DROGON_EXPORT bool needUrlDecoding(const char *begin, const char *end);
bool needUrlDecoding(const char *begin, const char *end);
/// Decode from or encode to the URL format string
DROGON_EXPORT std::string urlDecode(const char *begin, const char *end);
std::string urlDecode(const char *begin, const char *end);
inline std::string urlDecode(const std::string &szToDecode) {
auto begin = szToDecode.data();
return urlDecode(begin, begin + szToDecode.length());
@ -94,11 +94,11 @@ inline std::string urlDecode(const string_view &szToDecode) {
return urlDecode(begin, begin + szToDecode.length());
}
DROGON_EXPORT std::string urlEncode(const std::string &);
DROGON_EXPORT std::string urlEncodeComponent(const std::string &);
std::string urlEncode(const std::string &);
std::string urlEncodeComponent(const std::string &);
/// Get the MD5 digest of a string.
DROGON_EXPORT std::string getMd5(const char *data, const size_t dataLen);
std::string getMd5(const char *data, const size_t dataLen);
inline std::string getMd5(const std::string &originalString) {
return getMd5(originalString.data(), originalString.length());
}
@ -108,16 +108,16 @@ inline std::string getMd5(const std::string &originalString) {
* @param data the input data
* @param ndata the input data length
*/
DROGON_EXPORT std::string gzipCompress(const char *data, const size_t ndata);
DROGON_EXPORT std::string gzipDecompress(const char *data, const size_t ndata);
std::string gzipCompress(const char *data, const size_t ndata);
std::string gzipDecompress(const char *data, const size_t ndata);
/// Commpress or decompress data using brotli lib.
/**
* @param data the input data
* @param ndata the input data length
*/
DROGON_EXPORT std::string brotliCompress(const char *data, const size_t ndata);
DROGON_EXPORT std::string brotliDecompress(const char *data,
std::string brotliCompress(const char *data, const size_t ndata);
std::string brotliDecompress(const char *data,
const size_t ndata);
/// Get the http full date string
@ -130,30 +130,30 @@ DROGON_EXPORT std::string brotliDecompress(const char *data,
Wed, 12 Sep 2018 09:22:40 GMT
@endcode
*/
DROGON_EXPORT char *getHttpFullDate(
char *getHttpFullDate(
const trantor::Date &date = trantor::Date::now());
/// Get the trantor::Date object according to the http full date string
/**
* Returns trantor::Date(std::numeric_limits<int64_t>::max()) upon failure.
*/
DROGON_EXPORT trantor::Date getHttpDate(const std::string &httpFullDateString);
trantor::Date getHttpDate(const std::string &httpFullDateString);
/// Get a formatted string
DROGON_EXPORT std::string formattedString(const char *format, ...);
std::string formattedString(const char *format, ...);
/// Recursively create a file system path
/**
* Return 0 or -1 on success or failure.
*/
DROGON_EXPORT int createPath(const std::string &path);
int createPath(const std::string &path);
/// Replace all occurances of from to to inplace
/**
* @param from string to replace
* @param to string to replace with
*/
DROGON_EXPORT void replaceAll(std::string &s,
void replaceAll(std::string &s,
const std::string &from,
const std::string &to);
@ -168,7 +168,7 @@ DROGON_EXPORT void replaceAll(std::string &s,
* @note DO NOT abuse this function. Especially if Drogon is built without
* OpenSSL. Entropy running low is a real issue.
*/
DROGON_EXPORT bool secureRandomBytes(void *ptr, size_t size);
bool secureRandomBytes(void *ptr, size_t size);
} // namespace utils
} // namespace drogon

View File

@ -17,7 +17,7 @@
#include "HttpMessageBody.h"
#include "HttpUtils.h"
#include <drogon/HttpResponse.h>
#include <drogon/exports.h>
#include <drogon/utils/Utilities.h>
#include <trantor/net/InetAddress.h>
#include <trantor/utils/Date.h>
@ -29,7 +29,7 @@
#include <unordered_map>
namespace drogon {
class DROGON_EXPORT HttpResponseImpl : public HttpResponse {
class HttpResponseImpl : public HttpResponse {
friend class HttpResponseParser;
public: