aboutsummaryrefslogtreecommitdiff
path: root/src/univalue
diff options
context:
space:
mode:
Diffstat (limited to 'src/univalue')
-rw-r--r--src/univalue/univalue.cpp12
-rw-r--r--src/univalue/univalue.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/src/univalue/univalue.cpp b/src/univalue/univalue.cpp
index 994d93113a..e8fc513433 100644
--- a/src/univalue/univalue.cpp
+++ b/src/univalue/univalue.cpp
@@ -213,3 +213,15 @@ const char *uvTypeName(UniValue::VType t)
return NULL;
}
+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[i];
+ }
+ }
+
+ return NullUniValue;
+} \ No newline at end of file
diff --git a/src/univalue/univalue.h b/src/univalue/univalue.h
index c37a3829fc..57a96abe26 100644
--- a/src/univalue/univalue.h
+++ b/src/univalue/univalue.h
@@ -161,6 +161,7 @@ public:
std::istringstream(getValStr()) >> ret;
return ret;
}
+ friend const UniValue& find_value( const UniValue& obj, const std::string& name);
};
//
@@ -248,5 +249,8 @@ extern enum jtokentype getJsonToken(std::string& tokenVal,
extern const char *uvTypeName(UniValue::VType t);
extern const UniValue NullUniValue;
+
+const UniValue& find_value( const UniValue& obj, const std::string& name);
+
#endif // BITCOIN_UNIVALUE_UNIVALUE_H