mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge #8807: [univalue] Pull subtree from upstream
3650668
Squashed 'src/univalue/' changes from f32df99..daf1285 (MarcoFalke)
This commit is contained in:
parent
18218aa3c2
commit
6262f79f00
@ -56,7 +56,7 @@ public:
|
|||||||
bool setNumStr(const std::string& val);
|
bool setNumStr(const std::string& val);
|
||||||
bool setInt(uint64_t val);
|
bool setInt(uint64_t val);
|
||||||
bool setInt(int64_t val);
|
bool setInt(int64_t val);
|
||||||
bool setInt(int val) { return setInt((int64_t)val); }
|
bool setInt(int val_) { return setInt((int64_t)val_); }
|
||||||
bool setFloat(double val);
|
bool setFloat(double val);
|
||||||
bool setStr(const std::string& val);
|
bool setStr(const std::string& val);
|
||||||
bool setArray();
|
bool setArray();
|
||||||
@ -95,28 +95,28 @@ public:
|
|||||||
bool push_backV(const std::vector<UniValue>& vec);
|
bool push_backV(const std::vector<UniValue>& vec);
|
||||||
|
|
||||||
bool pushKV(const std::string& key, const UniValue& val);
|
bool pushKV(const std::string& key, const UniValue& val);
|
||||||
bool pushKV(const std::string& key, const std::string& val) {
|
bool pushKV(const std::string& key, const std::string& val_) {
|
||||||
UniValue tmpVal(VSTR, val);
|
UniValue tmpVal(VSTR, val_);
|
||||||
return pushKV(key, tmpVal);
|
return pushKV(key, tmpVal);
|
||||||
}
|
}
|
||||||
bool pushKV(const std::string& key, const char *val_) {
|
bool pushKV(const std::string& key, const char *val_) {
|
||||||
std::string val(val_);
|
std::string _val(val_);
|
||||||
return pushKV(key, val);
|
return pushKV(key, _val);
|
||||||
}
|
}
|
||||||
bool pushKV(const std::string& key, int64_t val) {
|
bool pushKV(const std::string& key, int64_t val_) {
|
||||||
UniValue tmpVal(val);
|
UniValue tmpVal(val_);
|
||||||
return pushKV(key, tmpVal);
|
return pushKV(key, tmpVal);
|
||||||
}
|
}
|
||||||
bool pushKV(const std::string& key, uint64_t val) {
|
bool pushKV(const std::string& key, uint64_t val_) {
|
||||||
UniValue tmpVal(val);
|
UniValue tmpVal(val_);
|
||||||
return pushKV(key, tmpVal);
|
return pushKV(key, tmpVal);
|
||||||
}
|
}
|
||||||
bool pushKV(const std::string& key, int val) {
|
bool pushKV(const std::string& key, int val_) {
|
||||||
UniValue tmpVal((int64_t)val);
|
UniValue tmpVal((int64_t)val_);
|
||||||
return pushKV(key, tmpVal);
|
return pushKV(key, tmpVal);
|
||||||
}
|
}
|
||||||
bool pushKV(const std::string& key, double val) {
|
bool pushKV(const std::string& key, double val_) {
|
||||||
UniValue tmpVal(val);
|
UniValue tmpVal(val_);
|
||||||
return pushKV(key, tmpVal);
|
return pushKV(key, tmpVal);
|
||||||
}
|
}
|
||||||
bool pushKVs(const UniValue& obj);
|
bool pushKVs(const UniValue& obj);
|
||||||
|
@ -119,32 +119,29 @@ bool UniValue::setNumStr(const string& val_)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UniValue::setInt(uint64_t val)
|
bool UniValue::setInt(uint64_t val_)
|
||||||
{
|
{
|
||||||
string s;
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
|
|
||||||
oss << val;
|
oss << val_;
|
||||||
|
|
||||||
return setNumStr(oss.str());
|
return setNumStr(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UniValue::setInt(int64_t val)
|
bool UniValue::setInt(int64_t val_)
|
||||||
{
|
{
|
||||||
string s;
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
|
|
||||||
oss << val;
|
oss << val_;
|
||||||
|
|
||||||
return setNumStr(oss.str());
|
return setNumStr(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UniValue::setFloat(double val)
|
bool UniValue::setFloat(double val_)
|
||||||
{
|
{
|
||||||
string s;
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
|
|
||||||
oss << std::setprecision(16) << val;
|
oss << std::setprecision(16) << val_;
|
||||||
|
|
||||||
bool ret = setNumStr(oss.str());
|
bool ret = setNumStr(oss.str());
|
||||||
typ = VNUM;
|
typ = VNUM;
|
||||||
@ -173,12 +170,12 @@ bool UniValue::setObject()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UniValue::push_back(const UniValue& val)
|
bool UniValue::push_back(const UniValue& val_)
|
||||||
{
|
{
|
||||||
if (typ != VARR)
|
if (typ != VARR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
values.push_back(val);
|
values.push_back(val_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,13 +189,13 @@ bool UniValue::push_backV(const std::vector<UniValue>& vec)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UniValue::pushKV(const std::string& key, const UniValue& val)
|
bool UniValue::pushKV(const std::string& key, const UniValue& val_)
|
||||||
{
|
{
|
||||||
if (typ != VOBJ)
|
if (typ != VOBJ)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
keys.push_back(key);
|
keys.push_back(key);
|
||||||
values.push_back(val);
|
values.push_back(val_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +225,7 @@ int UniValue::findKey(const std::string& key) const
|
|||||||
bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t)
|
bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t)
|
||||||
{
|
{
|
||||||
for (std::map<std::string,UniValue::VType>::const_iterator it = t.begin();
|
for (std::map<std::string,UniValue::VType>::const_iterator it = t.begin();
|
||||||
it != t.end(); it++) {
|
it != t.end(); ++it) {
|
||||||
int idx = findKey(it->first);
|
int idx = findKey(it->first);
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user