Int32 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 int32, store *int32)
| 451 | // See Custom function for details about inheritGlobal, required and |
| 452 | // defaultVal. |
| 453 | func (m *Map) Int32(name string, inheritGlobal, required bool, defaultVal int32, store *int32) { |
| 454 | m.Custom(name, inheritGlobal, required, func() (interface{}, error) { |
| 455 | return defaultVal, nil |
| 456 | }, func(_ *Map, node Node) (interface{}, error) { |
| 457 | if len(node.Args) != 1 { |
| 458 | return nil, NodeErr(node, "expected 1 argument") |
| 459 | } |
| 460 | if len(node.Children) != 0 { |
| 461 | return nil, NodeErr(node, "can't declare block here") |
| 462 | } |
| 463 | |
| 464 | i, err := strconv.ParseInt(node.Args[0], 10, 32) |
| 465 | if err != nil { |
| 466 | return nil, NodeErr(node, "invalid integer: %s", node.Args[0]) |
| 467 | } |
| 468 | return int32(i), nil |
| 469 | }, store) |
| 470 | } |
| 471 | |
| 472 | // UInt32 maps configuration directive with the specified name to variable |
| 473 | // referenced by 'store' pointer. |