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

Revision 13041, 4.2 kB (checked in by robert, 2 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_DATABASEREVISIONS
15#define OSGDB_DATABASEREVISIONS 1
16
17#include <osg/Node>
18
19#include <osgDB/ReaderWriter>
20
21#include <set>
22
23namespace osgDB {
24
25class OSGDB_EXPORT FileList : public osg::Object
26{
27    public:
28
29        FileList();
30        FileList(const FileList& fileList, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
31
32        META_Object(osgDB, FileList)
33
34        typedef std::set<std::string> FileNames;
35        FileNames& getFileNames() { return _files; }
36        const FileNames& getFileNames() const { return _files; }
37
38        bool empty() const { return _files.empty(); }
39
40        bool containsFile(const std::string& filename) const { return _files.count(filename)!=0; }
41
42        void addFile(const std::string& filename) { _files.insert(filename); }
43
44        bool removeFile(const std::string& filename);
45
46        void append(FileList* fileList);
47
48    protected:
49
50        virtual ~FileList();
51
52        FileNames _files;
53};
54
55
56class OSGDB_EXPORT DatabaseRevision : public osg::Object
57{
58    public:
59
60        DatabaseRevision();
61        DatabaseRevision(const DatabaseRevision& revision, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
62
63        META_Object(osgDB, DatabaseRevision)
64
65        void setDatabasePath(const std::string& path) { _databasePath = path; }
66        const std::string& getDatabasePath() const { return _databasePath; }
67
68        typedef std::set<std::string> FileNames;
69
70        void setFilesAdded(FileList* fileList) { _filesAdded = fileList; }
71        FileList* getFilesAdded() { return _filesAdded.get(); }
72        const FileList* getFilesAdded() const { return _filesAdded.get(); }
73
74        void setFilesRemoved(FileList* fileList) { _filesRemoved = fileList; }
75        FileList* getFilesRemoved() { return _filesRemoved.get(); }
76        const FileList* getFilesRemoved() const { return _filesRemoved.get(); }
77
78        void setFilesModified(FileList* fileList) { _filesModified = fileList; }
79        FileList* getFilesModified() { return _filesModified.get(); }
80        const FileList* getFilesModified() const { return _filesModified.get(); }
81
82        bool isFileBlackListed(const std::string& filename) const;
83
84        bool removeFile(const std::string& filename);
85
86    protected:
87
88        virtual ~DatabaseRevision();
89
90        std::string             _databasePath;
91
92        osg::ref_ptr<FileList>  _filesAdded;
93        osg::ref_ptr<FileList>  _filesRemoved;
94        osg::ref_ptr<FileList>  _filesModified;
95};
96
97class OSGDB_EXPORT DatabaseRevisions : public osg::Object
98{
99    public:
100
101        DatabaseRevisions();
102        DatabaseRevisions(const DatabaseRevisions& revisions, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY);
103
104        META_Object(osgDB, DatabaseRevisions)
105
106        typedef std::vector< osg::ref_ptr<DatabaseRevision> > DatabaseRevisionList;
107
108        void setDatabasePath(const std::string& path) { _databasePath = path; }
109        const std::string& getDatabasePath() const { return _databasePath; }
110
111        void addRevision(DatabaseRevision* revision);
112        void removeRevision(DatabaseRevision* revision);
113
114        DatabaseRevision* getDatabaseRevision(unsigned int i) { return i<_revisionList.size() ? _revisionList[i].get() : 0; }
115
116        DatabaseRevisionList& getDatabaseRevisionList() { return _revisionList; }
117        const DatabaseRevisionList& getDatabaseRevisionList() const { return _revisionList; }
118
119        bool isFileBlackListed(const std::string& filename) const;
120
121        bool removeFile(const std::string& filename);
122
123    protected:
124
125        virtual ~DatabaseRevisions();
126
127        std::string             _databasePath;
128        DatabaseRevisionList    _revisionList;
129};
130
131}
132
133#endif
Note: See TracBrowser for help on using the browser.