Changeset 22 for trunk/tcl/scripts
- Timestamp:
- Jul 16, 2005, 2:31:32 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tcl/scripts/library.tcl
r13 r22 127 127 } 128 128 structure { 129 # add this to the return list with the right flavor 130 if {$params(-as) == "component"} { 131 lappend rlist $cpath 132 } else { 133 lappend rlist [$xmlobj element -as $params(-as) $cpath] 134 } 135 129 136 if {[$xmlobj element $cpath.current.parameters] != ""} { 130 137 lappend queue $cpath.current.parameters … … 163 170 public method get {{path ""}} 164 171 public method put {args} 172 public method copy {path from args} 165 173 public method remove {{path ""}} 166 174 public method xml {} … … 169 177 public proc value {libobj path} 170 178 179 public proc path2list {path} 171 180 protected method find {path} 172 protected method path2list {path}173 181 protected method node2name {node} 174 182 protected method node2comp {node} … … 515 523 } 516 524 return "" 525 } 526 527 # ---------------------------------------------------------------------- 528 # USAGE: copy <path> from ?<xmlobj>? <path> 529 # 530 # Clients use this to copy the value from one xmlobj/path to another. 531 # If the <xmlobj> is not specified, it is assumed to be the same as 532 # the current object. 533 # ---------------------------------------------------------------------- 534 itcl::body Rappture::LibraryObj::copy {path from args} { 535 if {[llength $args] == 1} { 536 set xmlobj $this 537 set fpath [lindex $args 0] 538 } elseif {[llength $args] == 2} { 539 set xmlobj [lindex $args 0] 540 set fpath [lindex $args 1] 541 } else { 542 error "wrong # args: should be \"copy path from ?xmlobj? path\"" 543 } 544 if {$from != "from"} { 545 error "bad syntax: should be \"copy path from ?xmlobj? path\"" 546 } 547 548 if {[llength [$xmlobj children $fpath]] == 0} { 549 set val [$xmlobj get $fpath] 550 put $path $val 551 } else { 552 set obj [$xmlobj element -as object $fpath] 553 put $path $obj 554 itcl::delete object $obj 555 } 517 556 } 518 557
Note: See TracChangeset
for help on using the changeset viewer.