Create pools directly from JSON objects.

This commit is contained in:
XMRig
2019-02-17 15:43:55 +07:00
parent 0adcb19590
commit 73a1f9bd87
9 changed files with 76 additions and 47 deletions

View File

@@ -57,7 +57,7 @@ bool xmrig::Pools::setUrl(const char *url)
Pool pool(url);
if (pool.isValid()) {
m_data.push_back(pool);
m_data.push_back(std::move(pool));
return true;
}
@@ -127,6 +127,23 @@ void xmrig::Pools::adjust(const Algorithm &algorithm)
}
void xmrig::Pools::load(const rapidjson::Value &pools)
{
m_data.clear();
for (const rapidjson::Value &value : pools.GetArray()) {
if (!value.IsObject()) {
continue;
}
Pool pool(value);
if (pool.isValid()) {
m_data.push_back(std::move(pool));
}
}
}
void xmrig::Pools::print()
{
size_t i = 1;