2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +08:00
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
2003-01-22 00:45:36 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2003-01-22 00:45:36 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2003-01-22 00:45:36 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2001-10-04 23:12:57 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef OSGDB_READERWRITER
|
|
|
|
#define OSGDB_READERWRITER 1
|
|
|
|
|
|
|
|
#include <osg/Image>
|
2003-10-29 19:11:17 +08:00
|
|
|
#include <osg/Shape>
|
2001-09-20 05:08:56 +08:00
|
|
|
#include <osg/Node>
|
2014-07-14 23:59:06 +08:00
|
|
|
#include <osg/ScriptEngine>
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2008-07-17 20:13:04 +08:00
|
|
|
#include <osgDB/AuthenticationMap>
|
2003-02-10 21:58:39 +08:00
|
|
|
|
2004-11-22 22:10:12 +08:00
|
|
|
#include <deque>
|
2008-07-13 23:24:45 +08:00
|
|
|
#include <list>
|
2006-08-02 18:43:26 +08:00
|
|
|
#include <iosfwd>
|
2004-11-22 22:10:12 +08:00
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
namespace osgDB {
|
|
|
|
|
2004-11-08 05:17:31 +08:00
|
|
|
class Archive;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** List of directories to search through which searching for files. */
|
2004-11-22 22:10:12 +08:00
|
|
|
typedef std::deque<std::string> FilePathList;
|
|
|
|
|
2009-05-09 16:49:27 +08:00
|
|
|
// forward declare
|
|
|
|
class Options;
|
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Pure virtual base class for reading and writing of non native formats. */
|
2004-11-08 05:17:31 +08:00
|
|
|
class OSGDB_EXPORT ReaderWriter : public osg::Object
|
2001-09-20 05:08:56 +08:00
|
|
|
{
|
|
|
|
public:
|
2012-03-22 01:36:20 +08:00
|
|
|
|
|
|
|
|
2007-09-24 17:05:42 +08:00
|
|
|
ReaderWriter():
|
|
|
|
osg::Object(true) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2007-01-30 22:18:39 +08:00
|
|
|
ReaderWriter(const ReaderWriter& rw,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
2004-11-29 09:12:25 +08:00
|
|
|
osg::Object(rw,copyop) {}
|
2004-11-08 05:17:31 +08:00
|
|
|
|
|
|
|
virtual ~ReaderWriter();
|
|
|
|
|
|
|
|
META_Object(osgDB,ReaderWriter);
|
|
|
|
|
2008-07-13 23:24:45 +08:00
|
|
|
typedef std::map<std::string, std::string> FormatDescriptionMap;
|
2009-03-10 23:00:39 +08:00
|
|
|
typedef std::list<std::string> FeatureList;
|
2008-07-13 23:24:45 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return which protocols are supported by ReaderWriter. */
|
2008-07-13 23:24:45 +08:00
|
|
|
virtual const FormatDescriptionMap& supportedProtocols() const { return _supportedProtocols; }
|
2009-05-09 16:49:27 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return which list of file extensions supported by ReaderWriter. */
|
2008-07-15 17:55:33 +08:00
|
|
|
virtual const FormatDescriptionMap& supportedExtensions() const { return _supportedExtensions; }
|
2009-05-09 16:49:27 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return which list of file extensions supported by ReaderWriter. */
|
2008-07-13 23:24:45 +08:00
|
|
|
virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; }
|
|
|
|
|
2020-05-26 19:55:48 +08:00
|
|
|
/** Return which list of file environment variables supported by ReaderWriter. */
|
|
|
|
virtual const FormatDescriptionMap& supportedEnvironment() const { return _supportedEnvironment; }
|
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return true if ReaderWriter accepts specified file extension.*/
|
2008-07-13 23:24:45 +08:00
|
|
|
virtual bool acceptsExtension(const std::string& /*extension*/) const;
|
2014-07-14 23:59:06 +08:00
|
|
|
|
2012-12-08 03:05:47 +08:00
|
|
|
virtual bool acceptsProtocol(const std::string& protocol) const;
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/// Bit mask for setting up which feature types are available for read and/or write
|
2009-03-10 23:00:39 +08:00
|
|
|
enum Features
|
|
|
|
{
|
|
|
|
FEATURE_NONE = 0,
|
|
|
|
FEATURE_READ_OBJECT = 1<<0,
|
2012-03-22 01:36:20 +08:00
|
|
|
FEATURE_READ_IMAGE = 1<<1,
|
2009-03-10 23:00:39 +08:00
|
|
|
FEATURE_READ_HEIGHT_FIELD = 1<<2,
|
2012-03-22 01:36:20 +08:00
|
|
|
FEATURE_READ_NODE = 1<<3,
|
|
|
|
FEATURE_READ_SHADER = 1<<4,
|
2009-03-10 23:00:39 +08:00
|
|
|
FEATURE_WRITE_OBJECT = 1<<5,
|
|
|
|
FEATURE_WRITE_IMAGE = 1<<6,
|
|
|
|
FEATURE_WRITE_HEIGHT_FIELD = 1<<7,
|
|
|
|
FEATURE_WRITE_NODE = 1<<8,
|
|
|
|
FEATURE_WRITE_SHADER = 1<<9,
|
2014-07-14 23:59:06 +08:00
|
|
|
FEATURE_READ_SCRIPT = 1<<10,
|
|
|
|
FEATURE_WRITE_SCRIPT = 1<<11,
|
2009-03-10 23:00:39 +08:00
|
|
|
FEATURE_ALL = FEATURE_READ_OBJECT |
|
|
|
|
FEATURE_READ_IMAGE |
|
|
|
|
FEATURE_READ_HEIGHT_FIELD |
|
|
|
|
FEATURE_READ_NODE |
|
|
|
|
FEATURE_READ_SHADER |
|
2014-07-14 23:59:06 +08:00
|
|
|
FEATURE_READ_SCRIPT |
|
2009-03-10 23:00:39 +08:00
|
|
|
FEATURE_WRITE_OBJECT |
|
|
|
|
FEATURE_WRITE_IMAGE |
|
|
|
|
FEATURE_WRITE_HEIGHT_FIELD |
|
|
|
|
FEATURE_WRITE_NODE |
|
2014-07-14 23:59:06 +08:00
|
|
|
FEATURE_WRITE_SHADER |
|
|
|
|
FEATURE_WRITE_SCRIPT
|
2012-03-22 01:36:20 +08:00
|
|
|
};
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return available features*/
|
2009-03-10 23:00:39 +08:00
|
|
|
virtual Features supportedFeatures() const;
|
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Return feature as string */
|
2009-03-10 23:00:39 +08:00
|
|
|
static FeatureList featureAsString(Features feature);
|
|
|
|
|
2001-10-15 01:54:25 +08:00
|
|
|
|
|
|
|
|
2004-11-09 00:39:32 +08:00
|
|
|
class OSGDB_EXPORT ReadResult
|
2001-10-30 22:20:37 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
enum ReadStatus
|
2001-10-30 22:20:37 +08:00
|
|
|
{
|
2010-09-15 20:00:12 +08:00
|
|
|
NOT_IMPLEMENTED, //!< read*() method not implemented in concrete ReaderWriter.
|
2008-05-15 01:03:57 +08:00
|
|
|
FILE_NOT_HANDLED, //!< File is not appropriate for this file reader, due to some incompatibility, but *not* a read error.
|
|
|
|
FILE_NOT_FOUND, //!< File could not be found or could not be read.
|
2013-06-11 17:05:35 +08:00
|
|
|
ERROR_IN_READING_FILE, //!< File found, loaded, but an error was encountered during processing.
|
2008-05-15 01:03:57 +08:00
|
|
|
FILE_LOADED, //!< File successfully found, loaded, and converted into osg.
|
|
|
|
FILE_LOADED_FROM_CACHE, //!< File found in cache and returned.
|
2010-09-15 20:00:12 +08:00
|
|
|
FILE_REQUESTED, //!< Asynchronous file read has been requested, but returning immediately, keep polling plugin until file read has been completed.
|
|
|
|
INSUFFICIENT_MEMORY_TO_LOAD //!< File found but not loaded because estimated required memory surpasses available memory.
|
2001-10-30 22:20:37 +08:00
|
|
|
};
|
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
ReadResult(ReadStatus status=FILE_NOT_HANDLED):_status(status) {}
|
2001-10-30 22:20:37 +08:00
|
|
|
ReadResult(const std::string& m):_status(ERROR_IN_READING_FILE),_message(m) {}
|
2015-10-22 21:42:19 +08:00
|
|
|
|
2004-05-07 21:43:41 +08:00
|
|
|
ReadResult(osg::Object* obj, ReadStatus status=FILE_LOADED):_status(status),_object(obj) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2015-10-22 21:42:19 +08:00
|
|
|
template<class T>
|
|
|
|
ReadResult(const osg::ref_ptr<T>& obj, ReadStatus status=FILE_LOADED):_status(status),_object(obj.get()) {}
|
|
|
|
|
2001-10-30 22:20:37 +08:00
|
|
|
ReadResult(const ReadResult& rr):_status(rr._status),_message(rr._message),_object(rr._object) {}
|
|
|
|
ReadResult& operator = (const ReadResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message;_object=rr._object; return *this; }
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2013-06-11 17:05:35 +08:00
|
|
|
bool operator < (const ReadResult& rhs) const { return _status < rhs._status; }
|
2014-07-14 23:59:06 +08:00
|
|
|
|
2004-11-08 05:17:31 +08:00
|
|
|
osg::Object* getObject();
|
|
|
|
osg::Image* getImage();
|
|
|
|
osg::HeightField* getHeightField();
|
|
|
|
osg::Node* getNode();
|
|
|
|
osgDB::Archive* getArchive();
|
2008-03-04 22:04:48 +08:00
|
|
|
osg::Shader* getShader();
|
2014-07-14 23:59:06 +08:00
|
|
|
osg::Script* getScript();
|
2008-03-04 22:04:48 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
bool validObject() { return _object.valid(); }
|
|
|
|
bool validImage() { return getImage()!=0; }
|
2003-10-29 19:11:17 +08:00
|
|
|
bool validHeightField() { return getHeightField()!=0; }
|
2002-09-02 20:31:35 +08:00
|
|
|
bool validNode() { return getNode()!=0; }
|
2004-11-08 05:17:31 +08:00
|
|
|
bool validArchive() { return getArchive()!=0; }
|
2008-03-04 22:04:48 +08:00
|
|
|
bool validShader() { return getShader()!=0; }
|
2014-07-14 23:59:06 +08:00
|
|
|
bool validScript() { return getScript()!=0; }
|
2001-10-30 22:20:37 +08:00
|
|
|
|
2004-11-08 05:17:31 +08:00
|
|
|
osg::Object* takeObject();
|
|
|
|
osg::Image* takeImage();
|
|
|
|
osg::HeightField* takeHeightField();
|
|
|
|
osg::Node* takeNode();
|
|
|
|
osgDB::Archive* takeArchive();
|
2008-03-04 22:04:48 +08:00
|
|
|
osg::Shader* takeShader();
|
2014-07-14 23:59:06 +08:00
|
|
|
osg::Script* takeScript();
|
2001-10-30 22:20:37 +08:00
|
|
|
|
2006-11-08 01:00:56 +08:00
|
|
|
std::string& message() { return _message; }
|
2001-10-30 22:20:37 +08:00
|
|
|
const std::string& message() const { return _message; }
|
|
|
|
|
2016-01-20 01:39:03 +08:00
|
|
|
/// report the ReadResult's status, and message (if any). Useful for reporting of errors to users.
|
|
|
|
std::string statusMessage() const;
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
ReadStatus status() const { return _status; }
|
2004-05-07 21:43:41 +08:00
|
|
|
bool success() const { return _status==FILE_LOADED || _status==FILE_LOADED_FROM_CACHE ; }
|
|
|
|
bool loadedFromCache() const { return _status==FILE_LOADED_FROM_CACHE; }
|
2002-09-02 20:31:35 +08:00
|
|
|
bool error() const { return _status==ERROR_IN_READING_FILE; }
|
2009-03-11 01:27:39 +08:00
|
|
|
bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; }
|
2003-12-08 19:24:43 +08:00
|
|
|
bool notFound() const { return _status==FILE_NOT_FOUND; }
|
2010-03-10 22:28:18 +08:00
|
|
|
bool notEnoughMemory() const { return _status==INSUFFICIENT_MEMORY_TO_LOAD; }
|
2001-10-30 22:20:37 +08:00
|
|
|
|
|
|
|
protected:
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
ReadStatus _status;
|
2001-10-30 22:20:37 +08:00
|
|
|
std::string _message;
|
|
|
|
osg::ref_ptr<osg::Object> _object;
|
2008-07-17 19:55:55 +08:00
|
|
|
|
2001-10-30 22:20:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class WriteResult
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
enum WriteStatus
|
2001-10-30 22:20:37 +08:00
|
|
|
{
|
2010-09-15 20:00:12 +08:00
|
|
|
NOT_IMPLEMENTED, //!< write*() method not implemented in concrete ReaderWriter.
|
2001-10-30 22:20:37 +08:00
|
|
|
FILE_NOT_HANDLED,
|
2013-06-11 17:05:35 +08:00
|
|
|
ERROR_IN_WRITING_FILE,
|
|
|
|
FILE_SAVED
|
2001-10-30 22:20:37 +08:00
|
|
|
};
|
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
WriteResult(WriteStatus status=FILE_NOT_HANDLED):_status(status) {}
|
2001-10-30 22:20:37 +08:00
|
|
|
WriteResult(const std::string& m):_status(ERROR_IN_WRITING_FILE),_message(m) {}
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2001-10-30 22:20:37 +08:00
|
|
|
WriteResult(const WriteResult& rr):_status(rr._status),_message(rr._message) {}
|
|
|
|
WriteResult& operator = (const WriteResult& rr) { if (this==&rr) return *this; _status=rr._status; _message=rr._message; return *this; }
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2013-06-11 17:05:35 +08:00
|
|
|
bool operator < (const WriteResult& rhs) const { return _status < rhs._status; }
|
|
|
|
|
2006-11-08 01:00:56 +08:00
|
|
|
std::string& message() { return _message; }
|
2001-10-30 22:20:37 +08:00
|
|
|
const std::string& message() const { return _message; }
|
|
|
|
|
2016-01-20 01:39:03 +08:00
|
|
|
/// Report the WriteResult's status, and message (if any). Useful for reporting of errors to users.
|
|
|
|
std::string statusMessage() const;
|
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
WriteStatus status() const { return _status; }
|
|
|
|
bool success() const { return _status==FILE_SAVED; }
|
|
|
|
bool error() const { return _status==ERROR_IN_WRITING_FILE; }
|
2009-03-11 01:27:39 +08:00
|
|
|
bool notHandled() const { return _status==FILE_NOT_HANDLED || _status==NOT_IMPLEMENTED; }
|
2001-10-30 22:20:37 +08:00
|
|
|
|
|
|
|
protected:
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
WriteStatus _status;
|
2001-10-30 22:20:37 +08:00
|
|
|
std::string _message;
|
|
|
|
};
|
|
|
|
|
2004-11-08 05:17:31 +08:00
|
|
|
enum ArchiveStatus
|
|
|
|
{
|
|
|
|
READ,
|
|
|
|
WRITE,
|
|
|
|
CREATE
|
|
|
|
};
|
|
|
|
|
2009-05-09 16:49:27 +08:00
|
|
|
typedef osgDB::Options Options;
|
|
|
|
|
2015-06-01 21:40:20 +08:00
|
|
|
/** Determine if a file exists, normally the default implementation will be appropriate for local file access
|
2010-09-15 20:00:12 +08:00
|
|
|
* but with plugins like the libcurl based one it will return true if the file is accessible at the server. */
|
2009-05-14 03:46:16 +08:00
|
|
|
virtual bool fileExists(const std::string& filename, const Options* options) const;
|
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Open an archive for reading, writing, or to create an empty archive for writing to.*/
|
2009-03-11 01:27:39 +08:00
|
|
|
virtual ReadResult openArchive(const std::string& /*fileName*/,ArchiveStatus, unsigned int =4096, const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
2004-11-08 05:17:31 +08:00
|
|
|
|
2010-09-15 20:00:12 +08:00
|
|
|
/** Open an archive for reading.*/
|
2009-03-11 01:27:39 +08:00
|
|
|
virtual ReadResult openArchive(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
|
|
|
|
virtual ReadResult readObject(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readImage(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readHeightField(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readNode(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readShader(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
2014-07-14 23:59:06 +08:00
|
|
|
virtual ReadResult readScript(const std::string& /*fileName*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
2009-03-11 01:27:39 +08:00
|
|
|
|
|
|
|
virtual WriteResult writeObject(const osg::Object& /*obj*/,const std::string& /*fileName*/,const Options* =NULL) const {return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeImage(const osg::Image& /*image*/,const std::string& /*fileName*/,const Options* =NULL) const {return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeHeightField(const osg::HeightField& /*heightField*/,const std::string& /*fileName*/,const Options* =NULL) const {return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeNode(const osg::Node& /*node*/,const std::string& /*fileName*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeShader(const osg::Shader& /*shader*/,const std::string& /*fileName*/,const Options* =NULL) const {return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
2014-07-14 23:59:06 +08:00
|
|
|
virtual WriteResult writeScript(const osg::Script& /*script*/,const std::string& /*fileName*/,const Options* =NULL) const {return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
2009-03-11 01:27:39 +08:00
|
|
|
|
|
|
|
virtual ReadResult readObject(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readImage(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readHeightField(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readNode(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual ReadResult readShader(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
2014-07-14 23:59:06 +08:00
|
|
|
virtual ReadResult readScript(std::istream& /*fin*/,const Options* =NULL) const { return ReadResult(ReadResult::NOT_IMPLEMENTED); }
|
2009-03-11 01:27:39 +08:00
|
|
|
|
|
|
|
virtual WriteResult writeObject(const osg::Object& /*obj*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeImage(const osg::Image& /*image*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeHeightField(const osg::HeightField& /*heightField*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeNode(const osg::Node& /*node*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
|
|
|
virtual WriteResult writeShader(const osg::Shader& /*shader*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
2014-07-14 23:59:06 +08:00
|
|
|
virtual WriteResult writeScript(const osg::Script& /*script*/,std::ostream& /*fout*/,const Options* =NULL) const { return WriteResult(WriteResult::NOT_IMPLEMENTED); }
|
2003-05-26 17:27:16 +08:00
|
|
|
|
2009-12-16 23:48:34 +08:00
|
|
|
/** Specify fmt string as a supported protocol.
|
|
|
|
* Please note, this method should usually only be used internally by subclasses of ReaderWriter, Only in special cases
|
2010-09-15 20:00:12 +08:00
|
|
|
* will a ReaderWriter implementation be able to handle a protocol format that it wasn't originally designed for.
|
|
|
|
* To know whether it's safe to inject a new protocol format into an existing ReaderWriter you will need to review
|
2009-12-16 23:48:34 +08:00
|
|
|
* the source code and dependencies of that ReaderWriter. */
|
2008-07-13 23:24:45 +08:00
|
|
|
void supportsProtocol(const std::string& fmt, const std::string& description);
|
2009-12-16 23:48:34 +08:00
|
|
|
|
|
|
|
/** Specify ext string as a supported file extension.
|
|
|
|
* Please note, this method should usually only be used internally by subclasses of ReaderWriter. Only in special cases
|
2010-09-15 20:00:12 +08:00
|
|
|
* will a ReaderWriter implementation be able to handle a file extension that it wasn't originally designed for.
|
|
|
|
* To know whether it's safe to inject a new file extension into an existing ReaderWriter you will need to review the
|
2009-12-16 23:48:34 +08:00
|
|
|
* the source code and dependencies of that ReaderWriter. */
|
|
|
|
void supportsExtension(const std::string& ext, const std::string& description);
|
|
|
|
|
|
|
|
/** Specify option string as a supported option string.
|
|
|
|
* Please note, this should usually only be used internally by subclasses of ReaderWriter. */
|
|
|
|
void supportsOption(const std::string& opt, const std::string& description);
|
|
|
|
|
2020-05-26 19:55:48 +08:00
|
|
|
/** Specify env string as a supported environment string. */
|
|
|
|
void supportsEnvironment(const std::string& opt, const std::string& description);
|
|
|
|
|
2009-12-16 23:48:34 +08:00
|
|
|
protected:
|
2008-07-13 23:24:45 +08:00
|
|
|
|
|
|
|
FormatDescriptionMap _supportedProtocols;
|
|
|
|
FormatDescriptionMap _supportedExtensions;
|
|
|
|
FormatDescriptionMap _supportedOptions;
|
2020-05-26 19:55:48 +08:00
|
|
|
FormatDescriptionMap _supportedEnvironment;
|
2001-09-20 05:08:56 +08:00
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2004-10-24 22:24:15 +08:00
|
|
|
#endif // OSGDB_READERWRITER
|