diff --git a/libdevcore/CommonJS.cpp b/libdevcore/CommonJS.cpp
index d25deecfe..d362f66ab 100644
--- a/libdevcore/CommonJS.cpp
+++ b/libdevcore/CommonJS.cpp
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file CommonJS.cpp
* @authors:
* Gav Wood
@@ -23,7 +23,8 @@
#include "CommonJS.h"
-namespace dev {
+namespace dev
+{
bytes jsToBytes(std::string const& _s)
{
@@ -51,10 +52,10 @@ std::string jsPadded(std::string const& _s, unsigned _l, unsigned _r)
std::string jsPadded(std::string const& _s, unsigned _l)
{
if (_s.substr(0, 2) == "0x" || _s.find_first_not_of("0123456789") == std::string::npos)
- // Numeric: pad to right
+ // Numeric: pad to right
return jsPadded(_s, _l, _l);
else
- // Text: pad to the left
+ // Text: pad to the left
return jsPadded(_s, 0, _l);
}
diff --git a/libdevcore/CommonJS.h b/libdevcore/CommonJS.h
index 5b8d32f2e..ad4cb43d4 100644
--- a/libdevcore/CommonJS.h
+++ b/libdevcore/CommonJS.h
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file CommonJS.h
* @authors:
* Gav Wood
@@ -30,17 +30,21 @@
#include "Common.h"
#include "CommonData.h"
-namespace dev {
+namespace dev
+{
template std::string toJS(FixedHash const& _h)
{
return "0x" + toHex(_h.ref());
}
+
template std::string toJS(boost::multiprecision::number> const& _n)
{
return "0x" + toHex(toCompactBigEndian(_n));
}
-inline std::string toJS(dev::bytes const& _n) {
+
+inline std::string toJS(dev::bytes const& _n)
+{
return "0x" + dev::toHex(_n);
}
diff --git a/libethrpc/CMakeLists.txt b/libethrpc/CMakeLists.txt
index 6c3577d98..c2f0cbaae 100644
--- a/libethrpc/CMakeLists.txt
+++ b/libethrpc/CMakeLists.txt
@@ -10,9 +10,9 @@ set(EXECUTABLE ethrpc)
file(GLOB HEADERS "*.h")
if(ETH_STATIC)
- add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
+ add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS})
else()
- add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
+ add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
target_link_libraries(${EXECUTABLE} webthree)
diff --git a/libethrpc/CorsHttpServer.cpp b/libethrpc/CorsHttpServer.cpp
index 0164a65c4..c7479d4fb 100644
--- a/libethrpc/CorsHttpServer.cpp
+++ b/libethrpc/CorsHttpServer.cpp
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file CorsHttpServer.cpp
* @author Marek Kotewicz
* @date 2014
diff --git a/libethrpc/CorsHttpServer.h b/libethrpc/CorsHttpServer.h
index 2e896ccd6..96fc0dedd 100644
--- a/libethrpc/CorsHttpServer.h
+++ b/libethrpc/CorsHttpServer.h
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file CorsHttpServer.h
* @author Marek Kotewicz
* @date 2014
diff --git a/libethrpc/WebThreeStubServer.cpp b/libethrpc/WebThreeStubServer.cpp
index 5b664e270..75774523e 100644
--- a/libethrpc/WebThreeStubServer.cpp
+++ b/libethrpc/WebThreeStubServer.cpp
@@ -33,7 +33,7 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
-static Json::Value toJson(const dev::eth::BlockInfo& bi)
+static Json::Value toJson(dev::eth::BlockInfo const& bi)
{
Json::Value res;
res["hash"] = boost::lexical_cast(bi.hash);
@@ -53,7 +53,7 @@ static Json::Value toJson(const dev::eth::BlockInfo& bi)
return res;
}
-static Json::Value toJson(const dev::eth::PastMessage& t)
+static Json::Value toJson(dev::eth::PastMessage const& t)
{
Json::Value res;
res["input"] = jsFromBinary(t.input);
@@ -73,16 +73,16 @@ static Json::Value toJson(const dev::eth::PastMessage& t)
return res;
}
-static Json::Value toJson(const dev::eth::PastMessages& pms)
+static Json::Value toJson(dev::eth::PastMessages const& pms)
{
Json::Value res;
- for (dev::eth::PastMessage const & t: pms)
+ for (dev::eth::PastMessage const& t: pms)
res.append(toJson(t));
return res;
}
-static Json::Value toJson(const dev::eth::Transaction& t)
+static Json::Value toJson(dev::eth::Transaction const& t)
{
Json::Value res;
res["hash"] = toJS(t.sha3());
@@ -107,12 +107,12 @@ dev::eth::Interface* WebThreeStubServer::client() const
return m_web3.ethereum();
}
-std::string WebThreeStubServer::balanceAt(const string &address, const int& block)
+std::string WebThreeStubServer::balanceAt(string const& address, int const& block)
{
return toJS(client()->balanceAt(jsToAddress(address), block));
}
-dev::FixedHash<32> WebThreeStubServer::numberOrHash(Json::Value const &json) const
+dev::FixedHash<32> WebThreeStubServer::numberOrHash(Json::Value const& json) const
{
dev::FixedHash<32> hash;
if (!json["hash"].empty())
@@ -122,7 +122,7 @@ dev::FixedHash<32> WebThreeStubServer::numberOrHash(Json::Value const &json) con
return hash;
}
-Json::Value WebThreeStubServer::block(const Json::Value ¶ms)
+Json::Value WebThreeStubServer::block(Json::Value const& params)
{
if (!client())
return "";
@@ -131,7 +131,7 @@ Json::Value WebThreeStubServer::block(const Json::Value ¶ms)
return toJson(client()->blockInfo(hash));
}
-static TransactionJS toTransaction(const Json::Value &json)
+static TransactionJS toTransaction(Json::Value const& json)
{
TransactionJS ret;
if (!json.isObject() || json.empty()){
@@ -169,7 +169,7 @@ static TransactionJS toTransaction(const Json::Value &json)
return ret;
}
-std::string WebThreeStubServer::call(const Json::Value &json)
+std::string WebThreeStubServer::call(Json::Value const& json)
{
std::string ret;
if (!client())
@@ -187,7 +187,7 @@ std::string WebThreeStubServer::call(const Json::Value &json)
return ret;
}
-std::string WebThreeStubServer::codeAt(const string &address, const int& block)
+std::string WebThreeStubServer::codeAt(string const& address, int const& block)
{
return client() ? jsFromBinary(client()->codeAt(jsToAddress(address), block)) : "";
}
@@ -197,7 +197,7 @@ std::string WebThreeStubServer::coinbase()
return client() ? toJS(client()->address()) : "";
}
-double WebThreeStubServer::countAt(const string &address, const int& block)
+double WebThreeStubServer::countAt(string const& address, int const& block)
{
return client() ? (double)(uint64_t)client()->countAt(jsToAddress(address), block) : 0;
}
@@ -207,12 +207,12 @@ int WebThreeStubServer::defaultBlock()
return client() ? client()->getDefault() : 0;
}
-std::string WebThreeStubServer::fromAscii(const int& padding, const std::string& s)
+std::string WebThreeStubServer::fromAscii(int const& padding, std::string const& s)
{
return jsFromBinary(s, padding);
}
-double WebThreeStubServer::fromFixed(const string &s)
+double WebThreeStubServer::fromFixed(string const& s)
{
return jsFromFixed(s);
}
@@ -247,12 +247,12 @@ Json::Value WebThreeStubServer::keys()
return ret;
}
-std::string WebThreeStubServer::lll(const string &s)
+std::string WebThreeStubServer::lll(string const& s)
{
return toJS(dev::eth::compileLLL(s));
}
-static dev::eth::MessageFilter toMessageFilter(const Json::Value &json)
+static dev::eth::MessageFilter toMessageFilter(Json::Value const& json)
{
dev::eth::MessageFilter filter;
if (!json.isObject() || json.empty()){
@@ -295,12 +295,12 @@ static dev::eth::MessageFilter toMessageFilter(const Json::Value &json)
filter.altered(jsToAddress(json["altered"]["id"].asString()), jsToU256(json["altered"]["at"].asString()));
else
filter.altered(jsToAddress(json["altered"].asString()));
- }
+ }
return filter;
}
-Json::Value WebThreeStubServer::messages(const Json::Value &json)
+Json::Value WebThreeStubServer::messages(Json::Value const& json)
{
Json::Value res;
if (!client())
@@ -313,7 +313,7 @@ int WebThreeStubServer::number()
return client() ? client()->number() + 1 : 0;
}
-std::string WebThreeStubServer::offset(const int& o, const std::string& s)
+std::string WebThreeStubServer::offset(int const & o, std::string const& s)
{
return toJS(jsToU256(s) + o);
}
@@ -323,18 +323,18 @@ int WebThreeStubServer::peerCount()
return m_web3.peerCount();
}
-std::string WebThreeStubServer::secretToAddress(const string &s)
+std::string WebThreeStubServer::secretToAddress(string const& s)
{
return toJS(KeyPair(jsToSecret(s)).address());
}
-bool WebThreeStubServer::setCoinbase(const std::string &address)
+bool WebThreeStubServer::setCoinbase(std::string const& address)
{
client()->setAddress(jsToAddress(address));
return true;
}
-bool WebThreeStubServer::setListening(const bool &listening)
+bool WebThreeStubServer::setListening(bool const& listening)
{
if (listening)
m_web3.startNetwork();
@@ -343,7 +343,7 @@ bool WebThreeStubServer::setListening(const bool &listening)
return true;
}
-bool WebThreeStubServer::setMining(const bool &mining)
+bool WebThreeStubServer::setMining(bool const& mining)
{
if (!client())
return Json::nullValue;
@@ -355,32 +355,32 @@ bool WebThreeStubServer::setMining(const bool &mining)
return true;
}
-std::string WebThreeStubServer::sha3(const string &s)
+std::string WebThreeStubServer::sha3(string const& s)
{
return toJS(dev::eth::sha3(jsToBytes(s)));
}
-std::string WebThreeStubServer::stateAt(const string &address, const int& block, const string &storage)
+std::string WebThreeStubServer::stateAt(string const& address, int const& block, string const& storage)
{
return client() ? toJS(client()->stateAt(jsToAddress(address), jsToU256(storage), block)) : "";
}
-std::string WebThreeStubServer::toAscii(const string &s)
+std::string WebThreeStubServer::toAscii(string const& s)
{
return jsToBinary(s);
}
-std::string WebThreeStubServer::toDecimal(const string &s)
+std::string WebThreeStubServer::toDecimal(string const& s)
{
return jsToDecimal(s);
}
-std::string WebThreeStubServer::toFixed(const double &s)
+std::string WebThreeStubServer::toFixed(double const& s)
{
return jsToFixed(s);
}
-std::string WebThreeStubServer::transact(const Json::Value &json)
+std::string WebThreeStubServer::transact(Json::Value const& json)
{
std::string ret;
if (!client())
@@ -406,7 +406,7 @@ std::string WebThreeStubServer::transact(const Json::Value &json)
return ret;
}
-Json::Value WebThreeStubServer::transaction(const int &i, const Json::Value ¶ms)
+Json::Value WebThreeStubServer::transaction(int const& i, Json::Value const& params)
{
if (!client())
return "";
@@ -415,7 +415,7 @@ Json::Value WebThreeStubServer::transaction(const int &i, const Json::Value &par
return toJson(client()->transaction(hash, i));
}
-Json::Value WebThreeStubServer::uncle(const int &i, const Json::Value ¶ms)
+Json::Value WebThreeStubServer::uncle(int const& i, Json::Value const& params)
{
if (!client())
return "";
@@ -424,7 +424,7 @@ Json::Value WebThreeStubServer::uncle(const int &i, const Json::Value ¶ms)
return toJson(client()->uncle(hash, i));
}
-int WebThreeStubServer::watch(const string &json)
+int WebThreeStubServer::watch(string const& json)
{
unsigned ret = -1;
if (!client())
@@ -444,14 +444,14 @@ int WebThreeStubServer::watch(const string &json)
return ret;
}
-bool WebThreeStubServer::check(const int& id)
+bool WebThreeStubServer::check(int const& id)
{
if (!client())
return false;
return client()->checkWatch(id);
}
-bool WebThreeStubServer::killWatch(const int& id)
+bool WebThreeStubServer::killWatch(int const& id)
{
if (!client())
return false;
diff --git a/libethrpc/WebThreeStubServer.h b/libethrpc/WebThreeStubServer.h
index 8b67ff44f..7076b5d8f 100644
--- a/libethrpc/WebThreeStubServer.h
+++ b/libethrpc/WebThreeStubServer.h
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file WebThreeStubServer.h
* @authors:
* Gav Wood
@@ -38,45 +38,45 @@ class WebThreeStubServer: public AbstractWebThreeStubServer
public:
WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3);
- virtual std::string balanceAt(const std::string& address, const int& block);
- virtual Json::Value block(const Json::Value& params);
- virtual std::string call(const Json::Value& json);
- virtual std::string codeAt(const std::string& address, const int& block);
+ virtual std::string balanceAt(std::string const& address, int const& block);
+ virtual Json::Value block(Json::Value const& params);
+ virtual std::string call(Json::Value const& json);
+ virtual std::string codeAt(std::string const& address, int const& block);
virtual std::string coinbase();
- virtual double countAt(const std::string& address, const int& block);
+ virtual double countAt(std::string const& address, int const& block);
virtual int defaultBlock();
- virtual std::string fromAscii(const int& padding, const std::string& s);
- virtual double fromFixed(const std::string& s);
+ virtual std::string fromAscii(int const& padding, std::string const& s);
+ virtual double fromFixed(std::string const& s);
virtual std::string gasPrice();
virtual bool listening();
virtual bool mining();
virtual std::string key();
virtual Json::Value keys();
- virtual std::string lll(const std::string& s);
- virtual Json::Value messages(const Json::Value& json);
+ virtual std::string lll(std::string const& s);
+ virtual Json::Value messages(Json::Value const& json);
virtual int number();
- virtual std::string offset(const int& o, const std::string& s);
+ virtual std::string offset(int const& o, std::string const& s);
virtual int peerCount();
- virtual std::string secretToAddress(const std::string& s);
- virtual bool setCoinbase(const std::string& address);
- virtual bool setListening(const bool& listening);
- virtual bool setMining(const bool& mining);
- virtual std::string sha3(const std::string& s);
- virtual std::string stateAt(const std::string& address, const int& block, const std::string& storage);
- virtual std::string toAscii(const std::string& s);
- virtual std::string toDecimal(const std::string& s);
- virtual std::string toFixed(const double& s);
- virtual std::string transact(const Json::Value& json);
- virtual Json::Value transaction(const int& i, const Json::Value& params);
- virtual Json::Value uncle(const int& i, const Json::Value ¶ms);
- virtual int watch(const std::string& json);
- virtual bool check(const int& id);
- virtual bool killWatch(const int& id);
+ virtual std::string secretToAddress(std::string const& s);
+ virtual bool setCoinbase(std::string const& address);
+ virtual bool setListening(bool const& listening);
+ virtual bool setMining(bool const& mining);
+ virtual std::string sha3(std::string const& s);
+ virtual std::string stateAt(std::string const& address, int const& block, std::string const& storage);
+ virtual std::string toAscii(std::string const& s);
+ virtual std::string toDecimal(std::string const& s);
+ virtual std::string toFixed(double const& s);
+ virtual std::string transact(Json::Value const & json);
+ virtual Json::Value transaction(int const& i, Json::Value const& params);
+ virtual Json::Value uncle(int const& i, Json::Value const& params);
+ virtual int watch(std::string const& json);
+ virtual bool check(int const& id);
+ virtual bool killWatch(int const& id);
void setKeys(std::vector _keys) { m_keys = _keys; }
private:
dev::eth::Interface* client() const;
dev::WebThreeDirect& m_web3;
std::vector m_keys;
- dev::FixedHash<32> numberOrHash(Json::Value const &_json) const;
+ dev::FixedHash<32> numberOrHash(Json::Value const& _json) const;
};
diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp
index a0cb5f8e4..e0525dee9 100644
--- a/libqethereum/QEthereum.cpp
+++ b/libqethereum/QEthereum.cpp
@@ -400,7 +400,7 @@ static QString toJson(dev::eth::Transaction const& _bi)
return QString::fromUtf8(QJsonDocument(v).toJson());
}
-dev::FixedHash<32> QEthereum::numberOrHash(QString const &_json) const
+dev::FixedHash<32> QEthereum::numberOrHash(QString const& _json) const
{
QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object();
dev::FixedHash<32> hash;
diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h
index 992af3dd3..57c4a77a4 100644
--- a/libqethereum/QEthereum.h
+++ b/libqethereum/QEthereum.h
@@ -6,14 +6,18 @@
#include
#include
-namespace dev {
-namespace eth {
+namespace dev
+{
+namespace eth
+{
class Interface;
}
-namespace shh {
+namespace shh
+{
class Interface;
}
-namespace p2p {
+namespace p2p
+{
class Host;
}
}
@@ -199,12 +203,12 @@ private:
Q_PROPERTY(QString key READ key NOTIFY keysChanged)
Q_PROPERTY(QStringList keys READ keys NOTIFY keysChanged)
Q_PROPERTY(int defaultBlock READ getDefault WRITE setDefault)
- Q_PROPERTY(unsigned number READ number NOTIFY watchChanged)
+ Q_PROPERTY(unsigned number READ number NOTIFY watchChanged)
dev::eth::Interface* m_client;
std::vector m_watches;
QList m_accounts;
- dev::FixedHash<32> numberOrHash(QString const &_json) const;
+ dev::FixedHash<32> numberOrHash(QString const& _json) const;
};
class QPeer2Peer : public QObject
diff --git a/test/jsonrpc.cpp b/test/jsonrpc.cpp
index e163014ac..0e14fab82 100644
--- a/test/jsonrpc.cpp
+++ b/test/jsonrpc.cpp
@@ -1,19 +1,19 @@
/*
This file is part of cpp-ethereum.
-
+
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
- */
+*/
/** @file jsonrpc.cpp
* @author Marek Kotewicz
* @date 2014
@@ -41,7 +41,8 @@ using namespace dev;
using namespace dev::eth;
namespace js = json_spirit;
-namespace jsonrpc_tests {
+namespace jsonrpc_tests
+{
string name = "Ethereum(++) tests";
string dbPath;