Exemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////
// processUnloadingResources
void CsCore::processUnloadingResources()
{
	std::lock_guard< std::recursive_mutex > Lock( ContainerLock_ );

	while( UnloadingResources_.size() > 0 )
	{
		TResourceList ResourceList = UnloadingResources_;

		TResourceListIterator It( ResourceList.begin() );
		while( It != ResourceList.end() )
		{
			CsResource* pResource = (*It);
			
			// Destroy resource.
			pResource->destroy();
			
			// Free resource.
			pResource->getClass()->destruct( pResource );
			BcMemFree( pResource );
			
			// Next.
			++It;
		}
	
		UnloadingResources_.clear();
	}
}
//virtual
std::string CsSerialiserPackageObjectCodec::serialiseAsStringRef( 
	void* InData, 
	const ReClass* InType )
{
	std::string RetVal;

	if( Package_ != nullptr )
	{
		const ReClass* InClass = static_cast< const ReClass* >( InType );

		// Check if it's a resource.
		if( InClass->hasBaseClass( ReObject::StaticGetClass() ) )
		{
			CsResource* Resource = reinterpret_cast< CsResource* >( InData );
			ReObject* ResourceRootOwner = Resource->getRootOwner();
			if( ResourceRootOwner != nullptr )
			{
				BcChar OutChars[ 128 ];
				BcSPrintf( OutChars, "$(%s:%s.%s)",  
					(*Resource->getClass()->getName()).c_str(), 
					(*ResourceRootOwner->getName()).c_str(),
					(*Resource->getName()).c_str() );
				RetVal = OutChars;
			}
		}
	}

	if( RetVal.empty() )
	{
		// Default formatting.
		BcChar OutChars[ 128 ];
		BcSPrintf( OutChars, "$(%s:%s.%llu)",   
			(*InType->getName()).c_str(),
			( "this" ),
			( (unsigned long long)InData ) );
	}

	return RetVal;
}