- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nx::Object
::nx::Object create ...
Class Relations
- class: ::nx::Class
- subclass: ::nx::serializer::ObjectSystemSerializer, ::xo::ical::VCALITEM, ::xo::MessageRelay, ::xowf::test_item::grading::Grading, ::xowf::test_item::AssessmentInterface, ::xowf::IpRange, ::rrd::Plugin, ::acs::Container, ::acs::SiteNodesCache, ::acs::Cache, ::ftpd::Infrastructure, ::acs::DocHelper, ::crypto::HashFunctions, ::ws::snapshot::Snapshot, ::nsbeat::Beat, ::acs::SiteNodeUrlspaceCache, ::xo::lti::LTI, ::rrd::VolatileObject, ::letsencrypt::Client, ::nsshell::THREAD, ::acs::LockfreeCache, ::acs::db::Driver, ::xowiki::Mode, ::xowiki::Upload, ::rrd::DataSource, ::nsshell::Handler, ::nntp::Session, ::nx::serializer::Serializer, ::acs::db::SQL, ::cookieconsent::CookieConsent, ::ns_crypto::HashFunctions, ::xo::REST, ::acs::SiteNode, ::acs::Cluster, ::nx::CopyHandler, ::nx::NsScopedNew, ::nx::Slot, ::nx::EnsembleObject, ::nx::Class
::nx::Class create ::nx::ObjectMethods (to be applied on instances)
cget (alias)
configure (alias)
contains (scripted)
if {![info exists object]} {set object [::nsf::self]} if {![::nsf::object::exists $object]} {$class create $object} # This method is reused in XOTcl which has e.g. no "require"; # therefore use nsf primitiva. ::nsf::directdispatch $object ::nsf::methods::object::requirenamespace if {$withnew} { # # When $withnew is requested we replace the default new method # with a version using the current namespace as root. Earlier # implementations used a mixin on nx::Class and xotcl::Class, # but frequent mixin operations on the most general meta-class # are expensive when there are many classes defined # (e.g. several ten thousands), since the mixin operation # invalidates the mixins for all instances of the meta-class # (i.e. for all classes) # set infoMethod "::nsf::methods::class::info::method" set plainNew "::nsf::methods::class::new" set mappedNew [::nx::NsScopedNew $infoMethod definitionhandle new] set nxMapNew [expr {[::nx::Class $infoMethod origin new] eq $plainNew}] if {$nxMapNew} {::nsf::method::alias ::nx::Class new $mappedNew} if {[::nsf::is class ::xotcl::Class]} { set xotclMapNew [expr {[::xotcl::Class $infoMethod origin new] eq $plainNew}] if {$xotclMapNew} {::nsf::method::alias ::xotcl::Class new $mappedNew } } # # Evaluate the command under catch to ensure reverse mapping # of "new" # set errorOccurred [catch [list ::apply [list {} $cmds $object]] result errorOptions] # # Remove the mapped "new" method, if it was added above # if {$nxMapNew} {::nsf::method::alias ::nx::Class new $plainNew} if {[::nsf::is class ::xotcl::Class]} { if {$xotclMapNew} {::nsf::method::alias ::xotcl::Class new $plainNew} } # # Report the error with message and code when necessary # if {$errorOccurred} { dict incr errorOptions -level dict unset errorOptions -errorinfo } return -options $errorOptions $result } else { ::apply [list {} $cmds $object] }copy (scripted)
if {[string trimleft $newName :] ne [string trimleft [::nsf::self] :]} { set h [CopyHandler new] set r [$h copy [::nsf::self] $newName] $h destroy return $r }delete object method (scripted)
::nsf::method::delete [self] -per-object $namedelete object property (scripted)
set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] if {$slot eq ""} { return -code error "[self]: cannot delete object-specific property '$name'" } $slot destroy nsf::var::unset -nocomplain [self] $namedelete object variable (scripted)
if {[nsf::var::exists [self] $name]} { nsf::var::unset [self] $name } else { return -code error "[self]: object does not have an instance variable '$name'" } # call explicitly the per-object variant of "info::slotobjects" set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] if {$slot ne ""} { # it is not a slot-less variable $slot destroy }destroy (alias)
destroy_on_cleanup (scripted)
set ::xo::cleanup([self]) [list [self] destroy]eval (alias)
info baseclass (alias)
info children (alias)
info class (alias)
info has mixin (alias)
info has namespace (alias)
info has type (alias)
info info (scripted)
::nx::internal::infoOptions -asList=$asList ::nx::Object::slot::__infoinfo lookup filter (alias)
info lookup filters (alias)
info lookup method (alias)
info lookup methods (alias)
info lookup mixins (alias)
info lookup parameters (scripted)
return [::nsf::cmd::info parameter -context [self] [:info lookup method $methodName] {*}[expr {[info exists pattern] ? $pattern : ""}] ]info lookup slots (scripted)
set cmd [list ::nsf::methods::object::info::lookupslots -type $type] if {[info exists source]} {lappend cmd -source $source} if {[info exists pattern]} {lappend cmd $pattern} return [: {*}$cmd]info lookup syntax (scripted)
return [::nsf::cmd::info syntax -context [self] [:info lookup method $methodName] {*}[expr {[info exists pattern] ? $pattern : ""}] ]info lookup variables (scripted)
return [: info lookup slots -type ::nx::VariableSlot {*}[current args]]info name (alias)
info object filters (alias)
info object method args (scripted)
: ::nsf::methods::object::info::method args $name
info object method body (scripted)
: ::nsf::methods::object::info::method body $name
info object method callprotection (scripted)
if {[::nsf::method::property [self] -per-object $name call-protected]} { return protected } elseif {[::nsf::method::property [self] -per-object $name call-private]} { return private } else { return public }info object method debug (scripted)
::nsf::method::property [self] -per-object $name debuginfo object method definition (scripted)
: ::nsf::methods::object::info::method definition $name
info object method definitionhandle (scripted)
: ::nsf::methods::object::info::method definitionhandle $name
info object method deprecated (scripted)
::nsf::method::property [self] -per-object $name deprecatedinfo object method exists (scripted)
: ::nsf::methods::object::info::method exists $name
info object method handle (scripted)
: ::nsf::methods::object::info::method definitionhandle $name
info object method origin (scripted)
: ::nsf::methods::object::info::method origin $name
info object method parameters (scripted)
set defs [: ::nsf::methods::object::info::method parameter $name] if {[info exists pattern]} {return [::nsf::parameter::filter $defs $pattern]} return $defsinfo object method registrationhandle (scripted)
: ::nsf::methods::object::info::method registrationhandle $name
info object method returns (scripted)
: ::nsf::methods::object::info::method returns $name
info object method submethods (scripted)
: ::nsf::methods::object::info::method submethods $name
info object method syntax (scripted)
return [string trimright "/obj/ [namespace tail $name] [: ::nsf::methods::object::info::method syntax $name]" { }]info object method type (scripted)
: ::nsf::methods::object::info::method type $name
info object methods (alias)
info object mixins (alias)
info object slots (scripted)
set method [list ::nsf::methods::object::info::slotobjects -type $type] if {[info exists pattern]} {lappend method $pattern} return [: {*}$method]info object variables (scripted)
return [: info object slots -type ::nx::VariableSlot {*}[current args]]info parent (alias)
info precedence (alias)
info variable definition (scripted)
return [$handle definition]info variable name (scripted)
return [$handle cget -name]info variable parameter (scripted)
return [$handle parameter]info vars (alias)
move (scripted)
if {[string trimleft $newName :] ne [string trimleft [::nsf::self] :]} { if {$newName ne ""} { :copy $newName } ### let all subclasses get the copied class as superclass if {[::nsf::is class [::nsf::self]] && $newName ne ""} { foreach subclass [: ::nsf::methods::class::info::subclass] { set scl [$subclass ::nsf::methods::class::info::superclass] if {[set index [lsearch -exact $scl [::nsf::self]]] != -1} { set scl [lreplace $scl $index $index $newName] ::nsf::relation::set $subclass superclass $scl } } } :destroy }object alias (scripted)
set pathData [:__resolve_method_path -per-object $methodName] set object [dict get $pathData object] #puts "object alias $object.[dict get $pathData methodName] $cmd" set r [::nsf::method::alias $object -per-object [dict get $pathData methodName] -frame $frame $cmd] ::nsf::method::property $object -per-object $r call-protected [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} if {$debug} {::nsf::method::property $object $r debug true} if {$deprecated} {::nsf::method::property $object $r deprecated true} return $robject filters (forward)
object forward (scripted)
set arguments [lrange [::nsf::current args] 1 end] set pathData [:__resolve_method_path -per-object $methodName] set object [dict get $pathData object] if {[info exists target] && [string index $target 0] eq "-"} { error "target '$target' must not start with a dash" } if {[info exists frame] && $frame ni {object default}} { error "value of parameter '-frame' must be 'object' or 'default'" } if {[info exists returns]} { set nrPreArgs [expr {[llength $arguments]-[llength $args]}] # search for "-returns" in the arguments before $args ... set p [lsearch -exact [lrange $arguments 0 $nrPreArgs] -returns] # ... and remove it if found if {$p > -1} {set arguments [lreplace $arguments $p $p+1]} } set r [::nsf::method::forward $object -per-object [dict get $pathData methodName] {*}$arguments] ::nsf::method::property $object -per-object $r call-protected [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} if {$debug} {::nsf::method::property $object $r debug true} if {$deprecated} {::nsf::method::property $object $r deprecated true} return $robject method (scripted)
set pathData [:__resolve_method_path -per-object $methodName] set object [dict get $pathData object] set regObject [dict get $pathData regObject] # puts "object method $object.[dict get $pathData methodName] [list $arguments] {...}" set r [::nsf::method::create $object -checkalways=$checkalways {*}[expr {$regObject ne "" ? "-reg-object [list $regObject]" : ""}] -per-object [dict get $pathData methodName] $arguments $body] if {$r ne ""} { # the method was not deleted ::nsf::method::property $object $r call-protected [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} if {$debug} {::nsf::method::property $object $r debug true} if {$deprecated} {::nsf::method::property $object $r deprecated true} } return $robject mixins (forward)
object property (scripted)
if {$accessor eq ""} { set accessor [::nsf::dispatch [self] __default_accessor] #puts stderr "OBJECT [self] got default accessor ${accessor}" } set traceSpec [expr {[info exists trace] ? [list -trace $trace] : ""}] set r [[self] object variable -accessor $accessor -incremental=$incremental -class $class -initblock $initblock -configurable $configurable -nocomplain=$nocomplain {*}$traceSpec {*}$spec] return $robject variable (scripted)
#puts stderr "Object variable $spec accessor $accessor nocomplain $nocomplain incremental $incremental" # get name and list of parameter options lassign [::nx::MetaSlot parseParameterSpec -class $class -target [self] $spec] name parameterOptions class options #puts "[self] object variable $spec name <$name> parameterOptions <$parameterOptions> class <$class> options <$options>" if {[dict exists $options -configurable]} { set configurable [dict get $options -configurable] } if {![info exists trace] && [info exists :trace] && ${:trace} ne "none"} { set trace ${:trace} } #puts "[self] object variable $spec haveDefault? [info exists defaultValue] opts <$parameterOptions> options <$options>" if {[info exists defaultValue] && [dict exists $options -substdefault] && [string match {*\[*\]*} $defaultValue] } { if {![info complete $defaultValue]} { return -code error "substdefault: default '$defaultValue' is not a complete script" } set substDefaultOptions [::nx::MetaSlot substDefaultOptions [dict get $options -substdefault]] set defaultValue [subst {*}$substDefaultOptions $defaultValue] } # # Check for slot-less variables # if {$initblock eq "" && !$configurable && !$incremental && $accessor eq "none" && ![info exists trace] } { # # The variable is slot-less. # #puts "[self]... slotless variable $spec" # The following tasks have to be still performed: # - If there is an explicit default value, the value has to # be checked. # - if the type is a switch, we have to set the implicit # default value, when there is not explicit default # set isSwitch [expr {[dict exists $options -type] && [dict get $options -type] eq "switch"}] if {[info exists defaultValue]} { if {[info exists :$name] && !$nocomplain} { return -code error "object [self] has already an instance variable named '$name'" } if {$parameterOptions ne ""} { #puts stderr "*** ::nsf::is $parameterOptions $defaultValue // opts=$options" # # Extract from the options a spec for value checking, and # let "nsf::is" perform the actual checking. In case, the # check fails, "nsf::is" will raise an error with and error # message communicating the failure. # set nspec [::nx::MetaSlot optionsToValueCheckingSpec $options] ::nsf::is -complain $nspec $defaultValue } else { set name $spec } set :$name $defaultValue } elseif {$isSwitch} { set :$name 0 } else { return -code error "variable definition for '$name' (without value and accessor) is useless" } return } #puts "[self]... slot variable $spec" # # create variable via a slot object # set defaultopts [list -accessor $accessor] if {[info exists trace]} {lappend defaultopts -trace $trace} set slot [::nx::MetaSlot createFromParameterSpec [self] -per-object -class $class -initblock $initblock -incremental=$incremental -private=[expr {$accessor eq "private"}] -defaultopts $defaultopts $spec {*}[expr {[info exists defaultValue] ? [list $defaultValue] : ""}]] if {$nocomplain} {$slot eval {set :nocomplain 1}} if {!$configurable} {$slot eval {set :configurable false}} if {[info exists defaultValue]} { # # We could consider calling "configure" instead, but that would # not work for true "variable" handlers. # # In case a "get" trace is activated, don't complain about # pre-existing variables, which might be set via traces. # set allowpreset [expr {"get" in [$slot cget -trace] && [nsf::var::exists [self] $name]}] $slot setCheckedInstVar -allowpreset=$allowpreset -nocomplain=$nocomplain [self] $defaultValue #set :__initblock($name) 1 } if {[$slot eval {info exists :settername}]} { set name [$slot cget -settername] } else { set name [$slot cget -name] } #puts "[self]... $slot cget DONE" return [::nsf::directdispatch [self] ::nsf::methods::object::info::method registrationhandle $name]private (scripted)
if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { return -code error "'[lindex $args 0]' is not a method defining method" } elseif {[lindex $args 0] eq "object" && ![info exists ::nsf::methodDefiningMethod([lindex $args 1])]} { return -code error "'[lindex $args 1]' is not a method defining method" } set r [: -system {*}$args] if {$r ne ""} {::nsf::method::property [self] $r call-private true} return $rprotected (scripted)
if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { return -code error "'[lindex $args 0]' is not a method defining method" } elseif {[lindex $args 0] eq "object" && ![info exists ::nsf::methodDefiningMethod([lindex $args 1])]} { return -code error "'[lindex $args 1]' is not a method defining method" } set r [: -system {*}$args] if {$r ne ""} {::nsf::method::property [self] $r call-protected true} return $rpublic (scripted)
if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { return -code error "'[lindex $args 0]' is not a method defining method" } elseif {[lindex $args 0] eq "object" && ![info exists ::nsf::methodDefiningMethod([lindex $args 1])]} { return -code error "'[lindex $args 1]' is not a method defining method" } set r [: -system {*}$args] if {$r ne ""} {::nsf::method::property [self] $r call-protected false} return $rrequire namespace (scripted)
::nsf::directdispatch [::nsf::self] ::nsf::methods::object::requirenamespacerequire object method (scripted)
::nsf::method::require [::nsf::self] $methodName 1 return [:info lookup method $methodName]require private object method (scripted)
set result [:require object method $methodName] ::nsf::method::property [self] $result call-private true return $resultrequire protected object method (scripted)
set result [:require object method $methodName] ::nsf::method::property [self] $result call-protected true return $resultrequire public object method (scripted)
set result [:require object method $methodName] ::nsf::method::property [self] $result call-protected false return $resultserialize (scripted)
::Serializer deepSerialize [self]
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables