Callbacks 3.7 KB

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