MCPcopy Create free account
hub / github.com/TankOs/SFGUI / GetMatchingLoader

Method GetMatchingLoader

src/SFGUI/ResourceManager.cpp:104–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104std::shared_ptr<const ResourceLoader> ResourceManager::GetMatchingLoader( const std::string& path ) {
105 if( path.empty() || ( path == "Default" ) ) {
106 return std::shared_ptr<const ResourceLoader>();
107 }
108
109 // Extract prefix.
110 auto colon_pos = path.find( ':' );
111 std::shared_ptr<const ResourceLoader> loader;
112
113 if( colon_pos != std::string::npos ) {
114 auto ident = path.substr( 0, colon_pos );
115
116 auto loader_iter = m_loaders.find( ident );
117
118 if( loader_iter != m_loaders.end() ) {
119 loader = loader_iter->second;
120 }
121 }
122
123 // Use file loader as fallback.
124 if( !loader ) {
125 loader = m_loaders["file"];
126 }
127
128 return loader;
129}
130
131void ResourceManager::Clear() {
132 m_loaders.clear();

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected