|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object
Class is a meta-class that creates new classes.
To make a new class use:
Class YourClass
You can then make instances from that class.
set someInstance [YourClass new ]
To make a new meta-class use:
Class SingletonClass -superclass Class
SingletonClass instproc getInstance { } {
return [ my new ]
}
This can then be used to make new classes with special
properties.
SingletonClass Server
This can then be used to make new instances:
set instance [ Server getInstance ]
| Variables | |||
| Name | Default Value | Class | Comment |
version |
::xotcl::Class | ||
| Methods | |
| Name | Comment |
allinstances {}
| |
classParameter {variable}
| |
classParameterArray {variable}
| |
id {{id ""}}
| |
instfilterappend {f}
| |
instmixinappend {m}
| |
insttclcmd {t}
| |
| Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
| Instproc Detail |
::xotcl::Class instproc allinstances {} {
set set [::xotcl::my info instances]
foreach sc [::xotcl::my info subclass] {
eval lappend set [$sc allinstances]}
return $set
}
variable ::xotcl::Class instproc classParameter {variable} {
my instproc $variable "{ $variable \"\" }" "
if { \"\" == \"\$$variable\" } {
if { ! \[ my exists $variable \] } {
set classList \[ my info class \]
set classList \[ concat \$classList \[ \$classList info heritage \] \]
foreach class \$classList {
if \[ \$class exists $variable \] {
return \[ \$class set $variable \]
}
}
error \"Could not find $variable in any of \$classList!\"
} else {
return \[ my set $variable \]
}
}
if { \"\" == \"\$$variable\" } { return \[ my set $variable \] }
return \[ my set $variable \$$variable \]
"
}
variable ::xotcl::Class instproc classParameterArray {variable} {
my instproc $variable " index { $variable \"\" }" "
if { \"\" == \"\$$variable\" } {
if { ! \[ my exists ${variable}(\$index) \] } {
set classList \[ my info class \]
set classList \[ concat \$classList \[ \$classList info heritage \] \]
foreach class \$classList {
if \[ \$class exists ${variable}(\$index) \] {
return \[ \$class set ${variable}(\$index) \]
}
}
error \"Could not find $variable in any of \$classList!\"
} else {
return \[ my set ${variable}(\$index) \]
}
}
if { \"\" == \"\$$variable\" } { return \[ my set ${variable}(\$index) \] }
return \[ my set ${variable}(\$index) \$$variable \]
"
}
id - optional, default value: "" ::xotcl::Class instproc id {{id ""}} {
if { "$id" == "" } { return [ my set id ] }
my set id $id
my set version [lindex [regexp -inline {Id: \S+ (\S+) } [ my id ] ] 1]
}
f ::xotcl::Class instproc instfilterappend {f} {
set cmd [list [::xotcl::self] instfilter add $f end]
puts stderr "the method [::xotcl::self proc] is deprecated; use instead '$cmd'"
eval $cmd
}
m ::xotcl::Class instproc instmixinappend {m} {
set cmd [list [::xotcl::self] instmixin add $m end]
puts stderr "the method [::xotcl::self proc] is deprecated; use instead '$cmd'"
eval $cmd
}
t ::xotcl::Class instproc insttclcmd {t} {
set cmd [list [::xotcl::self] instforward $t -objscope]
puts stderr "the method [::xotcl::self proc] is deprecated; use instead '$cmd'"
eval $cmd
}