home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
classmaker.tcl
< prev
next >
Wrap
Text File
|
1997-07-03
|
2KB
|
74 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)classmaker.tcl /main/titanic/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)classmaker.tcl /main/titanic/1 3 Jul 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
Class ClassMaker : {Object} {
constructor
method destructor
}
constructor ClassMaker {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method ClassMaker::destructor {this} {
# Start destructor user section
# End destructor user section
}
proc ClassMaker::extend {baseClass className attributes {needsName 1}} {
if {(! [isCommand "$baseClass"]) || [isCommand "$className"]} return
set attrDef "\n"
foreach attr $attributes {
set attrDef [concat $attrDef "attribute $attr\n"]
}
set createCmd "\
Class $className : \{$baseClass\} \{\n\
method destructor\n\
constructor\n\
$attrDef\
\}"
if {[lsearch -exact ["$baseClass" info methods] destructor] != -1} {
set baseDestructCmd "\$this $baseClass::destructor\n"
} else {
set baseDestructCmd ""
}
set destructorCmd "\
method $className::destructor \{this\} \{\n\
$baseDestructCmd \
\}"
if $needsName {
set constructorCmd "\
constructor $className \{class this name\} \{\n\
set this \[$baseClass::constructor \$class \$this \$name\]\n\
return \$this\n\
\}"
} else {
set constructorCmd "\
constructor $className \{class this\} \{\n\
set this \[$baseClass::constructor \$class \$this\]\n\
return \$this\n\
\}"
}
eval $createCmd
eval $destructorCmd
eval $constructorCmd
}
# Do not delete this line -- regeneration end marker