json.http and crow modified to compile with latest gcc

master
moneroexamples 8 years ago
parent 0b350a027d
commit fd14259c1f

@ -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 <typename Func, size_t ... Indices>
#else
template <typename Func, unsigned ... Indices>
#endif
std::function<void(const request&, response&, const routing_params&)>
wrap(Func f, black_magic::seq<Indices...>)
{
#ifdef CROW_MSVC_WORKAROUND
using function_t = utility::function_traits<decltype(&Func::operator())>;
#else
using function_t = utility::function_traits<Func>;
#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<Indices>...>::value))
{
throw std::runtime_error("route_dynamic: Handler type is mismatched with URL parameters: " + rule_);
}
auto ret = detail::routing_handler_call_helper::Wrapped<Func, typename function_t::template arg<Indices>...>();
ret.template set<
typename function_t::template arg<Indices>...
>(std::move(f));
return ret;
}
//#ifdef CROW_MSVC_WORKAROUND
// template <typename Func, size_t ... Indices>
//#else
// template <typename Func, unsigned ... Indices>
//#endif
// std::function<void(const request&, response&, const routing_params&)>
// wrap(Func f, black_magic::seq<Indices...>)
// {
//#ifdef CROW_MSVC_WORKAROUND
// using function_t = utility::function_traits<decltype(&Func::operator())>;
//#else
// using function_t = utility::function_traits<Func>;
//#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<Indices>...>::value))
// {
// throw std::runtime_error("route_dynamic: Handler type is mismatched with URL parameters: " + rule_);
// }
// auto ret = detail::routing_handler_call_helper::Wrapped<Func, typename function_t::template arg<Indices>...>();
// ret.template set<
// typename function_t::template arg<Indices>...
// >(std::move(f));
// return ret;
// }
template <typename Func>
void operator()(std::string name, Func&& f)

@ -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;

@ -1,36 +0,0 @@
#ifndef MEMBER_CHECKER_H
#define MEMBER_CHECKER_H
#define DEFINE_MEMBER_CHECKER(member) \
template<typename T, typename V = bool> \
struct has_ ## member : false_type { }; \
\
template<typename T> \
struct has_ ## member<T, \
typename enable_if< \
!is_same<decltype(declval<T>().member), void>::value, \
bool \
>::type \
> : true_type { };
#define HAS_MEMBER(C, member) \
has_ ## member<C>::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 T> \
typename enable_if<HAS_MEMBER(T, member), ret_value>::type \
get_ ## member (T t){ \
return t.member; \
} \
\
template<typename T> \
typename enable_if<!HAS_MEMBER(T, member), ret_value>::type \
get_ ## member (T t){ \
return ret_value(); \
}
#endif // MEMBER_CHECKER_H

@ -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;

@ -29,6 +29,7 @@
#include <algorithm>
#include <limits>
#include <ctime>
#include <future>
#define TMPL_DIR "./templates"
#define TMPL_PARIALS_DIR TMPL_DIR "/partials"

@ -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,

@ -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 <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
//#include <boost/date_time/posix_time/posix_time.hpp>
#include <string>
#include <vector>
//#include <array>
#include <iterator>
#include <algorithm>
/**
* 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,

Loading…
Cancel
Save