12.8.2 Class constructors of mbfl_invalid_ctor_parm_value_condition

Constructor on mbfl_invalid_ctor_parm_value_condition_t: mbfl_invalid_ctor_parm_value_condition_make CND WHO CLASS PARM_NAME INVALID_VALUE

Define an object previously declared with mbfl_default_object_declare or similar. The condition is non–continuable by default.

who of mbfl_exceptional_condition for the semantics of the parameter CONTINUABLE.

continuable of mbfl_exceptional_condition for the semantics of the parameter CONTINUABLE.

class of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter CLASS.

parm_name of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter PARM_NAME.

invalid_value of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter INVALID_VALUE.

Let’s say we have this class definition:

mbfl_default_class_declare(COLOUR)

mbfl_default_class_define _(COLOUR) _(mbfl_default_object) 'colour' red green blue

we want the constructor’s parameters to be integers; we can define a maker as follows:

function colour_make () {
    mbfl_mandatory_nameref_parameter(OBJ,       1, colour object)
    mbfl_mandatory_parameter(RED,               2, red)
    mbfl_mandatory_parameter(GREEN,             3, green)
    mbfl_mandatory_parameter(BLUE,              3, blue)

    if ! mbfl_string_is_digit "$RED"
    then
        mbfl_default_object_declare(CND)

        mbfl_invalid_ctor_parm_value_condition_make _(CND) $FUNCNAME _(OBJ) 'red' "$RED"
        mbfl_exception_raise _(CND)
    fi

    if ! mbfl_string_is_digit "$GREEN"
    then
        mbfl_default_object_declare(CND)

        dotest-debug  _(CND) $FUNCNAME _(OBJ) 'green' "$GREEN"
        mbfl_invalid_ctor_parm_value_condition_make _(CND) $FUNCNAME _(OBJ) 'green' "$GREEN"
        mbfl_exception_raise _(CND)
    fi

    if ! mbfl_string_is_digit "$BLUE"
    then
        mbfl_default_object_declare(CND)

        mbfl_invalid_ctor_parm_value_condition_make _(CND) $FUNCNAME _(OBJ) 'blue' "$BLUE"
        mbfl_exception_raise _(CND)
    fi

    colour_define _(OBJ) "$RED" "$GREEN" "$BLUE"
}
Constructor on mbfl_invalid_ctor_parm_value_condition_t: mbfl_invalid_ctor_parm_value_condition_define CND WHO CONTINUABLE CLASS PARM_NAME INVALID_VALUE

Define an object previously declared with mbfl_default_object_declare or similar. This is a low–level constructor that should not be used only to define high–level constructors.

who of mbfl_exceptional_condition for the semantics of the parameter CONTINUABLE.

continuable of mbfl_exceptional_condition for the semantics of the parameter CONTINUABLE.

class of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter CLASS.

parm_name of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter PARM_NAME.

invalid_value of mbfl_invalid_ctor_parm_value_condition for the semantics of the parameter INVALID_VALUE.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.