12.9.2 Class constructors of mbfl_invalid_object_attrib_value_condition

Constructor on mbfl_invalid_object_attrib_value_condition_t: mbfl_invalid_object_attrib_value_condition_make CND WHO OBJ ATTRIBUTE_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.

object of mbfl_invalid_object_attrib_value_condition for the semantics of the parameter OBJ.

attrib_name of mbfl_invalid_object_attrib_value_condition for the semantics of the parameter ATTRIBUTE_NAME.

invalid_value of mbfl_invalid_object_attrib_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_p' red green blue

we want the field values to be integers; we can define a mutator as follows:

function colour_red_set () {
    mbfl_mandatory_nameref_parameter(OBJ, 1, colour object)
    mbfl_mandatory_parameter(RED, 2, red value)

    if mbfl_string_is_digit "$RED"
    then colour_p_red_set _(OBJ) "$RED"
    else
        mbfl_default_object_declare(CND)

        mbfl_invalid_object_attrib_value_condition_make _(CND) $FUNCNAME _(OBJ) 'red' "$RED"
        mbfl_exception_raise _(CND)
    fi
}
Constructor on mbfl_invalid_object_attrib_value_condition_t: mbfl_invalid_object_attrib_value_condition_define CND WHO CONTINUABLE OBJ ATTRIBUTE_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.

object of mbfl_invalid_object_attrib_value_condition for the semantics of the parameter OBJ.

attrib_name of mbfl_invalid_object_attrib_value_condition for the semantics of the parameter ATTRIBUTE_NAME.

invalid_value of mbfl_invalid_object_attrib_value_condition for the semantics of the parameter INVALID_VALUE.


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