2001-10-04 23:12:57 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
#ifndef OSGDB_READERWRITER
|
|
|
|
#define OSGDB_READERWRITER 1
|
|
|
|
|
|
|
|
#include <osg/Referenced>
|
|
|
|
#include <osg/Image>
|
|
|
|
#include <osg/Node>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace osgDB {
|
|
|
|
|
|
|
|
|
|
|
|
/** pure virtual base class for reading and writing of non native formats. */
|
|
|
|
class OSGDB_EXPORT ReaderWriter : public osg::Referenced
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~ReaderWriter() {}
|
|
|
|
virtual const char* className() = 0;
|
|
|
|
virtual bool acceptsExtension(const std::string& /*extension*/) { return false; }
|
|
|
|
|
2001-10-15 01:54:25 +08:00
|
|
|
class Options : public osg::Referenced
|
|
|
|
{
|
|
|
|
public:
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-10-15 01:54:25 +08:00
|
|
|
Options() {}
|
|
|
|
Options(const std::string& str):_str(str) {}
|
|
|
|
|
|
|
|
void setOptionString(const std::string& str) { _str = str; }
|
|
|
|
const std::string& getOptionString() const { return _str; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~Options() {}
|
|
|
|
|
|
|
|
std::string _str;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
virtual osg::Object* readObject(const std::string& /*fileName*/,const Options* =NULL) { return NULL; }
|
|
|
|
virtual osg::Image* readImage(const std::string& /*fileName*/,const Options* =NULL) { return NULL; }
|
|
|
|
virtual osg::Node* readNode(const std::string& /*fileName*/,const Options* =NULL) { return NULL; }
|
|
|
|
|
|
|
|
virtual bool writeObject(const osg::Object& /*obj*/,const std::string& /*fileName*/,const Options* =NULL) {return false; }
|
|
|
|
virtual bool writeImage(const osg::Image& /*image*/,const std::string& /*fileName*/,const Options* =NULL) {return false; }
|
|
|
|
virtual bool writeNode(const osg::Node& /*node*/,const std::string& /*fileName*/,const Options* =NULL) { return false; }
|
2001-09-20 05:08:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OSG_READERWRITER
|