From c31ccb5b03d4562fb91cc5672b82767ead0e26b8 Mon Sep 17 00:00:00 2001 From: Aotrix <9aotrix@protonmail.com> Date: Sun, 30 Aug 2026 15:58:35 +0200 Subject: Fix CMakeLists.txt missing cpp file --- battleNetApi/CMakeLists.txt | 3 +- battleNetApi/include/hearthstoneTokenBuilder.hpp | 42 +++++++++++++++--------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/battleNetApi/CMakeLists.txt b/battleNetApi/CMakeLists.txt index 6999d57..a89bb11 100644 --- a/battleNetApi/CMakeLists.txt +++ b/battleNetApi/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.12) get_filename_component(FNAME ${CMAKE_SOURCE_DIR} NAME) set(ProjectName ${FNAME}) @@ -17,7 +17,6 @@ set(INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) set(SRC ${PROJECT_SOURCE_DIR}/src/hearthstoneApi.cpp ${PROJECT_SOURCE_DIR}/src/token.cpp - ${PROJECT_SOURCE_DIR}/src/tokenBuilder.cpp ${PROJECT_SOURCE_DIR}/src/hearthstoneTokenBuilder.cpp ${PROJECT_SOURCE_DIR}/src/apiUrl.cpp ${PROJECT_SOURCE_DIR}/src/main.cpp diff --git a/battleNetApi/include/hearthstoneTokenBuilder.hpp b/battleNetApi/include/hearthstoneTokenBuilder.hpp index 571554f..880d64d 100644 --- a/battleNetApi/include/hearthstoneTokenBuilder.hpp +++ b/battleNetApi/include/hearthstoneTokenBuilder.hpp @@ -6,12 +6,14 @@ #include #include -namespace bnet { +namespace bnet +{ using nlohmann::json; static constexpr std::uint64_t kTOKEN_CONTENT_MIN_LENGTH{10}; -class HearthstoneTokenBuilder : TokenBuilder { +class HearthstoneTokenBuilder : TokenBuilder +{ private: std::shared_ptr _currentToken; bool _allowBattleNetApiCall{false}; @@ -21,38 +23,46 @@ class HearthstoneTokenBuilder : TokenBuilder { [[nodiscard]] bool isUpdateSourceFileAllowed() const; [[nodiscard]] - bool isTokenValid(const json &iTokenJson) const; - static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb, - std::string *iUserData); + bool isTokenValid(const json& iTokenJson) const; + static size_t curlCallbackStringOutput(void* iPtr, + size_t iSize, + size_t iNmemb, + std::string* iUserData); [[nodiscard]] std::chrono::seconds getCurrentTime() const; [[nodiscard]] - Token getTokenWithApi(const std::string &iCredentialsJsonFilePath) const; + Token getTokenWithApi(const std::string& iCredentialsJsonFilePath) const; [[nodiscard]] - Token getTokenWithApi(const json &iCredentials) const; - void writeTokenToLocalFile(std::shared_ptr &iToken, - const std::string &iTokenFileOutputPath) const; + Token getTokenWithApi(const json& iCredentials) const; + void writeTokenToLocalFile(std::shared_ptr& iToken, + const std::string& iTokenFileOutputPath) const; public: - HearthstoneTokenBuilder(const std::span &iJsonPaths); + HearthstoneTokenBuilder(const std::span& iJsonPaths); + template - HearthstoneTokenBuilder(CredentialJsonPaths... iCredentialJsonPaths) { + HearthstoneTokenBuilder(CredentialJsonPaths... iCredentialJsonPaths) + { (_credentialJsonPaths.push_back(iCredentialJsonPaths), ...); } + template - HearthstoneTokenBuilder &addCredentialJsonFiles(CredentialJsonPaths... iCredentialJsonPaths) { + HearthstoneTokenBuilder& addCredentialJsonFiles(CredentialJsonPaths... iCredentialJsonPaths) + { (_credentialJsonPaths.push_back(iCredentialJsonPaths), ...); + return *this; } - HearthstoneTokenBuilder &allowBattleNetApiCall(); - HearthstoneTokenBuilder &allowUpdateSourceFile(); - HearthstoneTokenBuilder &allowExpiredToken(); + + HearthstoneTokenBuilder& allowBattleNetApiCall(); + HearthstoneTokenBuilder& allowUpdateSourceFile(); + HearthstoneTokenBuilder& allowExpiredToken(); /** * @return Create an access token to perform API requests. * First, the cache files are checked. (Which ones?) * A new token is computed if the token lifetimes expired, * or if there is no token at all. */ - HearthstoneTokenBuilder &buildToken() override; + HearthstoneTokenBuilder& buildToken() override; [[nodiscard]] std::shared_ptr getToken() override; }; -- cgit v1.2.3