aboutsummaryrefslogtreecommitdiff
path: root/src/qt/rpcconsole.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2014-08-20 15:15:16 -0400
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-06-04 09:16:05 +0200
commit15982a8b69ec6ab3c3a6bf71fc6a9b681d3ff541 (patch)
tree854a48a039d4199dbc1acf33ef94d06d007f1348 /src/qt/rpcconsole.cpp
parent5e3060c0d104c734e7e2a200e2d937ea01166c8a (diff)
downloadbitcoin-15982a8b69ec6ab3c3a6bf71fc6a9b681d3ff541.tar.xz
Convert tree to using univalue. Eliminate all json_spirit uses.
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r--src/qt/rpcconsole.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 29c971ec79..29b1e8f262 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -16,10 +16,10 @@
#include "rpcclient.h"
#include "util.h"
-#include "json/json_spirit_value.h"
-
#include <openssl/crypto.h>
+#include "univalue/univalue.h"
+
#ifdef ENABLE_WALLET
#include <db_cxx.h>
#endif
@@ -167,21 +167,25 @@ void RPCExecutor::request(const QString &command)
std::string strPrint;
// Convert argument list to JSON objects in method-dependent way,
// and pass it along with the method name to the dispatcher.
- json_spirit::Value result = tableRPC.execute(
+ UniValue result = tableRPC.execute(
args[0],
RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end())));
// Format result reply
- if (result.type() == json_spirit::null_type)
+ if (result.isNull())
strPrint = "";
- else if (result.type() == json_spirit::str_type)
+ else if (result.isStr())
strPrint = result.get_str();
else
- strPrint = write_string(result, true);
+ strPrint = result.write(2);
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
}
+<<<<<<< HEAD
catch (const json_spirit::Object& objError)
+=======
+ catch (UniValue& objError)
+>>>>>>> Convert tree to using univalue. Eliminate all json_spirit uses.
{
try // Nice formatting for standard-format error
{
@@ -191,7 +195,7 @@ void RPCExecutor::request(const QString &command)
}
catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
{ // Show raw JSON object
- emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
+ emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write()));
}
}
catch (const std::exception& e)