aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-11-15 23:47:52 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-11-23 18:51:06 +0800
commit0ff4cbe51ba653397a1937c8c08b3d09541492ef (patch)
tree03a8798bca8f2ef221d77fc8a4c6c5390105800c /libdevcore
parent6251a289dd55cc54f8da5a907dc4982a4b5e57fa (diff)
downloaddexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar.gz
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar.bz2
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar.lz
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar.xz
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.tar.zst
dexon-solidity-0ff4cbe51ba653397a1937c8c08b3d09541492ef.zip
Add SMTChecker tests for standard JSON
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/JSON.cpp8
-rw-r--r--libdevcore/JSON.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/libdevcore/JSON.cpp b/libdevcore/JSON.cpp
index 6317cc89..086fae50 100644
--- a/libdevcore/JSON.cpp
+++ b/libdevcore/JSON.cpp
@@ -21,6 +21,8 @@
#include "JSON.h"
+#include "CommonIO.h"
+
#include <sstream>
#include <map>
#include <memory>
@@ -111,4 +113,10 @@ bool jsonParse(string const& _input, Json::Value& _json, string *_errs /* = null
return parse(readerBuilder, _input, _json, _errs);
}
+bool jsonParseFile(string const& _fileName, Json::Value& _json, string *_errs /* = nullptr */)
+{
+ return jsonParse(readFileAsString(_fileName), _json, _errs);
+}
+
+
} // namespace dev
diff --git a/libdevcore/JSON.h b/libdevcore/JSON.h
index 1ce822cd..ecb93467 100644
--- a/libdevcore/JSON.h
+++ b/libdevcore/JSON.h
@@ -48,4 +48,11 @@ bool jsonParseStrict(std::string const& _input, Json::Value& _json, std::string*
/// \return \c true if the document was successfully parsed, \c false if an error occurred.
bool jsonParse(std::string const& _input, Json::Value& _json, std::string* _errs = nullptr);
+/// Parse a JSON string (@a _input) and writes resulting JSON object to (@a _json)
+/// \param _input file containing JSON input
+/// \param _json [out] resulting JSON object
+/// \param _errs [out] Formatted error messages
+/// \return \c true if the document was successfully parsed, \c false if an error occurred.
+bool jsonParseFile(std::string const& _fileName, Json::Value& _json, std::string* _errs = nullptr);
+
}