From Alan Harris, "Registry and Archive

~~~~~~~~~~~~~~~~~~~~~~~~~
This is a simple change to permit databases other than those named
"*.osga" to be used. It is hardcoded in read() at present.

It is non-critical and does not affect existing program functionality.

Registry and Registry.cpp
~~~~~~~~~~~~~~~~~~~~~~~~~
Added a new typedef:      typedef std::vector< std::string>
ArchiveExtensionList;

a list of extensions:     ArchiveExtensionList  _archiveExtList;

and an "add" method:      addArchiveExtension(const std::string ext)

This is initialised by adding "osga" in Registry() and used in
Registry::read() where the list is searched for the extension used.

Archive.cpp
~~~~~~~~~~~
This submission is a little more tentative. openArchive() is modified to
automatically add the filename extension to the Registry extension list.
"
This commit is contained in:
Robert Osfield
2007-05-09 09:43:18 +00:00
parent 6c74589014
commit 790a1ea66f
3 changed files with 50 additions and 19 deletions

View File

@@ -29,6 +29,13 @@ osgDB::Archive* osgDB::openArchive(const std::string& filename, Archive::Archive
osgDB::Archive* osgDB::openArchive(const std::string& filename, Archive::ArchiveStatus status, unsigned int indexBlockSizeHint,ReaderWriter::Options* options)
{
// ensure archive extension is in the registry list
std::string::size_type dot = filename.find_last_of('.');
if (dot != std::string::npos)
{
std::string ext = filename.substr(dot+1);
Registry::instance()->addArchiveExtension(ext);
}
ReaderWriter::ReadResult result = osgDB::Registry::instance()->openArchive(filename, status, indexBlockSizeHint, options);
return result.takeArchive();
}