Changeset 8620

Show
Ignore:
Timestamp:
07/17/08 14:13:04
Author:
robert
Message:

Moved AuthenticalMap/AuthenticationDetails? out in their own files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/include/osgDB/ReaderWriter

    r8619 r8620  
    1515#define OSGDB_READERWRITER 1 
    1616 
    17 #include <osg/Referenced> 
    1817#include <osg/Image> 
    1918#include <osg/Shape> 
    2019#include <osg/Node> 
    2120 
    22 #include <osgDB/Export
     21#include <osgDB/AuthenticationMap
    2322 
    2423#include <deque> 
     
    3231/** list of directories to search through which searching for files. */ 
    3332typedef std::deque<std::string> FilePathList; 
    34  
    35 class AuthenticationDetails : public osg::Referenced 
    36 { 
    37 public: 
    38  
    39     /** Http authentication techniques, see libcurl docs for details on names and associated functionality.*/  
    40     enum HttpAuthentication 
    41     { 
    42         BASIC           = 1<<0, 
    43         DIGEST          = 1<<1, 
    44         NTLM            = 1<<2, 
    45         GSSNegotiate    = 1<<2, 
    46         ANY             = ~0, 
    47         ANYSAFE         = ~BASIC 
    48     }; 
    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::Referenced 
    64 { 
    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 }; 
    8233 
    8334/** pure virtual base class for reading and writing of non native formats. */ 
  • OpenSceneGraph/trunk/src/osgDB/CMakeLists.txt

    r8213 r8620  
    1010SET(LIB_PUBLIC_HEADERS 
    1111    ${HEADER_PATH}/Archive 
     12    ${HEADER_PATH}/AuthenticationMap 
    1213    ${HEADER_PATH}/DatabasePager 
    1314    ${HEADER_PATH}/DotOsgWrapper 
     
    3637    ${LIB_PUBLIC_HEADERS} 
    3738    Archive.cpp 
     39    AuthenticationMap.cpp 
    3840    DatabasePager.cpp 
    3941    DotOsgWrapper.cpp 
  • OpenSceneGraph/trunk/src/osgDB/ReaderWriter.cpp

    r8619 r8620  
    1616#include <osgDB/Archive> 
    1717 
    18 #include <map> 
    19  
    2018using namespace osgDB; 
    21  
    22 /////////////////////////////////////////////////////////////////////////////////////////////////////// 
    23 // 
    24 //  PasswordMap 
    25 // 
    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) const 
    33 { 
    34     // see if the full filename has its own authentication details 
    35     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 details 
    39     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 //  ReaderWriter 
    53 // 
    5419 
    5520osg::Object* ReaderWriter::ReadResult::getObject() { return _object.get(); }