1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
40 //---------------------------------------------------------
42 //---------------------------------------------------------
49 #include "OSGConfig.h"
53 #include "OSGSceneFileType.h"
54 #include "OSGSceneFileHandler.h"
55 #include "OSGBaseInitFunctions.h"
60 /*! \class SceneFileType
62 Base class for all file loaders.
65 //---------------------------------------------------------
67 /*! Constructor for SceneFileType.
69 \param[in] suffixArray Raw char buffer of supported suffix values.
70 \param[in] suffixByteCount Length of suffix strings to extract.
72 \param[in] overridePriority Priority of this file handler in overload
74 \param[in] flags Combination of OSG_READ_SUPPORTED and
75 OSG_WRITE_SUPPORTED to say what this handler supports.
78 SceneFileType::SceneFileType(const Char8
*suffixArray
[],
79 UInt16 suffixByteCount
,
81 UInt32 overridePriority
,
85 _override (override
),
86 _overridePriority(overridePriority
)
88 FINFO(( "Init %s Scene File Type %p\n",
89 suffixArray
[0], static_cast<void *>(this)));
91 int count
= (suffixByteCount
/ sizeof(const Char8
*)), i
= 0;
93 std::list
<std::string
>::iterator sI
;
95 _suffixList
.resize(count
);
97 for(sI
= _suffixList
.begin(); sI
!= _suffixList
.end(); sI
++)
99 sI
->assign(suffixArray
[i
++]);
102 SceneFileHandler::the()->addSceneFileType(*this);
105 //---------------------------------------------------------
110 SceneFileType::SceneFileType(const SceneFileType
&obj
) :
112 _suffixList (obj
._suffixList
),
113 _override (obj
._override
),
114 _overridePriority(obj
._overridePriority
)
116 SWARNING
<< "In SceneFileType copy constructor" << std::endl
;
119 //---------------------------------------------------------
120 SceneFileType::~SceneFileType(void)
122 if(GlobalSystemState
< OSG::Shutdown
)
123 SceneFileHandler::the()->subSceneFileType(*this);
126 void SceneFileType::terminate(void)
130 //---------------------------------------------------------
131 /*! Print supported suffixes to osgLog. */
132 void SceneFileType::print(void)
134 std::list
<std::string
>::iterator sI
;
136 osgLog() << getName();
138 if (_suffixList
.empty())
144 for (sI
= _suffixList
.begin(); sI
!= _suffixList
.end(); sI
++)
146 osgLog().stream(OSG::LOG_DEBUG
) << sI
->c_str() << " ";
149 osgLog() << std::endl
;
152 //---------------------------------------------------------
153 /*! Return list of supported suffix strings. */
154 std::list
<std::string
> &SceneFileType::suffixList(void)
159 //---------------------------------------------------------
161 bool SceneFileType::doOverride(void)
166 //---------------------------------------------------------
168 UInt32
SceneFileType::getOverridePriority(void)
170 return _overridePriority
;
173 //---------------------------------------------------------
175 NodeTransitPtr
SceneFileType::read(
180 FWARNING (("STREAM INTERFACE NOT IMPLEMENTED!\n"));
182 return NodeTransitPtr(NULL
);
185 #ifndef OSG_DISABLE_DEPRECATED
186 NodeTransitPtr
SceneFileType::readFile(const Char8
*) const
188 FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));
190 return NodeTransitPtr(NULL
);
194 bool SceneFileType::write(
195 Node
* const OSG_CHECK_ARG(node
),
196 std::ostream
&OSG_CHECK_ARG(os
),
197 Char8
const *OSG_CHECK_ARG(fileNameOrExtension
)) const
199 FWARNING (("STREAM INTERFACE NOT IMPLEMENTED!\n"));
203 #ifndef OSG_DISABLE_DEPRECATED
204 bool SceneFileType::writeFile(Node
* const OSG_CHECK_ARG(node
),
205 Char8
const *OSG_CHECK_ARG(fileName
)) const
207 FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));