From fd14259c1fbed0b44dc90f9a74fc02d2681591ba Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sun, 4 Jun 2017 10:40:14 +0800 Subject: [PATCH] json.http and crow modified to compile with latest gcc --- ext/crow/routing.h | 52 ++++++++++++++++++++++---------------------- ext/json.hpp | 8 +++---- ext/member_checker.h | 36 ------------------------------ main.cpp | 6 ++--- src/page.h | 1 + src/tools.cpp | 10 --------- src/tools.h | 14 ++---------- 7 files changed, 36 insertions(+), 91 deletions(-) delete mode 100644 ext/member_checker.h diff --git a/ext/crow/routing.h b/ext/crow/routing.h index 4fc2de8..52ff77b 100755 --- a/ext/crow/routing.h +++ b/ext/crow/routing.h @@ -389,32 +389,32 @@ namespace crow // enable_if Arg1 == request && Arg2 == response // enable_if Arg1 == request && Arg2 != resposne // enable_if Arg1 != request -#ifdef CROW_MSVC_WORKAROUND - template -#else - template -#endif - std::function - wrap(Func f, black_magic::seq) - { -#ifdef CROW_MSVC_WORKAROUND - using function_t = utility::function_traits; -#else - using function_t = utility::function_traits; -#endif - if (!black_magic::is_parameter_tag_compatible( - black_magic::get_parameter_tag_runtime(rule_.c_str()), - black_magic::compute_parameter_tag_from_args_list< - typename function_t::template arg...>::value)) - { - throw std::runtime_error("route_dynamic: Handler type is mismatched with URL parameters: " + rule_); - } - auto ret = detail::routing_handler_call_helper::Wrapped...>(); - ret.template set< - typename function_t::template arg... - >(std::move(f)); - return ret; - } +//#ifdef CROW_MSVC_WORKAROUND +// template +//#else +// template +//#endif +// std::function +// wrap(Func f, black_magic::seq) +// { +//#ifdef CROW_MSVC_WORKAROUND +// using function_t = utility::function_traits; +//#else +// using function_t = utility::function_traits; +//#endif +// if (!black_magic::is_parameter_tag_compatible( +// black_magic::get_parameter_tag_runtime(rule_.c_str()), +// black_magic::compute_parameter_tag_from_args_list< +// typename function_t::template arg...>::value)) +// { +// throw std::runtime_error("route_dynamic: Handler type is mismatched with URL parameters: " + rule_); +// } +// auto ret = detail::routing_handler_call_helper::Wrapped...>(); +// ret.template set< +// typename function_t::template arg... +// >(std::move(f)); +// return ret; +// } template void operator()(std::string name, Func&& f) diff --git a/ext/json.hpp b/ext/json.hpp index 9c27fb0..bc682e8 100644 --- a/ext/json.hpp +++ b/ext/json.hpp @@ -6379,10 +6379,10 @@ class basic_json { switch (lhs_type) { - case value_t::array: - { - return *lhs.m_value.array < *rhs.m_value.array; - } +// case value_t::array: +// { +// return *lhs.m_value.array < *rhs.m_value.array; +// } case value_t::object: { return *lhs.m_value.object < *rhs.m_value.object; diff --git a/ext/member_checker.h b/ext/member_checker.h deleted file mode 100644 index 6c46967..0000000 --- a/ext/member_checker.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef MEMBER_CHECKER_H -#define MEMBER_CHECKER_H - - -#define DEFINE_MEMBER_CHECKER(member) \ - template \ - struct has_ ## member : false_type { }; \ - \ - template \ - struct has_ ## member().member), void>::value, \ - bool \ - >::type \ - > : true_type { }; - -#define HAS_MEMBER(C, member) \ - has_ ## member::value - - -// first getter if the member veriable is present, so we return its value -// second getter, when the member is not present, so we return empty value, e.g., empty string -#define DEFINE_MEMBER_GETTER(member, ret_value) \ - template \ - typename enable_if::type \ - get_ ## member (T t){ \ - return t.member; \ - } \ - \ - template \ - typename enable_if::type \ - get_ ## member (T t){ \ - return ret_value(); \ - } - -#endif // MEMBER_CHECKER_H diff --git a/main.cpp b/main.cpp index fa3279b..211d017 100644 --- a/main.cpp +++ b/main.cpp @@ -604,10 +604,10 @@ main(int ac, const char* av[]) cout << "Waiting for mempool monitoring thread to finish." << endl; - xmerg::MempoolStatus::m_thread.interrupt(); - xmerg::MempoolStatus::m_thread.join(); + xmreg::MempoolStatus::m_thread.interrupt(); + xmreg::MempoolStatus::m_thread.join(); - cout << "Mmempool monitoring thread finished." << endl; + cout << "Mempool monitoring thread finished." << endl; cout << "The explorer is terminating." << endl; diff --git a/src/page.h b/src/page.h index 7b47995..6bfe2b3 100644 --- a/src/page.h +++ b/src/page.h @@ -29,6 +29,7 @@ #include #include #include +#include #define TMPL_DIR "./templates" #define TMPL_PARIALS_DIR TMPL_DIR "/partials" diff --git a/src/tools.cpp b/src/tools.cpp index 70e58dd..992ce75 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -893,16 +893,6 @@ namespace xmreg return make_pair(empty_time, scale); } -// useful reference to get epoch time in correct timezon -// http://www.boost.org/doc/libs/1_41_0/doc/html/date_time/examples.html#date_time.examples.seconds_since_epoch - time_t - ptime_to_time_t(const pt::ptime& in_ptime) - { - static pt::ptime epoch(gt::date(1970, 1, 1)); - pt::time_duration::sec_type no_seconds = (in_ptime - epoch).total_seconds(); - return time_t(no_seconds); - } - bool decode_ringct(const rct::rctSig& rv, const crypto::public_key pub, diff --git a/src/tools.h b/src/tools.h index ba63050..daed30b 100644 --- a/src/tools.h +++ b/src/tools.h @@ -13,29 +13,26 @@ #define REMOVE_HASH_BRAKETS(a_hash) \ a_hash.substr(1, a_hash.size()-2) -#include "../ext/json.hpp" + #include "monero_headers.h" #include "../ext/fmt/ostream.h" #include "../ext/fmt/format.h" - +#include "../ext/json.hpp" #include #include #include -//#include #include #include -//#include #include #include - /** * Some helper functions used in the example. * Names are rather self-explanatory, so I think @@ -49,9 +46,6 @@ namespace xmreg using namespace std; namespace bf = boost::filesystem; - namespace pt = boost::posix_time; - namespace gt = boost::gregorian; - namespace lt = boost::local_time; using json = nlohmann::json; @@ -225,10 +219,6 @@ namespace xmreg uint64_t timeN, uint64_t resolution = 80, uint64_t time0 = 1397818193 /* timestamp of the second block */); - - time_t - ptime_to_time_t(const pt::ptime& in_ptime); - bool decode_ringct(const rct::rctSig & rv, const crypto::public_key pub,