root/OpenSceneGraph/trunk/include/osgDB/Archive @ 13041

Revision 13041, 3.8 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
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#ifndef OSGDB_ARCHIVE
15#define OSGDB_ARCHIVE 1
16
17#include <osgDB/ReaderWriter>
18#include <osgDB/Registry>
19#include <osgDB/FileUtils>
20
21#include <fstream>
22#include <list>
23
24namespace osgDB {
25
26
27/** Base class for implementing database Archives. See src/osgPlugins/osga for an example of a concrete implementation. */
28class OSGDB_EXPORT Archive : public ReaderWriter
29{
30    public:
31        Archive();
32        virtual ~Archive();
33
34        virtual const char* libraryName() const { return "osgDB"; }
35
36        virtual const char* className() const { return "Archive"; }
37
38        virtual bool acceptsExtension(const std::string& /*extension*/) const { return true; }
39
40        /** close the archive.*/
41        virtual void close() = 0;
42
43        /** Get the file name which represents the archived file.*/
44        virtual std::string getArchiveFileName() const = 0;
45
46        /** Get the file name which represents the master file recorded in the Archive.*/
47        virtual std::string getMasterFileName() const = 0;
48
49        /** return true if file exists in archive.*/
50        virtual bool fileExists(const std::string& filename) const = 0;
51
52        /** return type of file. */
53        virtual FileType getFileType(const std::string& filename) const = 0;
54
55        typedef osgDB::DirectoryContents FileNameList;
56
57        /** Get the full list of file names available in the archive.*/
58        virtual bool getFileNames(FileNameList& fileNames) const = 0;
59
60        /** return the contents of a directory.
61          * returns an empty array on any error.*/
62        virtual DirectoryContents getDirectoryContents(const std::string& dirName) const;
63
64
65        virtual ReadResult readObject(const std::string& /*fileName*/,const Options* =NULL) const = 0;
66        virtual ReadResult readImage(const std::string& /*fileName*/,const Options* =NULL) const = 0;
67        virtual ReadResult readHeightField(const std::string& /*fileName*/,const Options* =NULL) const = 0;
68        virtual ReadResult readNode(const std::string& /*fileName*/,const Options* =NULL) const = 0;
69        virtual ReadResult readShader(const std::string& /*fileName*/,const Options* =NULL) const = 0;
70
71        virtual WriteResult writeObject(const osg::Object& /*obj*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
72        virtual WriteResult writeImage(const osg::Image& /*image*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
73        virtual WriteResult writeHeightField(const osg::HeightField& /*heightField*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
74        virtual WriteResult writeNode(const osg::Node& /*node*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
75        virtual WriteResult writeShader(const osg::Shader& /*shader*/,const std::string& /*fileName*/,const Options* =NULL) const = 0;
76
77};
78
79/** Open an archive for reading or writing.*/
80OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint=4096);
81
82/** Open an archive for reading or writing.*/
83OSGDB_EXPORT Archive* openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options);
84}
85
86#endif // OSGDB_ARCHIVE
Note: See TracBrowser for help on using the browser.