TABLE OF CONTENTS


::pwtk::checkOTypeStrict_

SYNOPSIS

proc ::pwtk::checkOTypeStrict_ {option value type {typeTxt {}}} {

DESCRIPTION

A strict version of checkOType_, where empty string do not match the type.

type can be: intList, doubleList, type accepted by "string is...."

SOURCE

    if { $typeTxt == {} } {
        set typeTxt $type
    }
    set option -[string trim $option -]

    switch -exact -- [lindex $type 0] {
        number -
        numberlist {
            if { ! [eval ::pwtk::type::$type -strict [list $value]] } {
                uplevel 1 ::pwtk::error [list "expected a $typeTxt for the value of the $option option, but got: \"$value\""] 1
            }
        }
        optionlist {
            set allowedValues [lrange $type 1 end]
            if { ! [::pwtk::type::optionlist $allowedValues -strict $value] } {
                uplevel 1 ::pwtk::error [list "expected one of [join $allowedValues {, }] for the value of the $option option, but got: \"$value\""] 1
            }
        }
        default {
            if { ! [string is $type -strict $value] } {
                uplevel 1 ::pwtk::error [list "expected a $typeTxt for the value of the $option option, but got: \"$value\""] 1
            }
        }
    }
}