Added osgDB::AuthenticationMap/Details to osgDB and curl plugin to add the ability

to authenticate http transfers
This commit is contained in:
Robert Osfield
2008-07-17 11:55:55 +00:00
parent a6c72dc21c
commit adaf71fa19
5 changed files with 164 additions and 11 deletions

View File

@@ -15,8 +15,43 @@
#include <osgDB/FileNameUtils>
#include <osgDB/Archive>
#include <map>
using namespace osgDB;
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// PasswordMap
//
void AuthenticationMap::addAuthenticationDetails(const std::string& path, AuthenticationDetails* details)
{
_authenticationMap[path] = details;
}
const AuthenticationDetails* AuthenticationMap::getAuthenticationDetails(const std::string& path) const
{
// see if the full filename has its own authentication details
AuthenticationDetailsMap::const_iterator itr = _authenticationMap.find(path);
if (itr != _authenticationMap.end()) return itr->second.get();
// now look to see if the paths to the file have their own authentication details
std::string basePath = osgDB::getFilePath(path);
while(!basePath.empty())
{
itr = _authenticationMap.find(basePath);
if (itr != _authenticationMap.end()) return itr->second.get();
basePath = osgDB::getFilePath(basePath);
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ReaderWriter
//
osg::Object* ReaderWriter::ReadResult::getObject() { return _object.get(); }
osg::Image* ReaderWriter::ReadResult::getImage() { return dynamic_cast<osg::Image*>(_object.get()); }
osg::HeightField* ReaderWriter::ReadResult::getHeightField() { return dynamic_cast<osg::HeightField*>(_object.get()); }