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

Method UInt

framework/config/map.go:427–444  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

425// See Custom function for details about inheritGlobal, required and
426// defaultVal.
427func (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.

Callers

nothing calls this directly

Calls 2

CustomMethod · 0.95
NodeErrFunction · 0.70

Tested by

no test coverage detected