::xotcl::Object
Class CopyHandler

Heritage:
::xotcl::Object
Class CopyHandler
superclass ::xotcl::Object,

Variables
NameDefault ValueClassComment
dest  ""  ::xotcl::Object::CopyHandler
 
objLength    ::xotcl::Object::CopyHandler
 
targetList  ""  ::xotcl::Object::CopyHandler
 
 
Methods
NameComment
copy {obj dest}   Perform a deep copy of the object/class (with all information, like class, parameter, filter, etc) to "newName"
copyNSVarsAndCmds {orig dest}  
copyTargets {}  
getDest {origin}  
makeTargetList {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

copy

Description:
 Perform a deep copy of the object/class (with all
 information, like class, parameter, filter, etc) to
 "newName".
Arguments:
Overrides:
copy in ::xotcl::Object
Code:
  ::xotcl::Object::CopyHandler instproc copy {obj dest}  {
   
::xotcl::my set objLength [string length $obj]
::xotcl::my set dest $dest
::xotcl::my makeTargetList $obj
::xotcl::my copyTargets
}

copyNSVarsAndCmds

Description:
 
Arguments:
Code:
  ::xotcl::Object::CopyHandler instproc copyNSVarsAndCmds {orig dest}  {
   
::xotcl::namespace_copyvars $orig $dest
::xotcl::namespace_copycmds $orig $dest
}

copyTargets

Description:
 
Code:
  ::xotcl::Object::CopyHandler instproc copyTargets {}  {
   
foreach origin [::xotcl::my set targetList] {
set dest [::xotcl::my getDest $origin]
if {[::xotcl::my isobject $origin]} {
if {[::xotcl::my isclass $origin]} {
set cl [[$origin info class] create $dest -noinit]
set obj $cl
$cl superclass [$origin info superclass]
$cl parameterclass [$origin info parameterclass]
$cl parameter [$origin info parameter]
$cl instinvar [$origin info instinvar]
$cl instfilter [$origin info instfilter -guards]
$cl instmixin [$origin info instmixin]
my copyNSVarsAndCmds ::xotcl::classes::$origin ::xotcl::classes::$dest} else {
set obj [[$origin info class] create $dest -noinit]}
$obj invar [$origin info invar]
$obj check [$origin info check]
$obj mixin [$origin info mixin]
$obj filter [$origin info filter -guards]
if {[$origin info hasNamespace]} {
$obj requireNamespace}} else {
namespace eval $dest {}}
::xotcl::my copyNSVarsAndCmds $origin $dest}
}

getDest

Description:
 
Arguments:
Code:
  ::xotcl::Object::CopyHandler instproc getDest {origin}  {
   
set tail [string range $origin [::xotcl::my set objLength] end]
return ::[string trimleft [::xotcl::my set dest]$tail :]
}

makeTargetList

Description:
 
Arguments:
Code:
  ::xotcl::Object::CopyHandler instproc makeTargetList {t}  {
   
::xotcl::my lappend targetList $t
if {[::xotcl::my isobject $t]} {
if {[$t info hasNamespace]} {
set children [$t info children]} else {
return}}
foreach c [namespace children $t] {
if {![::xotcl::my isobject $c]} {
lappend children [namespace children $t]}}
foreach c $children {
::xotcl::my makeTargetList $c}
}