diff options
| author | Aotrix <[email protected]> | 2026-07-31 02:03:10 +0200 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2026-07-31 02:03:10 +0200 |
| commit | d27b6aeb73679737ca921b5fc25a7b9c1f3c832c (patch) | |
| tree | 6741a355c79302c29f839d546b1b6c6ad96b1566 /battleNetApi/src/apiUrl.cpp | |
| parent | 71b50eaf1e10028b2a0119bc935671be2f7b405e (diff) | |
Remove GameMode enum class
Diffstat (limited to 'battleNetApi/src/apiUrl.cpp')
| -rw-r--r-- | battleNetApi/src/apiUrl.cpp | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/battleNetApi/src/apiUrl.cpp b/battleNetApi/src/apiUrl.cpp index 5ef109c..8775943 100644 --- a/battleNetApi/src/apiUrl.cpp +++ b/battleNetApi/src/apiUrl.cpp @@ -3,41 +3,31 @@ #include <format> namespace bnet { -namespace { -std::string gamemodeToString(const GameMode &iGameMode) { - switch (iGameMode) { - case GameMode::constructed: - return "constructed"; - case GameMode::battlegrounds: - return "battlegrounds"; - case GameMode::mercenaries: - return "mercenaries"; - } -} -}; // namespace ApiUrl::ApiUrl(const std::string &iContentType, const std::string &iRegion) : mContentType{iContentType}, mRegion{iRegion} {} void ApiUrl::setRegion(const std::string &iRegion) { - if (not iRegion.empty()) { + if (!iRegion.empty()) { mRegion = iRegion; //!< The region of the data to receive, e.g. "eu" } } void ApiUrl::setLocale(const std::string &iLocale) { - if (not iLocale.empty()) { + if (!iLocale.empty()) { //!< The locale to reflect in localized data, e.g. "fr_FR" or "ko_KR" - //!< If you do not supply a value, all translations are returned. + //!< If you do !supply a value, all translations are returned. setValue(kLOCALE_KEY, iLocale); } } -void ApiUrl::setGameMode(const GameMode &iGameMode) { - //!< A recognized game mode, e.g. "constructed" - //!< @see - //!< https://community.developer.battle.net/documentation/hearthstone/guides/game-modes - setValue(kGAME_MODE_KEY, gamemodeToString(iGameMode)); +void ApiUrl::setGameMode(const std::string &iGameMode) { + if (!iGameMode.empty()) { + //!< A recognized game mode, e.g. "constructed" + //!< @see + //!< https://community.developer.battle.net/documentation/hearthstone/guides/game-modes + setValue(kGAME_MODE_KEY, iGameMode); + } } void ApiUrl::setPage(const std::string &iPage) { - if (not iPage.empty()) { + if (!iPage.empty()) { //!< The page to retrieve, e.g. "9" setValue(kPAGE_KEY, iPage); } @@ -59,7 +49,7 @@ std::string ApiUrl::text() const { for (const auto &[key, value] : aParameters) { aFormattedParameters += std::format("&{}={}", key, value); } - if (not aFormattedParameters.empty()) { + if (!aFormattedParameters.empty()) { aFormattedParameters[0] = '?'; } aFormattedParameters = std::format("https://{}.api.blizzard.com/hearthstone/{}/{}", mRegion, |
