aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-04-15 00:31:51 +0900
committeripknHama <ipknhama@gmail.com>2014-04-15 00:31:51 +0900
commit53debf7e2cb494d8ea89205812bf792e8e9354da (patch)
treec0195ecc0673b794087c99908a2314dfc8a0ff31 /common.h
parent7ec586556e348725bff3919f4787a75d71c520fa (diff)
downloadcrow-53debf7e2cb494d8ea89205812bf792e8e9354da.tar.gz
crow-53debf7e2cb494d8ea89205812bf792e8e9354da.zip
parameter passing done for int
Diffstat (limited to 'common.h')
-rw-r--r--common.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..1699b07
--- /dev/null
+++ b/common.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include <string>
+
+namespace flask
+{
+ enum class ParamType
+ {
+ INVALID,
+
+ INT,
+ UINT,
+ DOUBLE,
+ STRING,
+ PATH,
+
+ MAX
+ };
+
+ struct routing_params
+ {
+ std::vector<int64_t> int_params;
+ std::vector<uint64_t> uint_params;
+ std::vector<double> double_params;
+ std::vector<std::string> string_params;
+
+ template <typename T>
+ T get(unsigned) const;
+
+ };
+
+ template<>
+ int64_t routing_params::get<int64_t>(unsigned index) const
+ {
+ return int_params.at(index);
+ }
+
+ template<>
+ uint64_t routing_params::get<uint64_t>(unsigned index) const
+ {
+ return uint_params.at(index);
+ }
+
+ template<>
+ double routing_params::get<double>(unsigned index) const
+ {
+ return double_params.at(index);
+ }
+
+ template<>
+ std::string routing_params::get<std::string>(unsigned index) const
+ {
+ return string_params.at(index);
+ }
+}