Changeset View
Changeset View
Standalone View
Standalone View
src/univalue/lib/univalue.cpp
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void UniValue::__pushKV(const std::string& key, const UniValue& val_) | void UniValue::__pushKV(const std::string& key, const UniValue& val_) | ||||
{ | { | ||||
keys.push_back(key); | keys.push_back(key); | ||||
values.push_back(val_); | values.push_back(val_); | ||||
} | } | ||||
bool UniValue::pushKV(const std::string& key, const UniValue& val_) | bool UniValue::pushKV(const std::string& key, const UniValue& val_, bool checkForDuplicates) | ||||
{ | { | ||||
if (typ != VOBJ) | if (typ != VOBJ) | ||||
return false; | return false; | ||||
size_t idx; | size_t idx; | ||||
if (findKey(key, idx)) | if (checkForDuplicates && findKey(key, idx)) | ||||
values[idx] = val_; | values[idx] = val_; | ||||
else | else | ||||
__pushKV(key, val_); | __pushKV(key, val_); | ||||
return true; | return true; | ||||
} | } | ||||
bool UniValue::pushKVs(const UniValue& obj) | bool UniValue::pushKVs(const UniValue& obj) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |