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

Method Int32

framework/config/map.go:453–470  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

451// See Custom function for details about inheritGlobal, required and
452// defaultVal.
453func (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.

Callers

nothing calls this directly

Calls 2

CustomMethod · 0.95
NodeErrFunction · 0.70

Tested by

no test coverage detected