MCPcopy Index your code
hub / github.com/foxcpp/maddy / UInt32

Method UInt32

framework/config/map.go:479–496  ·  view source on GitHub ↗

UInt32 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 uint32, store *uint32)

Source from the content-addressed store, hash-verified

477// See Custom function for details about inheritGlobal, required and
478// defaultVal.
479func (m *Map) UInt32(name string, inheritGlobal, required bool, defaultVal uint32, store *uint32) {
480 m.Custom(name, inheritGlobal, required, func() (interface{}, error) {
481 return defaultVal, nil
482 }, func(_ *Map, node Node) (interface{}, error) {
483 if len(node.Args) != 1 {
484 return nil, NodeErr(node, "expected 1 argument")
485 }
486 if len(node.Children) != 0 {
487 return nil, NodeErr(node, "can't declare block here")
488 }
489
490 i, err := strconv.ParseUint(node.Args[0], 10, 32)
491 if err != nil {
492 return nil, NodeErr(node, "invalid integer: %s", node.Args[0])
493 }
494 return uint32(i), nil
495 }, store)
496}
497
498// Int64 maps configuration directive with the specified name to variable
499// referenced by 'store' pointer.

Callers

nothing calls this directly

Calls 2

CustomMethod · 0.95
NodeErrFunction · 0.70

Tested by

no test coverage detected