MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / _getArchiveToResource

Method _getArchiveToResource

OgreMain/src/OgreResourceGroupManager.cpp:745–825  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

743 }
744 //-----------------------------------------------------------------------
745 Archive *ResourceGroupManager::_getArchiveToResource( const String &resourceName,
746 const String &groupName,
747 bool searchGroupsIfNotFound )
748 {
749 OgreAssert( !resourceName.empty(), "resourceName is empty string" );
750 OGRE_LOCK_AUTO_MUTEX;
751
752 /*TODO
753 if(mLoadingListener)
754 {
755 DataStreamPtr stream = mLoadingListener->resourceLoading(resourceName, groupName,
756 resourceBeingLoaded); if(stream) return stream;
757 }*/
758
759 // Try to find in resource index first
760 ResourceGroup *grp = getResourceGroup( groupName );
761 if( !grp )
762 {
763 OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND,
764 "Cannot locate a resource group called '" + groupName + "' for resource '" +
765 resourceName + "'",
766 "ResourceGroupManager::_getArchiveToResource" );
767 }
768
769 OGRE_LOCK_MUTEX( grp->OGRE_AUTO_MUTEX_NAME ); // lock group mutex
770
771 Archive *pArch = 0;
772 ResourceLocationIndex::iterator rit = grp->resourceIndexCaseSensitive.find( resourceName );
773 if( rit != grp->resourceIndexCaseSensitive.end() )
774 {
775 // Found in the index
776 pArch = rit->second;
777 return pArch;
778 }
779 else
780 {
781 // try case insensitive
782 String lcResourceName = resourceName;
783 StringUtil::toLowerCase( lcResourceName );
784 rit = grp->resourceIndexCaseInsensitive.find( lcResourceName );
785 if( rit != grp->resourceIndexCaseInsensitive.end() )
786 {
787 // Found in the index
788 pArch = rit->second;
789 return pArch;
790 }
791 else
792 {
793 // Search the hard way
794 LocationList::iterator li, liend;
795 liend = grp->locationList.end();
796 for( li = grp->locationList.begin(); li != liend; ++li )
797 {
798 Archive *arch = ( *li )->archive;
799 if( arch->exists( resourceName ) )
800 return arch;
801 }
802 }

Callers 3

scheduleLoadRequestMethod · 0.80
loadImplMethod · 0.80
loadImplMethod · 0.80

Calls 5

emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected