summaryrefslogtreecommitdiff
path: root/battleNetApi/src/tokenPool.cpp
blob: 20ea6cd58dc0fa24cb6c77e1a9e6c58d05a8123e (plain)
1
2
3
4
5
6
7
8
9
10
11
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)); }