From Stephan Huber,

"Attached you'll find a proposal for using different
protocols. The idea behind the new code is:

1.) plugins/apps register protocols which they can handle. This is done
via osgDB::Registry::registerProtocol(aProtocolName). Plugins register
supported protocols as usual via ReaderWriter::supportsProtocol(..), the
Registry is updated accordingly.

2.) osgDB::containsServerAddress checks first for an appearance of "://"
in the filename and then checks the protocol against the set of
registered protocols via Registry::isProtocolRegistered(aProtocollName)

3.) the other getServer*-functions changed as well, there's even a
getServerProtocol-function


With these changes filenames/Urls get routed to loaded plugins even with
different protocols than 'http'."
This commit is contained in:
Robert Osfield
2009-03-10 12:21:13 +00:00
parent 199067d150
commit b5a15fb5b4
5 changed files with 56 additions and 11 deletions

View File

@@ -331,6 +331,9 @@ Registry::Registry()
addFileExtensionAlias("pgm", "pnm");
addFileExtensionAlias("ppm", "pnm");
// register http-protocol, so the curl can handle it, if necessary
registerProtocol("http");
}
@@ -2092,3 +2095,15 @@ SharedStateManager* Registry::getOrCreateSharedStateManager()
return _sharedStateManager.get();
}
void Registry::registerProtocol(const std::string& protocol)
{
_registeredProtocols.insert( convertToLowerCase(protocol) );
}
bool Registry::isProtocolRegistered(const std::string& protocol)
{
return (_registeredProtocols.find( convertToLowerCase(protocol) ) != _registeredProtocols.end());
}