root/OpenSceneGraph/trunk/src/osgDB/Options.cpp @ 10171

Revision 10171, 4.0 kB (checked in by robert, 6 years ago)

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

Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under 
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include <osgDB/Options>
15#include <osgDB/Registry>
16
17using namespace osgDB;
18
19///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
20//
21// FindFileCallback default implementation
22//
23std::string FindFileCallback::findDataFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity)
24{
25    return osgDB::Registry::instance()->findDataFileImplementation(filename, options, caseSensitivity);
26}
27
28std::string FindFileCallback::findLibraryFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity)
29{
30    return osgDB::Registry::instance()->findLibraryFileImplementation(filename, options, caseSensitivity);
31}
32
33///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34//
35// ReadFileCallback default implementation
36//
37ReaderWriter::ReadResult ReadFileCallback::openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* useObjectCache)
38{
39    return osgDB::Registry::instance()->openArchiveImplementation(filename, status, indexBlockSizeHint, useObjectCache);
40}
41
42ReaderWriter::ReadResult ReadFileCallback::readObject(const std::string& filename, const Options* options)
43{
44    return osgDB::Registry::instance()->readObjectImplementation(filename,options);
45}
46
47ReaderWriter::ReadResult ReadFileCallback::readImage(const std::string& filename, const Options* options)
48{
49    return osgDB::Registry::instance()->readImageImplementation(filename,options);
50}
51
52ReaderWriter::ReadResult ReadFileCallback::readHeightField(const std::string& filename, const Options* options)
53{
54    return osgDB::Registry::instance()->readHeightFieldImplementation(filename,options);
55}
56
57ReaderWriter::ReadResult ReadFileCallback::readNode(const std::string& filename, const Options* options)
58{
59    return osgDB::Registry::instance()->readNodeImplementation(filename,options);
60}
61
62ReaderWriter::ReadResult ReadFileCallback::readShader(const std::string& filename, const Options* options)
63{
64    return osgDB::Registry::instance()->readShaderImplementation(filename,options);
65}
66
67///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
68//
69// WriteFileCallback default implementation
70//
71ReaderWriter::WriteResult WriteFileCallback::writeObject(const osg::Object& obj, const std::string& fileName,const Options* options)
72{
73    return osgDB::Registry::instance()->writeObjectImplementation(obj,fileName,options);
74}
75
76ReaderWriter::WriteResult WriteFileCallback::writeImage(const osg::Image& obj, const std::string& fileName,const Options* options)
77{
78    return osgDB::Registry::instance()->writeImageImplementation(obj,fileName,options);
79}
80
81ReaderWriter::WriteResult WriteFileCallback::writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options)
82{
83    return osgDB::Registry::instance()->writeHeightFieldImplementation(obj,fileName,options);
84}
85
86ReaderWriter::WriteResult WriteFileCallback::writeNode(const osg::Node& obj, const std::string& fileName,const Options* options)
87{
88    return osgDB::Registry::instance()->writeNodeImplementation(obj,fileName,options);
89}
90
91ReaderWriter::WriteResult WriteFileCallback::writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options)
92{
93    return osgDB::Registry::instance()->writeShaderImplementation(obj,fileName,options);
94}
Note: See TracBrowser for help on using the browser.