request

Requests data with the possibility of adding restrictions. User input is stripped of the line terminator before processing is attempted.

bool
request
(
dataT
restrictionCheckerT
)
(
string requestMsg
,,
restrictionCheckerT restriction =  (
dataT foo
)
)
if (
staticIndexOf!(dataT, requestSupportedTypes) != -1 &&
isCallable!restrictionCheckerT
&&
Parameters!restrictionCheckerT.length == 1
&&
is(Parameters!restrictionCheckerT[0] : dataT)
&&
is(ReturnType!restrictionCheckerT == bool)
)
in { assert (requestMsg !is null); assert (dataDestination !is null); assert (restriction !is null); }

Parameters

dataDestination
Type: dataT*

pointer where the input data is to be stored, if the input can be converted and satifsties restriction.

restriction
Type: restrictionCheckerT

a callable item that takes a single dataT argument and returns whether it is valid or not. Use it to add additional restrictions onto the data being requested.

Return Value

Type: bool

whether or not the input data is valid. If false, no writing has been performed into dataDestination.

Meta