aboutsummaryrefslogtreecommitdiffstats
path: root/amalgamate
diff options
context:
space:
mode:
authoripkn <ipknhama@gmail.com>2014-11-12 09:23:21 +0900
committeripkn <ipknhama@gmail.com>2014-11-12 09:23:21 +0900
commit21b027774e4c472d27d8726774aad1aaed95ea42 (patch)
tree07187af58764de4f50fc31cc834a064736b76345 /amalgamate
parent79e8fa19f603fc5d408370a3579ab5a67aa87bbc (diff)
parent5120b127b0c167e11c9f7c8495b5b407aea32d76 (diff)
downloadcrow-21b027774e4c472d27d8726774aad1aaed95ea42.tar.gz
crow-21b027774e4c472d27d8726774aad1aaed95ea42.zip
Merge pull request #38 from acron0/json-bool
Added boolean types to json rvalue (.b()) including test
Diffstat (limited to 'amalgamate')
-rw-r--r--amalgamate/crow_all.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index b84a43e..a2f9cc0 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -628,6 +628,15 @@ namespace crow
return boost::lexical_cast<double>(start_, end_-start_);
}
+ bool b() const
+ {
+#ifndef CROW_JSON_NO_ERROR_CHECK
+ if (t() != type::True && t() != type::False)
+ throw std::runtime_error("value is not boolean");
+#endif
+ return t() == type::True;
+ }
+
void unescape() const
{
if (*(start_-1))