MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / unlinkNamespaces

Method unlinkNamespaces

Engine/source/console/simObject.cpp:2002–2059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2000//-----------------------------------------------------------------------------
2001
2002void SimObject::unlinkNamespaces()
2003{
2004 if( !mNameSpace )
2005 return;
2006
2007 Namespace* cppNamespace = getClassRep()->getNameSpace();
2008 Namespace* parentNamespace = cppNamespace;
2009
2010 // Handle superclass.
2011
2012 if( mSuperClassName && mSuperClassName[ 0 ] )
2013 {
2014 // Get the superclass namespace.
2015
2016 Namespace* superClassNamespace = Con::lookupNamespace( mSuperClassName );
2017
2018 // Make it the parent namespace.
2019
2020 parentNamespace = superClassNamespace;
2021
2022 // Decrease parent refcounts on the superclass hierarchy.
2023
2024 for( Namespace* linkWalk = superClassNamespace;
2025 linkWalk != NULL && linkWalk != cppNamespace && linkWalk->getParent() != NULL; )
2026 {
2027 // Store the parent link since it may disappear once we
2028 // decrease the reference count.
2029 Namespace* parent = linkWalk->getParent();
2030
2031 // Decrease the refcount.
2032 if( linkWalk->getPackage() == NULL ) // Skip namespaces coming from packages.
2033 linkWalk->decRefCountToParent();
2034
2035 // Walk up.
2036 linkWalk = parent;
2037 }
2038 }
2039
2040 // Handle class.
2041
2042 if( mClassName && mClassName[ 0 ] )
2043 {
2044 Namespace* classNamespace = Con::lookupNamespace( mClassName );
2045 if( classNamespace )
2046 {
2047 classNamespace->decRefCountToParent();
2048 parentNamespace = classNamespace;
2049 }
2050 }
2051
2052 // Handle object name.
2053
2054 StringTableEntry objectName = getName();
2055 if( objectName && objectName[ 0 ] )
2056 mNameSpace->decRefCountToParent();
2057
2058 mNameSpace = NULL;
2059}

Callers

nothing calls this directly

Calls 6

lookupNamespaceFunction · 0.85
getNameSpaceMethod · 0.80
getPackageMethod · 0.80
decRefCountToParentMethod · 0.80
getNameFunction · 0.50
getParentMethod · 0.45

Tested by

no test coverage detected