diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-12-19 16:50:15 -0500 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2015-01-02 15:12:03 -0500 |
commit | 856e862f4a736fbdc38daae3b7f0fa34e1da317c (patch) | |
tree | 2095eef431d539acfef432321aa82fa6062219fa /src | |
parent | 9b1ab860ff00180142d9e514f3e1b6a91c86df7a (diff) |
namespace: drop most boost namespaces and a few header cleanups
A few boost::asio were left around because they're very wordy otherwise.
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoin-tx.cpp | 3 | ||||
-rw-r--r-- | src/chainparams.cpp | 21 | ||||
-rw-r--r-- | src/chainparamsbase.cpp | 4 | ||||
-rw-r--r-- | src/core_read.cpp | 13 | ||||
-rw-r--r-- | src/rpcmisc.cpp | 1 | ||||
-rw-r--r-- | src/rpcprotocol.cpp | 1 | ||||
-rw-r--r-- | src/rpcrawtransaction.cpp | 17 | ||||
-rw-r--r-- | src/rpcwallet.cpp | 7 | ||||
-rw-r--r-- | src/test/bloom_tests.cpp | 1 | ||||
-rw-r--r-- | src/test/script_tests.cpp | 7 | ||||
-rw-r--r-- | src/test/transaction_tests.cpp | 3 |
11 files changed, 29 insertions, 49 deletions
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 05a85810ec..ead652a729 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -22,7 +22,6 @@ #include <boost/algorithm/string.hpp> #include <boost/assign/list_of.hpp> -using namespace boost::assign; using namespace std; static bool fCreateBlank; @@ -375,7 +374,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr) if (!prevOut.isObject()) throw runtime_error("expected prevtxs internal object"); - map<string,UniValue::VType> types = map_list_of("txid", UniValue::VSTR)("vout",UniValue::VNUM)("scriptPubKey",UniValue::VSTR); + map<string,UniValue::VType> types = boost::assign::map_list_of("txid", UniValue::VSTR)("vout",UniValue::VNUM)("scriptPubKey",UniValue::VSTR); if (!prevOut.checkObject(types)) throw runtime_error("prevtxs internal object typecheck fail"); diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f4bc6e1d70..00c2367a6b 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -14,7 +14,6 @@ #include <boost/assign/list_of.hpp> using namespace std; -using namespace boost::assign; struct SeedSpec6 { uint8_t addr[16]; @@ -158,11 +157,11 @@ public: vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com")); vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); - base58Prefixes[PUBKEY_ADDRESS] = list_of(0); - base58Prefixes[SCRIPT_ADDRESS] = list_of(5); - base58Prefixes[SECRET_KEY] = list_of(128); - base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E); - base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4); + base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(0); + base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(5); + base58Prefixes[SECRET_KEY] = boost::assign::list_of(128); + base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E); + base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4); convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main)); @@ -217,11 +216,11 @@ public: vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me")); vSeeds.push_back(CDNSSeedData("bitcoin.schildbach.de", "testnet-seed.bitcoin.schildbach.de")); - base58Prefixes[PUBKEY_ADDRESS] = list_of(111); - base58Prefixes[SCRIPT_ADDRESS] = list_of(196); - base58Prefixes[SECRET_KEY] = list_of(239); - base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF); - base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94); + base58Prefixes[PUBKEY_ADDRESS] = boost::assign::list_of(111); + base58Prefixes[SCRIPT_ADDRESS] = boost::assign::list_of(196); + base58Prefixes[SECRET_KEY] = boost::assign::list_of(239); + base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF); + base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94); convertSeed6(vFixedSeeds, pnSeed6_test, ARRAYLEN(pnSeed6_test)); diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index e45536ce71..09fd0df877 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -9,10 +9,6 @@ #include <assert.h> -#include <boost/assign/list_of.hpp> - -using namespace boost::assign; - /** * Main network */ diff --git a/src/core_read.cpp b/src/core_read.cpp index 85b60e9adb..e064955ff0 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -20,7 +20,6 @@ #include <boost/algorithm/string/split.hpp> #include <boost/assign/list_of.hpp> -using namespace boost::algorithm; using namespace std; CScript ParseScript(std::string s) @@ -43,13 +42,13 @@ CScript ParseScript(std::string s) string strName(name); mapOpNames[strName] = (opcodetype)op; // Convenience: OP_ADD and just ADD are both recognized: - replace_first(strName, "OP_", ""); + boost::algorithm::replace_first(strName, "OP_", ""); mapOpNames[strName] = (opcodetype)op; } } vector<string> words; - split(words, s, is_any_of(" \t\n"), token_compress_on); + boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), boost::algorithm::token_compress_on); for (std::vector<std::string>::const_iterator w = words.begin(); w != words.end(); ++w) { @@ -57,20 +56,20 @@ CScript ParseScript(std::string s) { // Empty string, ignore. (boost::split given '' will return one word) } - else if (all(*w, is_digit()) || - (starts_with(*w, "-") && all(string(w->begin()+1, w->end()), is_digit()))) + else if (all(*w, boost::algorithm::is_digit()) || + (boost::algorithm::starts_with(*w, "-") && all(string(w->begin()+1, w->end()), boost::algorithm::is_digit()))) { // Number int64_t n = atoi64(*w); result << n; } - else if (starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(string(w->begin()+2, w->end()))) + else if (boost::algorithm::starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(string(w->begin()+2, w->end()))) { // Raw hex data, inserted NOT pushed onto stack: std::vector<unsigned char> raw = ParseHex(string(w->begin()+2, w->end())); result.insert(result.end(), raw.begin(), raw.end()); } - else if (w->size() >= 2 && starts_with(*w, "'") && ends_with(*w, "'")) + else if (w->size() >= 2 && boost::algorithm::starts_with(*w, "'") && boost::algorithm::ends_with(*w, "'")) { // Single-quoted string, pushed as data. NOTE: this is poor-man's // parsing, spaces/tabs/newlines in single-quoted strings won't work. diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 1013418184..184aacf5a8 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -23,7 +23,6 @@ #include "json/json_spirit_utils.h" #include "json/json_spirit_value.h" -using namespace boost::assign; using namespace json_spirit; using namespace std; diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index b08598d0bf..95d6b9e531 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -26,7 +26,6 @@ #include "json/json_spirit_writer_template.h" using namespace std; -using namespace boost::asio; using namespace json_spirit; //! Number of bytes to allocate and read at most at once in post data diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 35319e4803..5981134af3 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -25,7 +25,6 @@ #include "json/json_spirit_utils.h" #include "json/json_spirit_value.h" -using namespace boost::assign; using namespace json_spirit; using namespace std; @@ -231,7 +230,7 @@ Value listunspent(const Array& params, bool fHelp) + HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"") ); - RPCTypeCheck(params, list_of(int_type)(int_type)(array_type)); + RPCTypeCheck(params, boost::assign::list_of(int_type)(int_type)(array_type)); int nMinDepth = 1; if (params.size() > 0) @@ -335,7 +334,7 @@ Value createrawtransaction(const Array& params, bool fHelp) + HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"") ); - RPCTypeCheck(params, list_of(array_type)(obj_type)); + RPCTypeCheck(params, boost::assign::list_of(array_type)(obj_type)); Array inputs = params[0].get_array(); Object sendTo = params[1].get_obj(); @@ -429,7 +428,7 @@ Value decoderawtransaction(const Array& params, bool fHelp) + HelpExampleRpc("decoderawtransaction", "\"hexstring\"") ); - RPCTypeCheck(params, list_of(str_type)); + RPCTypeCheck(params, boost::assign::list_of(str_type)); CTransaction tx; @@ -467,7 +466,7 @@ Value decodescript(const Array& params, bool fHelp) + HelpExampleRpc("decodescript", "\"hexstring\"") ); - RPCTypeCheck(params, list_of(str_type)); + RPCTypeCheck(params, boost::assign::list_of(str_type)); Object r; CScript script; @@ -533,7 +532,7 @@ Value signrawtransaction(const Array& params, bool fHelp) + HelpExampleRpc("signrawtransaction", "\"myhex\"") ); - RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true); + RPCTypeCheck(params, boost::assign::list_of(str_type)(array_type)(array_type)(str_type), true); vector<unsigned char> txData(ParseHexV(params[0], "argument 1")); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); @@ -605,7 +604,7 @@ Value signrawtransaction(const Array& params, bool fHelp) Object prevOut = p.get_obj(); - RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)); + RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)); uint256 txid = ParseHashO(prevOut, "txid"); @@ -633,7 +632,7 @@ Value signrawtransaction(const Array& params, bool fHelp) // if redeemScript given and not using the local wallet (private keys // given), add redeemScript to the tempKeystore so it can be signed: if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) { - RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type)); + RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type)); Value v = find_value(prevOut, "redeemScript"); if (!(v == Value::null)) { vector<unsigned char> rsData(ParseHexV(v, "redeemScript")); @@ -723,7 +722,7 @@ Value sendrawtransaction(const Array& params, bool fHelp) + HelpExampleRpc("sendrawtransaction", "\"signedhex\"") ); - RPCTypeCheck(params, list_of(str_type)(bool_type)); + RPCTypeCheck(params, boost::assign::list_of(str_type)(bool_type)); // parse hex string from parameter CTransaction tx; diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index a6b38ead62..9d51ff20dd 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -23,7 +23,6 @@ #include "json/json_spirit_value.h" using namespace std; -using namespace boost::assign; using namespace json_spirit; int64_t nWalletUnlockTime; @@ -1872,9 +1871,9 @@ Value lockunspent(const Array& params, bool fHelp) ); if (params.size() == 1) - RPCTypeCheck(params, list_of(bool_type)); + RPCTypeCheck(params, boost::assign::list_of(bool_type)); else - RPCTypeCheck(params, list_of(bool_type)(array_type)); + RPCTypeCheck(params, boost::assign::list_of(bool_type)(array_type)); bool fUnlock = params[0].get_bool(); @@ -1891,7 +1890,7 @@ Value lockunspent(const Array& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object"); const Object& o = output.get_obj(); - RPCTypeCheck(o, map_list_of("txid", str_type)("vout", int_type)); + RPCTypeCheck(o, boost::assign::map_list_of("txid", str_type)("vout", int_type)); string txid = find_value(o, "txid").get_str(); if (!IsHex(txid)) diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index c32098efa0..98a2cbc92f 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -20,7 +20,6 @@ #include <boost/tuple/tuple.hpp> using namespace std; -using namespace boost::tuples; BOOST_AUTO_TEST_SUITE(bloom_tests) diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 4d2a9aff45..a5c6a21f4b 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -23,12 +23,6 @@ #include <string> #include <vector> -#include <boost/algorithm/string/classification.hpp> -#include <boost/algorithm/string/predicate.hpp> -#include <boost/algorithm/string/replace.hpp> -#include <boost/algorithm/string/split.hpp> -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/path.hpp> #include <boost/foreach.hpp> #include <boost/test/unit_test.hpp> #include "json/json_spirit_reader_template.h" @@ -37,7 +31,6 @@ using namespace std; using namespace json_spirit; -using namespace boost::algorithm; // Uncomment if you want to output updated JSON tests. // #define UPDATE_JSON_TESTS diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 2594f89ac3..48386994af 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -24,7 +24,6 @@ using namespace std; using namespace json_spirit; -using namespace boost::algorithm; // In script_tests.cpp extern Array read_json(const std::string& jsondata); @@ -47,7 +46,7 @@ unsigned int ParseScriptFlags(string strFlags) } unsigned int flags = 0; vector<string> words; - split(words, strFlags, is_any_of(",")); + boost::algorithm::split(words, strFlags, boost::algorithm::is_any_of(",")); BOOST_FOREACH(string word, words) { |