-
-
Save stevenroose/b5a9a79e84bb949b08112d560ccec9e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int UniValue::findKey(const std::string& key) const | |
{ | |
for (unsigned int i = 0; i < keys.size(); i++) { | |
if (keys[i] == key) | |
return (int) i; | |
} | |
return -1; | |
} | |
const UniValue& UniValue::operator[](const std::string& key) const | |
{ | |
if (typ != VOBJ) | |
return NullUniValue; | |
int index = findKey(key); | |
if (index < 0) | |
return NullUniValue; | |
return values.at(index); | |
} | |
const UniValue& find_value(const UniValue& obj, const std::string& name) | |
{ | |
for (unsigned int i = 0; i < obj.keys.size(); i++) | |
if (obj.keys[i] == name) | |
return obj.values.at(i); | |
return NullUniValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment