root/OpenSceneGraph/trunk/src/osgDB/AuthenticationMap.cpp @ 13041

Revision 13041, 1.5 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include <osgDB/AuthenticationMap>
15#include <osgDB/FileNameUtils>
16
17using namespace osgDB;
18
19void AuthenticationMap::addAuthenticationDetails(const std::string& path, AuthenticationDetails* details)
20{
21   _authenticationMap[path] = details;
22}
23
24const AuthenticationDetails* AuthenticationMap::getAuthenticationDetails(const std::string& path) const
25{
26    // see if the full filename has its own authentication details
27    AuthenticationDetailsMap::const_iterator itr = _authenticationMap.find(path);
28    if (itr != _authenticationMap.end()) return itr->second.get();
29
30    // now look to see if the paths to the file have their own authentication details
31    std::string basePath = osgDB::getFilePath(path);
32    while(!basePath.empty())
33    {
34        itr = _authenticationMap.find(basePath);
35        if (itr != _authenticationMap.end()) return itr->second.get();
36
37        basePath = osgDB::getFilePath(basePath);
38    }
39    return 0;
40}
Note: See TracBrowser for help on using the browser.