UInt maps configuration directive with the specified name to variable referenced by 'store' pointer. Configuration directive must be in form 'name 123'. See Custom function for details about inheritGlobal, required and defaultVal.
(name string, inheritGlobal, required bool, defaultVal uint, store *uint)
| 425 | // See Custom function for details about inheritGlobal, required and |
| 426 | // defaultVal. |
| 427 | func (m *Map) UInt(name string, inheritGlobal, required bool, defaultVal uint, store *uint) { |
| 428 | m.Custom(name, inheritGlobal, required, func() (interface{}, error) { |
| 429 | return defaultVal, nil |
| 430 | }, func(_ *Map, node Node) (interface{}, error) { |
| 431 | if len(node.Args) != 1 { |
| 432 | return nil, NodeErr(node, "expected 1 argument") |
| 433 | } |
| 434 | if len(node.Children) != 0 { |
| 435 | return nil, NodeErr(node, "can't declare block here") |
| 436 | } |
| 437 | |
| 438 | i, err := strconv.ParseUint(node.Args[0], 10, 32) |
| 439 | if err != nil { |
| 440 | return nil, NodeErr(node, "invalid integer: %s", node.Args[0]) |
| 441 | } |
| 442 | return uint(i), nil |
| 443 | }, store) |
| 444 | } |
| 445 | |
| 446 | // Int32 maps configuration directive with the specified name to variable |
| 447 | // referenced by 'store' pointer. |