summaryrefslogtreecommitdiff
path: root/battleNetApi/src/tokenPool.cpp
diff options
context:
space:
mode:
authorAotrix <[email protected]>2026-03-27 18:48:55 +0100
committerAotrix <[email protected]>2026-03-27 18:48:55 +0100
commitf01072eb4166fc68f59519ebf84de46e7386abf5 (patch)
tree72885a1d6296b787bcd2d19d45ccce4777274717 /battleNetApi/src/tokenPool.cpp
parenta20c4abc424404518bcb656a3f22f43991a6c164 (diff)
Generate json card lists with static methods
Instead of creating a useless instance of HearthstoneApi class, calls static methods.
Diffstat (limited to 'battleNetApi/src/tokenPool.cpp')
-rw-r--r--battleNetApi/src/tokenPool.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/battleNetApi/src/tokenPool.cpp b/battleNetApi/src/tokenPool.cpp
new file mode 100644
index 0000000..20ea6cd
--- /dev/null
+++ b/battleNetApi/src/tokenPool.cpp
@@ -0,0 +1,12 @@
+#include <tokenPool.hpp>
+
+std::optional<std::string> TokenPool::unusedToken() {
+ if (mTokenContainer.empty()) {
+ return std::nullopt;
+ }
+ Token aOutputToken{mTokenContainer.front()};
+ mTokenContainer.pop();
+ return aOutputToken.text();
+}
+
+void TokenPool::fillTokenSource(const std::string &iJsonPath) { mTokenContainer.emplace(Token(iJsonPath)); }