| 983 | } |
| 984 | |
| 985 | bool Namespace::unlinkClass( Namespace *parent ) |
| 986 | { |
| 987 | AssertFatal( mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!" ); |
| 988 | |
| 989 | // Skip additions to this namespace coming from packages. |
| 990 | |
| 991 | Namespace* walk = getPackageRoot(); |
| 992 | |
| 993 | // Make sure "parent" is the direct parent namespace. |
| 994 | |
| 995 | if( parent != NULL && walk->mParent && walk->mParent != parent ) |
| 996 | { |
| 997 | Con::errorf(ConsoleLogEntry::General, "Namespace::unlinkClass - cannot unlink namespace parent linkage for %s for %s.", |
| 998 | walk->mName, walk->mParent->mName); |
| 999 | return false; |
| 1000 | } |
| 1001 | |
| 1002 | // Decrease the reference count. Note that we do this on |
| 1003 | // the bottom-most namespace, i.e. the one guaranteed not |
| 1004 | // to come from a package. |
| 1005 | |
| 1006 | mRefCountToParent --; |
| 1007 | AssertFatal( mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0" ); |
| 1008 | |
| 1009 | // Unlink if the count dropped to zero. |
| 1010 | |
| 1011 | if( mRefCountToParent == 0 ) |
| 1012 | { |
| 1013 | walk->mParent = NULL; |
| 1014 | trashCache(); |
| 1015 | } |
| 1016 | |
| 1017 | return true; |
| 1018 | } |
| 1019 | |
| 1020 | |
| 1021 | bool Namespace::classLinkTo(Namespace *parent) |
no test coverage detected