Changeset 8620
- Timestamp:
- 07/17/08 14:13:04
- Files:
-
- OpenSceneGraph/trunk/include/osgDB/AuthenticationMap (added)
- OpenSceneGraph/trunk/include/osgDB/ReaderWriter (modified) (2 diffs)
- OpenSceneGraph/trunk/src/osgDB/AuthenticationMap.cpp (added)
- OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt (modified) (2 diffs)
- OpenSceneGraph/trunk/src/osgDB/ReaderWriter.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph/trunk/include/osgDB/ReaderWriter
r8619 r8620 15 15 #define OSGDB_READERWRITER 1 16 16 17 #include <osg/Referenced>18 17 #include <osg/Image> 19 18 #include <osg/Shape> 20 19 #include <osg/Node> 21 20 22 #include <osgDB/ Export>21 #include <osgDB/AuthenticationMap> 23 22 24 23 #include <deque> … … 32 31 /** list of directories to search through which searching for files. */ 33 32 typedef std::deque<std::string> FilePathList; 34 35 class AuthenticationDetails : public osg::Referenced36 {37 public:38 39 /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/40 enum HttpAuthentication41 {42 BASIC = 1<<0,43 DIGEST = 1<<1,44 NTLM = 1<<2,45 GSSNegotiate = 1<<2,46 ANY = ~0,47 ANYSAFE = ~BASIC48 };49 50 AuthenticationDetails(const std::string& u, const std::string& p, HttpAuthentication auth=BASIC):51 username(u),52 password(p),53 httpAuthentication(auth) {}54 55 std::string username;56 std::string password;57 HttpAuthentication httpAuthentication;58 59 protected:60 virtual ~AuthenticationDetails() {}61 };62 63 class OSGDB_EXPORT AuthenticationMap : public osg::Referenced64 {65 public:66 67 AuthenticationMap() {}68 69 70 virtual void addAuthenticationDetails(const std::string& path, AuthenticationDetails* details);71 72 virtual const AuthenticationDetails* getAuthenticationDetails(const std::string& path) const;73 74 protected:75 76 virtual ~AuthenticationMap() {}77 78 typedef std::map<std::string, osg::ref_ptr<AuthenticationDetails> > AuthenticationDetailsMap;79 AuthenticationDetailsMap _authenticationMap;80 81 };82 33 83 34 /** pure virtual base class for reading and writing of non native formats. */ OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt
r8213 r8620 10 10 SET(LIB_PUBLIC_HEADERS 11 11 ${HEADER_PATH}/Archive 12 ${HEADER_PATH}/AuthenticationMap 12 13 ${HEADER_PATH}/DatabasePager 13 14 ${HEADER_PATH}/DotOsgWrapper … … 36 37 ${LIB_PUBLIC_HEADERS} 37 38 Archive.cpp 39 AuthenticationMap.cpp 38 40 DatabasePager.cpp 39 41 DotOsgWrapper.cpp OpenSceneGraph/trunk/src/osgDB/ReaderWriter.cpp
r8619 r8620 16 16 #include <osgDB/Archive> 17 17 18 #include <map>19 20 18 using namespace osgDB; 21 22 ///////////////////////////////////////////////////////////////////////////////////////////////////////23 //24 // PasswordMap25 //26 27 void AuthenticationMap::addAuthenticationDetails(const std::string& path, AuthenticationDetails* details)28 {29 _authenticationMap[path] = details;30 }31 32 const AuthenticationDetails* AuthenticationMap::getAuthenticationDetails(const std::string& path) const33 {34 // see if the full filename has its own authentication details35 AuthenticationDetailsMap::const_iterator itr = _authenticationMap.find(path);36 if (itr != _authenticationMap.end()) return itr->second.get();37 38 // now look to see if the paths to the file have their own authentication details39 std::string basePath = osgDB::getFilePath(path);40 while(!basePath.empty())41 {42 itr = _authenticationMap.find(basePath);43 if (itr != _authenticationMap.end()) return itr->second.get();44 45 basePath = osgDB::getFilePath(basePath);46 }47 return 0;48 }49 50 ///////////////////////////////////////////////////////////////////////////////////////////////////////51 //52 // ReaderWriter53 //54 19 55 20 osg::Object* ReaderWriter::ReadResult::getObject() { return _object.get(); }
