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:
@@ -40,6 +40,7 @@ extern OSGDB_EXPORT bool equalCaseInsensitive(const std::string& lhs,const std::
|
||||
extern OSGDB_EXPORT bool equalCaseInsensitive(const std::string& lhs,const char* rhs);
|
||||
|
||||
extern OSGDB_EXPORT bool containsServerAddress(const std::string& filename);
|
||||
extern OSGDB_EXPORT std::string getServerProtocol(const std::string& filename);
|
||||
extern OSGDB_EXPORT std::string getServerAddress(const std::string& filename);
|
||||
extern OSGDB_EXPORT std::string getServerFileName(const std::string& filename);
|
||||
|
||||
|
||||
@@ -478,7 +478,13 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
|
||||
/** Add an Archive extension.*/
|
||||
void addArchiveExtension(const std::string ext);
|
||||
|
||||
|
||||
/** registers a protocol */
|
||||
void registerProtocol(const std::string& protocol);
|
||||
|
||||
/** returns true, if named protocol is registered */
|
||||
bool isProtocolRegistered(const std::string& protocol);
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Registry();
|
||||
@@ -491,6 +497,8 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair;
|
||||
typedef std::map<std::string, ObjectTimeStampPair > ObjectCache;
|
||||
typedef std::map<std::string, osg::ref_ptr<osgDB::Archive> > ArchiveCache;
|
||||
|
||||
typedef std::set<std::string> RegisteredProtocolsSet;
|
||||
|
||||
/** constructor is private, as its a singleton, preventing
|
||||
construction other than via the instance() method and
|
||||
@@ -508,6 +516,8 @@ class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
osg::ref_ptr<AuthenticationMap> _authenticationMap;
|
||||
|
||||
bool _createNodeFromImage;
|
||||
|
||||
RegisteredProtocolsSet _registeredProtocols;
|
||||
|
||||
osg::Object* readObject(DotOsgWrapperMap& dowMap,Input& fr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user