From c777502a1c22b240f66069831e6f0cb1e7e41b64 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Sat, 10 Oct 2026 16:09:48 +0200 Subject: Use string_view and delete gameView --- battleNetApi/include/apiUrl.hpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'battleNetApi/include') diff --git a/battleNetApi/include/apiUrl.hpp b/battleNetApi/include/apiUrl.hpp index 1360102..bc62d42 100644 --- a/battleNetApi/include/apiUrl.hpp +++ b/battleNetApi/include/apiUrl.hpp @@ -3,16 +3,18 @@ #include #include -namespace bnet { +namespace bnet +{ -class ApiUrl { +class ApiUrl +{ public: - ApiUrl(const std::string &iContentType, const std::string &iRegion); + ApiUrl(const std::string& iContentType, + const std::string& iRegion); - void setRegion(const std::string &iRegion); - void setLocale(const std::string &iLocale); - void setGameMode(const std::string &iGameMode); - void setPage(const std::string &iPage); + void setRegion(const std::string& iRegion); + void setLocale(const std::string& iLocale); + void setGameMode(const std::string& iGameMode); void setPage(uint64_t iPage); void setPageSize(uint64_t iPageSize); @@ -25,15 +27,16 @@ class ApiUrl { std::string text() const; private: - static constexpr std::string kLOCALE_KEY{"locale"}; - static constexpr std::string kGAME_MODE_KEY{"gameMode"}; - static constexpr std::string kPAGE_KEY{"page"}; - static constexpr std::string kPAGE_SIZE_KEY{"pageSize"}; + std::string_view kLOCALE_KEY{"locale"}; + std::string_view kGAME_MODE_KEY{"gameMode"}; + std::string_view kPAGE_KEY{"page"}; + std::string_view kPAGE_SIZE_KEY{"pageSize"}; std::string mContentType; std::string mRegion; - std::unordered_map aParameters; + std::unordered_map aParameters; - void setValue(const std::string &iKey, const std::string &iValue); - bool hasValue(const std::string &iKey) const; + void setValue(std::string_view iKey, + const std::string& iValue); + bool hasValue(std::string_view iKey) const; }; }; // namespace bnet -- cgit v1.2.3