cmdr
Check-in [c843b9c1dd]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Extended the set of common validation types, added "double". Bumped cmdr::validate to 1.2
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c843b9c1ddf3c49bd4e89aa396f85e5f80418332
User & Date: andreask 2014-02-12 23:29:08.021
Original Comment: Extended set of common validation types, added "double". Bumped cmdr::validate to 1.2
Context
2014-02-13
05:39
Extended the set of common validation types, added "percent" (double limited to [0,100]). Updated documentation. check-in: 49d0a10137 user: aku tags: trunk
2014-02-12
23:29
Extended the set of common validation types, added "double". Bumped cmdr::validate to 1.2 check-in: c843b9c1dd user: andreask tags: trunk
2014-02-07
20:39
Rename "_find" to "internal_find" instead of diddling with export. check-in: a2da845671 user: andreask tags: cmdr-1-1, release, release-1-1, trunk, v1.1
Changes
Unified Diff Ignore Whitespace Patch
Changes to validate.tcl.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

namespace eval ::cmdr {
    namespace export validate
    namespace ensemble create
}

namespace eval ::cmdr::validate {
    namespace export boolean integer identity pass str \
	rfile rwfile rdirectory rwdirectory rpath rwpath
    #namespace ensemble create

    # For external v-types relying on them here.
    namespace import ::cmdr::validate::common::fail
    namespace import ::cmdr::validate::common::complete-enum
}







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

namespace eval ::cmdr {
    namespace export validate
    namespace ensemble create
}

namespace eval ::cmdr::validate {
    namespace export boolean integer double identity pass str \
	rfile rwfile rdirectory rwdirectory rpath rwpath
    #namespace ensemble create

    # For external v-types relying on them here.
    namespace import ::cmdr::validate::common::fail
    namespace import ::cmdr::validate::common::complete-enum
}
95
96
97
98
99
100
101
























102
103
104
105
106
107
108
    return {}
}
proc ::cmdr::validate::integer::validate {p x} {
    debug.cmdr/validate {}
    if {[string is integer -strict $x]} { return $x }
    fail $p INTEGER "an integer" $x
}

























# # ## ### ##### ######## ############# #####################
## Any string

namespace eval ::cmdr::validate::identity {
    namespace export default validate complete release
    namespace ensemble create







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    return {}
}
proc ::cmdr::validate::integer::validate {p x} {
    debug.cmdr/validate {}
    if {[string is integer -strict $x]} { return $x }
    fail $p INTEGER "an integer" $x
}

# # ## ### ##### ######## ############# #####################
## Any float

namespace eval ::cmdr::validate::double {
    namespace export default validate complete release
    namespace ensemble create
    namespace import ::cmdr::validate::common::fail
}

proc ::cmdr::validate::double::release  {p x} { return }
proc ::cmdr::validate::double::default  {p}  {
    debug.cmdr/validate {}
    return 0
}
proc ::cmdr::validate::double::complete {p x} {
    debug.cmdr/validate {} 10
    return {}
}
proc ::cmdr::validate::double::validate {p x} {
    debug.cmdr/validate {}
    if {[string is double -strict $x]} { return $x }
    fail $p DOUBLE "a double" $x
}

# # ## ### ##### ######## ############# #####################
## Any string

namespace eval ::cmdr::validate::identity {
    namespace export default validate complete release
    namespace ensemble create
317
318
319
320
321
322
323
324
325
    if {![file readable    $path]} {return 0}
    if {![file writable    $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 1.1
return







|

341
342
343
344
345
346
347
348
349
    if {![file readable    $path]} {return 0}
    if {![file writable    $path]} {return 0}
    return 1
}

# # ## ### ##### ######## ############# #####################
## Ready
package provide cmdr::validate 1.2
return