Added new ReaderWriter methods for recording what protocols, extensions and options are

support by ReaderWriters
This commit is contained in:
Robert Osfield
2008-07-13 15:24:45 +00:00
parent 6aa604f31a
commit cb98cddc31
8 changed files with 85 additions and 72 deletions

View File

@@ -30,6 +30,7 @@ extern OSGDB_EXPORT std::string getStrippedName(const std::string& fileName);
extern OSGDB_EXPORT std::string convertFileNameToWindowsStyle(const std::string& fileName);
extern OSGDB_EXPORT std::string convertFileNameToUnixStyle(const std::string& fileName);
extern OSGDB_EXPORT std::string convertToLowerCase(const std::string& fileName);
extern OSGDB_EXPORT bool isFileNameNativeStyle(const std::string& fileName);
extern OSGDB_EXPORT std::string convertFileNameToNativeStyle(const std::string& fileName);

View File

@@ -22,6 +22,7 @@
#include <osgDB/Export>
#include <deque>
#include <list>
#include <iosfwd>
namespace osgDB {
@@ -47,7 +48,19 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
META_Object(osgDB,ReaderWriter);
virtual bool acceptsExtension(const std::string& /*extension*/) const { return false; }
typedef std::map<std::string, std::string> FormatDescriptionMap;
/** return which protocols are supported by ReaderWriter. */
virtual const FormatDescriptionMap& supportedProtocols() const { return _supportedProtocols; }
/** return which list of file extensions supported by ReaderWriter. */
virtual const FormatDescriptionMap& supportedExtension() const { return _supportedExtensions; }
/** return which list of file extensions supported by ReaderWriter. */
virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; }
/** return true if ReaderWriter accepts specified file extension.*/
virtual bool acceptsExtension(const std::string& /*extension*/) const;
/** Options base class used for passing options into plugins to control their operation.*/
class Options : public osg::Object
@@ -304,6 +317,15 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
virtual WriteResult writeNode(const osg::Node& /*node*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::FILE_NOT_HANDLED); }
virtual WriteResult writeShader(const osg::Shader& /*shader*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::FILE_NOT_HANDLED); }
protected:
void supportsProtocol(const std::string& fmt, const std::string& description);
void supportsExtension(const std::string& fmt, const std::string& description);
void supportsOption(const std::string& fmt, const std::string& description);
FormatDescriptionMap _supportedProtocols;
FormatDescriptionMap _supportedExtensions;
FormatDescriptionMap _supportedOptions;
};
}