aboutsummaryrefslogtreecommitdiffstats
path: root/amalgamate
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2016-08-27 18:13:13 +0900
committeripknHama <ipknhama@gmail.com>2016-08-27 18:13:13 +0900
commit45f6d12fd382662675000fb1c60909287733127c (patch)
treefce119b20eb3a24f7798cc22cfecea9a5fcc8dca /amalgamate
parentf88b56dff0e8adfbd654d0b39791c2664c863e07 (diff)
downloadcrow-45f6d12fd382662675000fb1c60909287733127c.tar.gz
crow-45f6d12fd382662675000fb1c60909287733127c.zip
Update amalgamate
Diffstat (limited to 'amalgamate')
-rw-r--r--amalgamate/crow_all.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index 8ba89e5..2819578 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -607,6 +607,11 @@ namespace crow
return i();
}
+ explicit operator uint64_t() const
+ {
+ return u();
+ }
+
explicit operator int() const
{
return (int)i();
@@ -639,6 +644,20 @@ namespace crow
return boost::lexical_cast<int64_t>(start_, end_-start_);
}
+ uint64_t u() const
+ {
+#ifndef CROW_JSON_NO_ERROR_CHECK
+ switch (t()) {
+ case type::Number:
+ case type::String:
+ return boost::lexical_cast<uint64_t>(start_, end_-start_);
+ default:
+ throw std::runtime_error(std::string("expected number, got: ") + get_type_str(t()));
+ }
+#endif
+ return boost::lexical_cast<uint64_t>(start_, end_-start_);
+ }
+
double d() const
{
#ifndef CROW_JSON_NO_ERROR_CHECK
@@ -1438,17 +1457,16 @@ namespace crow
s = r.s();
return;
case type::List:
- l = std::move(std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{}));
+ l = std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{});
l->reserve(r.size());
for(auto it = r.begin(); it != r.end(); ++it)
l->emplace_back(*it);
return;
case type::Object:
- o = std::move(
- std::unique_ptr<
+ o = std::unique_ptr<
std::unordered_map<std::string, wvalue>
>(
- new std::unordered_map<std::string, wvalue>{}));
+ new std::unordered_map<std::string, wvalue>{});
for(auto it = r.begin(); it != r.end(); ++it)
o->emplace(it->key(), *it);
return;
@@ -1594,7 +1612,7 @@ namespace crow
reset();
t_ = type::List;
if (!l)
- l = std::move(std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{}));
+ l = std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{});
l->clear();
l->resize(v.size());
size_t idx = 0;
@@ -1611,7 +1629,7 @@ namespace crow
reset();
t_ = type::List;
if (!l)
- l = std::move(std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{}));
+ l = std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{});
if (l->size() < index+1)
l->resize(index+1);
return (*l)[index];
@@ -1632,11 +1650,10 @@ namespace crow
reset();
t_ = type::Object;
if (!o)
- o = std::move(
- std::unique_ptr<
+ o = std::unique_ptr<
std::unordered_map<std::string, wvalue>
>(
- new std::unordered_map<std::string, wvalue>{}));
+ new std::unordered_map<std::string, wvalue>{});
return (*o)[str];
}
@@ -8489,7 +8506,7 @@ namespace crow
#else
template <typename T, typename ... Remain>
- self_t& ssl_file(T&& t, Remain&&...)
+ self_t& ssl_file(T&&, Remain&&...)
{
// We can't call .ssl() member function unless CROW_ENABLE_SSL is defined.
static_assert(
@@ -8500,7 +8517,7 @@ namespace crow
}
template <typename T>
- self_t& ssl(T&& ctx)
+ self_t& ssl(T&&)
{
// We can't call .ssl() member function unless CROW_ENABLE_SSL is defined.
static_assert(