| 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 | #ifndef OSGDB_CALLBACKS |
|---|
| 15 | #define OSGDB_CALLBACKS 1 |
|---|
| 16 | |
|---|
| 17 | #include <osgDB/AuthenticationMap> |
|---|
| 18 | #include <osgDB/ReaderWriter> |
|---|
| 19 | #include <osgDB/FileCache> |
|---|
| 20 | |
|---|
| 21 | #include <deque> |
|---|
| 22 | #include <list> |
|---|
| 23 | #include <iosfwd> |
|---|
| 24 | |
|---|
| 25 | namespace osgDB { |
|---|
| 26 | |
|---|
| 27 | /** list of directories to search through which searching for files. */ |
|---|
| 28 | typedef std::deque<std::string> FilePathList; |
|---|
| 29 | |
|---|
| 30 | enum CaseSensitivity |
|---|
| 31 | { |
|---|
| 32 | CASE_SENSITIVE, |
|---|
| 33 | CASE_INSENSITIVE |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | // forward decare |
|---|
| 37 | class Options; |
|---|
| 38 | |
|---|
| 39 | class OSGDB_EXPORT FindFileCallback : public virtual osg::Referenced |
|---|
| 40 | { |
|---|
| 41 | public: |
|---|
| 42 | |
|---|
| 43 | virtual std::string findDataFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity); |
|---|
| 44 | |
|---|
| 45 | virtual std::string findLibraryFile(const std::string& filename, const Options* options, CaseSensitivity caseSensitivity); |
|---|
| 46 | |
|---|
| 47 | protected: |
|---|
| 48 | virtual ~FindFileCallback() {} |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | class OSGDB_EXPORT ReadFileCallback : public virtual osg::Referenced |
|---|
| 53 | { |
|---|
| 54 | public: |
|---|
| 55 | |
|---|
| 56 | virtual ReaderWriter::ReadResult openArchive(const std::string& filename,ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint, const Options* useObjectCache); |
|---|
| 57 | |
|---|
| 58 | virtual ReaderWriter::ReadResult readObject(const std::string& filename, const Options* options); |
|---|
| 59 | |
|---|
| 60 | virtual ReaderWriter::ReadResult readImage(const std::string& filename, const Options* options); |
|---|
| 61 | |
|---|
| 62 | virtual ReaderWriter::ReadResult readHeightField(const std::string& filename, const Options* options); |
|---|
| 63 | |
|---|
| 64 | virtual ReaderWriter::ReadResult readNode(const std::string& filename, const Options* options); |
|---|
| 65 | |
|---|
| 66 | virtual ReaderWriter::ReadResult readShader(const std::string& filename, const Options* options); |
|---|
| 67 | |
|---|
| 68 | protected: |
|---|
| 69 | virtual ~ReadFileCallback() {} |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | class OSGDB_EXPORT WriteFileCallback : public virtual osg::Referenced |
|---|
| 73 | { |
|---|
| 74 | public: |
|---|
| 75 | |
|---|
| 76 | virtual ReaderWriter::WriteResult writeObject(const osg::Object& obj, const std::string& fileName,const Options* options); |
|---|
| 77 | |
|---|
| 78 | virtual ReaderWriter::WriteResult writeImage(const osg::Image& obj, const std::string& fileName,const Options* options); |
|---|
| 79 | |
|---|
| 80 | virtual ReaderWriter::WriteResult writeHeightField(const osg::HeightField& obj, const std::string& fileName,const Options* options); |
|---|
| 81 | |
|---|
| 82 | virtual ReaderWriter::WriteResult writeNode(const osg::Node& obj, const std::string& fileName,const Options* options); |
|---|
| 83 | |
|---|
| 84 | virtual ReaderWriter::WriteResult writeShader(const osg::Shader& obj, const std::string& fileName,const Options* options); |
|---|
| 85 | |
|---|
| 86 | protected: |
|---|
| 87 | virtual ~WriteFileCallback() {} |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | class OSGDB_EXPORT FileLocationCallback : public virtual osg::Referenced |
|---|
| 91 | { |
|---|
| 92 | public: |
|---|
| 93 | |
|---|
| 94 | enum Location |
|---|
| 95 | { |
|---|
| 96 | LOCAL_FILE, |
|---|
| 97 | REMOTE_FILE |
|---|
| 98 | }; |
|---|
| 99 | |
|---|
| 100 | virtual Location fileLocation(const std::string& filename, const Options* options) = 0; |
|---|
| 101 | |
|---|
| 102 | virtual bool useFileCache() const = 0; |
|---|
| 103 | |
|---|
| 104 | protected: |
|---|
| 105 | virtual ~FileLocationCallback() {} |
|---|
| 106 | }; |
|---|
| 107 | |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | #endif // OSGDB_OPTIONS |
|---|