From bcc5e2d9e55f0de155480d2af578e5fc99e8511b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedek=20L=C3=A1szl=C3=B3?= Date: Sun, 7 Jul 2024 21:56:03 +0200 Subject: [PATCH] debug formatting for c++20 --- src/rum/http/request.cpp | 12 +++++++++++- src/rum/http/uri.cpp | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/rum/http/request.cpp b/src/rum/http/request.cpp index 7d9f11e..3830c44 100644 --- a/src/rum/http/request.cpp +++ b/src/rum/http/request.cpp @@ -2,6 +2,8 @@ #include #if __cplusplus >= 202302L #include +#else +#include #endif #include #include @@ -19,7 +21,15 @@ Request::operator std::string() const { cookie_string += "\t\t'" + cookie.first + "': '" + cookie.second + "'\n"; } #if __cplusplus < 202302L - return ""; + std::stringstream text; + text << "Request{{\n" + << "\tmethod: " << method << "\n" + << "\t" << (std::string)uri << "\n" + << "\theaders: \n" + << headers_string << "\tcookies: \n" + << cookie_string << "\tbody: '" << body << "'\n}}"; + + return text.str(); #else return std::vformat( "Request{{\n" diff --git a/src/rum/http/uri.cpp b/src/rum/http/uri.cpp index d91360b..1e30a6b 100644 --- a/src/rum/http/uri.cpp +++ b/src/rum/http/uri.cpp @@ -2,8 +2,11 @@ #include #include #include +#include #if __cplusplus >= 202302L #include +#else +#include #endif #include @@ -15,7 +18,18 @@ URI::operator std::string() const { query += "\t\t'" + param.first + "': '" + param.second + "'\n"; } #if __cplusplus < 202302L - return ""; + std::stringstream text; + text << "URI{{" + << "\n\tscheme: '" << scheme << "'" + << "\n\tuser: '" << user << "'" + << "\n\tpassword: '" << password << "'" + << "\n\thost: '" << host << "'" + << "\n\tport: '" << port << "'" + << "\n\tpath: '" << path << "'" + << "\n\tquery: \n" + << query << "\n\tfragment: '" << fragment << "'\n}}"; + + return text.str(); #else return std::vformat( "URI{{"