From 895552dcae71df0d541fd3f06b4b5ebc0709688d Mon Sep 17 00:00:00 2001 From: An Tao Date: Wed, 24 Nov 2021 23:59:00 +0800 Subject: [PATCH] Export some symbols for Windows (#1088) --- lib/inc/drogon/HttpTypes.h | 24 +++++++++++++++++++++++- lib/inc/drogon/utils/Utilities.h | 4 ++-- orm_lib/inc/drogon/orm/Criteria.h | 10 ++++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/lib/inc/drogon/HttpTypes.h b/lib/inc/drogon/HttpTypes.h index b2c8c431..bdc19690 100644 --- a/lib/inc/drogon/HttpTypes.h +++ b/lib/inc/drogon/HttpTypes.h @@ -14,6 +14,7 @@ #pragma once #include #include +#include namespace drogon { @@ -168,5 +169,26 @@ enum class WebSocketMessageType Close, Unknown }; - +inline std::ostream &operator<<(std::ostream &out, drogon::ReqResult result) +{ + switch (result) + { + case ReqResult::Ok: + return out << "OK"; + case ReqResult::BadResponse: + return out << "Bad response from server"; + case ReqResult::NetworkFailure: + return out << "Network failure"; + case ReqResult::BadServerAddress: + return out << "Bad server address"; + case ReqResult::Timeout: + return out << "Timeout"; + case ReqResult::HandshakeError: + return out << "Handshake error"; + case ReqResult::InvalidCertificate: + return out << "Invalid certificate"; + default: + return out << "Unknown error"; + } +} } // namespace drogon diff --git a/lib/inc/drogon/utils/Utilities.h b/lib/inc/drogon/utils/Utilities.h index 29201fc0..83ba1432 100644 --- a/lib/inc/drogon/utils/Utilities.h +++ b/lib/inc/drogon/utils/Utilities.h @@ -28,8 +28,8 @@ #include #ifdef _WIN32 #include -char *strptime(const char *s, const char *f, struct tm *tm); -time_t timegm(struct tm *tm); +DROGON_EXPORT char *strptime(const char *s, const char *f, struct tm *tm); +DROGON_EXPORT time_t timegm(struct tm *tm); #endif namespace drogon { diff --git a/orm_lib/inc/drogon/orm/Criteria.h b/orm_lib/inc/drogon/orm/Criteria.h index c0a6c77a..5b1aa398 100644 --- a/orm_lib/inc/drogon/orm/Criteria.h +++ b/orm_lib/inc/drogon/orm/Criteria.h @@ -256,15 +256,17 @@ class DROGON_EXPORT Criteria } private: - friend const Criteria operator&&(Criteria cond1, Criteria cond2); + friend DROGON_EXPORT const Criteria operator&&(Criteria cond1, + Criteria cond2); - friend const Criteria operator||(Criteria cond1, Criteria cond2); + friend DROGON_EXPORT const Criteria operator||(Criteria cond1, + Criteria cond2); std::string conditionString_; std::function outputArgumentsFunc_; }; // namespace orm -const Criteria operator&&(Criteria cond1, Criteria cond2); -const Criteria operator||(Criteria cond1, Criteria cond2); +DROGON_EXPORT const Criteria operator&&(Criteria cond1, Criteria cond2); +DROGON_EXPORT const Criteria operator||(Criteria cond1, Criteria cond2); } // namespace orm } // namespace drogon