home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
genfilepro.tcl
< prev
next >
Wrap
Text File
|
1996-05-29
|
2KB
|
94 lines
Class GenFileProp : {Object} {
method destructor
constructor
method getDocStructure
method getStructureLine
method match
attribute document
}
method GenFileProp::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor GenFileProp {class this name document} {
set this [Object::constructor $class $this $name]
$this document $document
# Start constructor user section
# End constructor user section
return $this
}
method GenFileProp::getDocStructure {this fileTypes properties} {
set structure ""
set first 1
set sv [[$this document] documentedSystem]
if [$sv isNil] {
wmtkerror "Invalid documented system"
return $structure
}
foreach fv [$sv localFileVersions] {
if [$this match $fileTypes $fv] {
if [lempty [$fv properties]] {
# no properties, skip this one
continue
}
set structureLine [$this getStructureLine $fv \
$properties $first]
if {$first == "1"} {
set structure $structureLine
} else {
set structure "$structure\n$structureLine"
}
set first 0
}
}
return $structure
}
method GenFileProp::match {this fileTypes fileVersion} {
if {[lsearch $fileTypes [[$fileVersion file] type]] == -1} {
return 0
}
return 1
}
method GenFileProp::getStructureLine {this fileVersion properties first} {
set indent "="
if {$first == "1"} {
set indent "+"
}
set name [[$fileVersion file] qualifiedName :]
# add propertieNames to get unique names
# max 2 prop names
if {$properties != "*"} {
set prCount 0
foreach prop $properties {
if {$prCount > 1} {
break
}
incr prCount
set name "${name}_$prop"
}
}
set type [[$fileVersion file] type]
set line "p_${name}_${type} | $indent | | Fileprop | | | \
$fileVersion | | $properties | Fileprop"
return $line
}
# Do not delete this line -- regeneration end marker