From e6da20c4dc5c59b7da6393e52d1f5086048061c9 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 12 Mar 2017 22:20:58 +0100 Subject: [PATCH] add support of the float in get web argument --- web/CXM_web_arg_utils.anubis | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 0 deletions(-) diff --git a/web/CXM_web_arg_utils.anubis b/web/CXM_web_arg_utils.anubis index 5beaaae..18ed9cb 100644 --- a/web/CXM_web_arg_utils.anubis +++ b/web/CXM_web_arg_utils.anubis @@ -217,6 +217,35 @@ public define List(Int) } . +public define Maybe(Float) + get_Float + ( + List(Web_arg) lwa, + String name + ) = + if web_arg_value(lwa, name) is + { + not_found then /*logDebug(debug_log, "Can't find argument '" + name + "'");*/ failure + found(str) then + if str = "" then + failure + else + string_to_float(str) + }. + +public define Float + get_Float + ( + List(Web_arg) lwa, + String name, + Float default_value + ) = + if get_Float(lwa, name) is + { + failure then default_value, + success(value) then value + }. + public define Maybe(Word32) get_Word32 ( -- libgit2 0.21.4