fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / Base / OSGSceneFileType.h
blob87759b3c19543e9c8fab45ed898f683d8bab9732
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGSCENEFILETYPE_H_
40 #define _OSGSCENEFILETYPE_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGIOFileTypeBase.h"
46 #include "OSGSystemDef.h"
47 #include "OSGBaseTypes.h"
48 #include "OSGNode.h"
50 #include <list>
51 #include <iostream>
52 #include <string>
54 OSG_BEGIN_NAMESPACE
56 class SceneFileHandlerBase;
58 /*! \brief OSGSceneFileType
59 \ingroup GrpSystemFileIOBase
60 \ingroup GrpLibOSGSystem
63 class OSG_SYSTEM_DLLMAPPING SceneFileType : public IOFileTypeBase
65 /*========================== PUBLIC =================================*/
67 public:
69 /*---------------------------------------------------------------------*/
70 /*! \name Public Types */
71 /*! \{ */
73 typedef IOFileTypeBase Inherited;
74 typedef SceneFileType Self;
76 typedef boost::function<FieldContainer *(const Char8 *,
77 FieldContainer *,
78 Int32 )> Resolver;
80 /*! \} */
81 /*---------------------------------------------------------------------*/
82 /*! \name Class Get */
83 /*! \{ */
85 virtual const Char8 *getName(void) const = 0;
87 /*! \} */
88 /*---------------------------------------------------------------------*/
89 /*! \name Destructors */
90 /*! \{ */
92 virtual ~SceneFileType(void);
94 /*! \} */
95 /*---------------------------------------------------------------------*/
96 /*! \name Get */
97 /*! \{ */
99 virtual std::list<std::string> &suffixList (void);
101 bool doOverride (void);
102 UInt32 getOverridePriority(void);
104 /*! \} */
105 /*---------------------------------------------------------------------*/
106 /*! \name Read */
107 /*! \{ */
109 virtual NodeTransitPtr read ( std::istream &is,
110 const Char8 *fileNameOrExtension,
111 Resolver resolver = NULL) const;
113 #ifndef OSG_DISABLE_DEPRECATED
114 virtual NodeTransitPtr readFile(const Char8 *fileName) const;
115 #endif
117 /*! \} */
118 /*---------------------------------------------------------------------*/
119 /*! \name Write */
120 /*! \{ */
122 virtual bool write (Node * const node,
123 std::ostream &os,
124 Char8 const *fileNameOrExtension) const;
126 #ifndef OSG_DISABLE_DEPRECATED
127 virtual bool writeFile(Node * const node,
128 Char8 const *fileName ) const;
129 #endif
131 /*! \} */
132 /*---------------------------------------------------------------------*/
133 /*! \name Debug */
134 /*! \{ */
136 void print(void);
138 /*! \} */
139 /*========================= PROTECTED ===============================*/
141 protected:
143 /*---------------------------------------------------------------------*/
144 /*! \name Member */
145 /*! \{ */
147 /*! List of valid suffixes for this loader. */
148 std::list<std::string> _suffixList;
150 /*! If true loader can override others. */
151 bool _override;
152 /*! The priority for overriding. */
153 UInt32 _overridePriority;
155 /*! \} */
156 /*---------------------------------------------------------------------*/
157 /*! \name Constructors */
158 /*! \{ */
160 SceneFileType(const Char8 *suffixArray[],
161 UInt16 suffixByteCount,
162 bool override,
163 UInt32 overridePriority,
164 UInt32 flags = OSG_READ_SUPPORTED);
166 SceneFileType(const SceneFileType &obj);
168 /*! \} */
169 /*---------------------------------------------------------------------*/
170 /*! \name Termination */
171 /*! \{ */
173 virtual void terminate(void);
175 /*! \} */
176 /*========================== PRIVATE ================================*/
178 private:
180 friend class SceneFileHandlerBase;
182 /*!\brief prohibit default function (move to 'public' if needed) */
183 void operator =(const SceneFileType &source);
186 typedef SceneFileType* SceneFileTypeP;
188 OSG_END_NAMESPACE
190 #endif // _OSGSCENEFILETYPE_H_