| 965 | } |
| 966 | |
| 967 | bool Namespace::unlinkClass(Namespace *parent) |
| 968 | { |
| 969 | AssertFatal(mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!"); |
| 970 | |
| 971 | // Skip additions to this namespace coming from packages. |
| 972 | |
| 973 | Namespace* walk = getPackageRoot(); |
| 974 | |
| 975 | // Make sure "parent" is the direct parent namespace. |
| 976 | |
| 977 | if (parent != NULL && walk->mParent && walk->mParent != parent) |
| 978 | { |
| 979 | Con::errorf(ConsoleLogEntry::General, "Namespace::unlinkClass - cannot unlink namespace parent linkage for %s for %s.", |
| 980 | walk->mName, walk->mParent->mName); |
| 981 | return false; |
| 982 | } |
| 983 | |
| 984 | // Decrease the reference count. Note that we do this on |
| 985 | // the bottom-most namespace, i.e. the one guaranteed not |
| 986 | // to come from a package. |
| 987 | |
| 988 | mRefCountToParent--; |
| 989 | AssertFatal(mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0"); |
| 990 | |
| 991 | // Unlink if the count dropped to zero. |
| 992 | |
| 993 | if (mRefCountToParent == 0) |
| 994 | { |
| 995 | walk->mParent = NULL; |
| 996 | trashCache(); |
| 997 | } |
| 998 | |
| 999 | return true; |
| 1000 | } |
| 1001 | |
| 1002 | |
| 1003 | bool Namespace::classLinkTo(Namespace *parent) |
no test coverage detected