home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
genfilepro.tcl
< prev
next >
Wrap
Text File
|
1997-10-13
|
2KB
|
96 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 {prefix ""}} {
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 $prefix]
if $first {
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 {prefix ""}} {
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
append name "_$prop"
}
}
set type [[$fileVersion file] type]
set line "${name}_${type} | $indent | | Fileprop \
| | | $fileVersion | | $properties | Fileprop"
if {$prefix != ""} {
set line "${prefix}_$line"
}
return $line
}
# Do not delete this line -- regeneration end marker