Commit e6da20c4dc5c59b7da6393e52d1f5086048061c9
1 parent
eb2fde09
add support of the float in get web argument
Showing
1 changed file
with
29 additions
and
0 deletions
Show diff stats
web/CXM_web_arg_utils.anubis
| ... | ... | @@ -217,6 +217,35 @@ public define List(Int) |
| 217 | 217 | } |
| 218 | 218 | . |
| 219 | 219 | |
| 220 | +public define Maybe(Float) | |
| 221 | + get_Float | |
| 222 | + ( | |
| 223 | + List(Web_arg) lwa, | |
| 224 | + String name | |
| 225 | + ) = | |
| 226 | + if web_arg_value(lwa, name) is | |
| 227 | + { | |
| 228 | + not_found then /*logDebug(debug_log, "Can't find argument '" + name + "'");*/ failure | |
| 229 | + found(str) then | |
| 230 | + if str = "" then | |
| 231 | + failure | |
| 232 | + else | |
| 233 | + string_to_float(str) | |
| 234 | + }. | |
| 235 | + | |
| 236 | +public define Float | |
| 237 | + get_Float | |
| 238 | + ( | |
| 239 | + List(Web_arg) lwa, | |
| 240 | + String name, | |
| 241 | + Float default_value | |
| 242 | + ) = | |
| 243 | + if get_Float(lwa, name) is | |
| 244 | + { | |
| 245 | + failure then default_value, | |
| 246 | + success(value) then value | |
| 247 | + }. | |
| 248 | + | |
| 220 | 249 | public define Maybe(Word32) |
| 221 | 250 | get_Word32 |
| 222 | 251 | ( | ... | ... |