OpenSceneGraph/include/osgDB/Input
Robert Osfield b7b065abe3 Refactored the Registry::ReadFileCallback, WriteFileCallback and ReaderWriter::Options to they are now defined in their own header and in the osgDB namespace.
Introduced a new FindFileCallback to Registry to compliement the existing ReadFileCallback and WriteFileCallback.

Added support for assign Find, Read and WriteFileCallbacks to osdDB::Options to enable plugins/applications to override the callbacks just for that
read/write call and any nested file operations
2009-05-09 08:49:27 +00:00

98 lines
4.4 KiB
C++

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGDB_INPUT
#define OSGDB_INPUT 1
#include <osg/Image>
#include <osg/Shader>
#include <osg/Node>
#include <osg/Drawable>
#include <osg/StateAttribute>
#include <osg/ArgumentParser>
#include <osgDB/FieldReaderIterator>
#include <osgDB/ReaderWriter>
#include <osgDB/Options>
#include <map>
#include <string>
namespace osgDB {
struct basic_type_wrapper;
/** Class for managing the reading of ASCII .osg files.*/
class OSGDB_EXPORT Input : public FieldReaderIterator
{
public:
Input();
virtual ~Input();
void setOptions(const Options* options) { _options = options; }
const Options* getOptions() const { return _options.get(); }
virtual osg::Object* readObjectOfType(const osg::Object& compObj);
virtual osg::Object* readObjectOfType(const basic_type_wrapper &btw);
virtual osg::Object* readObject();
virtual osg::Image* readImage();
virtual osg::Drawable* readDrawable();
virtual osg::StateAttribute* readStateAttribute();
virtual osg::Uniform* readUniform();
virtual osg::Node* readNode();
virtual osg::Shader* readShader();
virtual osg::Object* readObject(const std::string& fileName);
virtual osg::Image* readImage(const std::string& fileName);
virtual osg::Node* readNode(const std::string& fileName);
virtual osg::Shader* readShader(const std::string& fileName);
virtual osg::Object* getObjectForUniqueID(const std::string& uniqueID);
virtual void registerUniqueIDForObject(const std::string& uniqueID,osg::Object* obj);
typedef osg::ArgumentParser::Parameter Parameter;
bool read(Parameter value1);
bool read(Parameter value1, Parameter value2);
bool read(Parameter value1, Parameter value2, Parameter value3);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
bool read(Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
bool read(const char* str);
bool read(const char* str, Parameter value1);
bool read(const char* str, Parameter value1, Parameter value2);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
bool read(const char* str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
private:
typedef std::map< std::string, osg::ref_ptr<osg::Object> > UniqueIDToObjectMapping;
UniqueIDToObjectMapping _uniqueIDToObjectMap;
osg::ref_ptr<const Options> _options;
};
}
#endif // __SG_INPUT_H