Browse Source

more style fixes and an addition to the coding style

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
6ee8be71ba
  1. 16
      CodingStandards.txt
  2. 5
      alethzero/MainWin.cpp
  3. 7
      alethzero/NatspecHandler.cpp

16
CodingStandards.txt

@ -162,3 +162,19 @@ d. In general expressions should be roughly as important/semantically meaningful
a. Comments should be doxygen-compilable, using @notation rather than \notation. a. Comments should be doxygen-compilable, using @notation rather than \notation.
12. Include Headers
a. Includes should go in order of lower level (STL -> boost -> libdevcore -> libdevcrypto -> libethcore -> libethereum) to higher level. Lower levels are basically dependencies to the higher levels. For example:
#include <string>
#include <boost/filesystem.hpp>
#include <libdevcore/Common.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/Exceptions.h>
#include <libdevcore/Log.h>
#include <libdevcrypto/SHA3.h>
#include <libethereum/Defaults.h>
b. The only exception to the above rule is the top of a .cpp file where its corresponding header should be located.

5
alethzero/MainWin.cpp

@ -1902,11 +1902,9 @@ void Main::on_send_clicked()
ethereum()->transact(s, value(), m_data, ui->gas->value(), gasPrice()); ethereum()->transact(s, value(), m_data, ui->gas->value(), gasPrice());
string src = ui->data->toPlainText().toStdString(); string src = ui->data->toPlainText().toStdString();
if (sourceIsSolidity(src)) if (sourceIsSolidity(src))
{
dev::solidity::CompilerStack compiler;
try try
{ {
dev::solidity::CompilerStack compiler;
m_data = compiler.compile(src, m_enableOptimizer); m_data = compiler.compile(src, m_enableOptimizer);
for (std::string& s: compiler.getContractNames()) for (std::string& s: compiler.getContractNames())
{ {
@ -1919,7 +1917,6 @@ void Main::on_send_clicked()
{ {
statusBar()->showMessage("Couldn't compile Solidity Contract."); statusBar()->showMessage("Couldn't compile Solidity Contract.");
} }
}
} }
else else
ethereum()->transact(s, value(), fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice()); ethereum()->transact(s, value(), fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice());

7
alethzero/NatspecHandler.cpp

@ -20,16 +20,15 @@
* @date 2015 * @date 2015
*/ */
#include "NatspecHandler.h" #include "NatspecHandler.h"
#include <boost/filesystem.hpp>
#include <string> #include <string>
#include <boost/filesystem.hpp>
#include <libethereum/Defaults.h>
#include <libdevcore/Common.h> #include <libdevcore/Common.h>
#include <libdevcore/CommonData.h> #include <libdevcore/CommonData.h>
#include <libdevcore/Exceptions.h> #include <libdevcore/Exceptions.h>
#include <libdevcore/Log.h> #include <libdevcore/Log.h>
#include <libdevcrypto/SHA3.h> #include <libdevcrypto/SHA3.h>
#include <libethereum/Defaults.h>
using namespace dev; using namespace dev;
using namespace dev::eth; using namespace dev::eth;
@ -93,7 +92,7 @@ string NatspecHandler::getUserNotice(string const& json, dev::bytes const& _tran
} }
// not found // not found
return ""; return string();
} }
string NatspecHandler::getUserNotice(dev::h256 const& _contractHash, dev::bytes const& _transactionData) string NatspecHandler::getUserNotice(dev::h256 const& _contractHash, dev::bytes const& _transactionData)

Loading…
Cancel
Save