Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGSceneFileType.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 
00040 //---------------------------------------------------------
00041 //  Includes
00042 //---------------------------------------------------------
00043 
00044 #include <stdlib.h>
00045 #include <stdio.h>
00046 
00047 #include <fstream>
00048 
00049 #include "OSGConfig.h"
00050 
00051 #include <OSGLog.h>
00052 
00053 #if 0
00054 #include <OSGImageFileHandler.h>
00055 #include <OSGPathHandler.h>
00056 #endif
00057 
00058 #include "OSGSceneFileType.h"
00059 #include "OSGSceneFileHandler.h"
00060 
00061 OSG_USING_NAMESPACE
00062 
00063 
00069 //---------------------------------------------------------
00070 
00071 SceneFileType::SceneFileType(const Char8  *suffixArray[],
00072                                    UInt16  suffixByteCount,
00073                                    bool    override,
00074                                    UInt32  overridePriority,
00075                                    UInt32  flags) :
00076     _suffixList      (                ),
00077     _override        (override        ),
00078     _overridePriority(overridePriority),
00079     _flags           (flags           ),
00080     _options         (                )
00081 {
00082     FINFO(( "Init %s Scene File Type %d\n", suffixArray[0], this ));
00083 
00084     int count = (suffixByteCount / sizeof(const Char8 *)), i = 0;
00085 
00086     std::list<IDString>::iterator sI;
00087 
00088     _suffixList.resize(count);
00089     for (sI = _suffixList.begin(); sI != _suffixList.end(); sI++)
00090         sI->set(suffixArray[i++]);
00091 
00092     SceneFileHandler::addSceneFileType(*this);
00093 }
00094 
00095 //---------------------------------------------------------
00096 SceneFileType::SceneFileType(const SceneFileType &obj) :
00097     _suffixList      (obj._suffixList      ),
00098     _override        (obj._override        ),
00099     _overridePriority(obj._overridePriority),
00100     _flags           (obj._flags),
00101     _options         (obj._options)
00102 {
00103     SWARNING << "In SceneFileType copy constructor" << std::endl;
00104 }
00105 
00106 //---------------------------------------------------------
00107 SceneFileType::~SceneFileType(void)
00108 {
00109     SceneFileHandler::subSceneFileType(*this);
00110     return;
00111 }
00112 
00113 //---------------------------------------------------------
00114 
00115 void SceneFileType::setOptions(const Char8 *options)
00116 {
00117     _options = options;
00118 }
00119 
00120 //---------------------------------------------------------
00121 void SceneFileType::print(void)
00122 {
00123     std::list<IDString>::iterator sI;
00124 
00125     osgLog() << getName();
00126 
00127     if (_suffixList.empty())
00128         osgLog() << "NONE";
00129     else
00130         for (sI = _suffixList.begin(); sI != _suffixList.end(); sI++)
00131             osgLog().stream(OSG::LOG_DEBUG) << sI->str() << " ";
00132 
00133     osgLog() << std::endl;
00134 }
00135 
00136 //---------------------------------------------------------
00137 
00138 std::list<IDString> &SceneFileType::suffixList(void)
00139 {
00140     return _suffixList;
00141 }
00142 
00143 //---------------------------------------------------------
00144 
00145 bool SceneFileType::doOverride(void)
00146 {
00147     return _override;
00148 }
00149 
00150 //---------------------------------------------------------
00151 
00152 UInt32 SceneFileType::getOverridePriority(void)
00153 {
00154     return _overridePriority;
00155 }
00156 
00157 //---------------------------------------------------------
00158 
00159 UInt32 SceneFileType::getFlags(void)
00160 {
00161     return _flags;
00162 }
00163 
00164 //---------------------------------------------------------
00165 
00166 const Char8 *SceneFileType::getOptions(void)
00167 {
00168     return _options.c_str();
00169 }
00170 
00171 //---------------------------------------------------------
00172 
00173 NodePtr SceneFileType::read(std::istream & OSG_CHECK_ARG(is),
00174                             const Char8 * OSG_CHECK_ARG(fileNameOrExtension)) const
00175 {
00176     FWARNING (("STREAM INTERFACE NOT IMPLEMENTED!\n"));
00177     return NullFC;
00178 }
00179 
00180 #ifndef OSG_DISABLE_DEPRECATED
00181 NodePtr SceneFileType::readFile(const Char8 * OSG_CHECK_ARG(fileName)) const
00182 {
00183     FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));
00184     return NullFC;
00185 }
00186 #endif
00187 
00188 bool SceneFileType::write(const NodePtr & OSG_CHECK_ARG(node),
00189                           std::ostream & OSG_CHECK_ARG(os),
00190                           const Char8 * OSG_CHECK_ARG(fileNameOrExtension)) const
00191 {
00192     FWARNING (("STREAM INTERFACE NOT IMPLEMENTED!\n"));
00193     return false;
00194 }
00195 
00196 #ifndef OSG_DISABLE_DEPRECATED
00197 bool SceneFileType::writeFile(const NodePtr & OSG_CHECK_ARG(node),
00198                               const Char8 *OSG_CHECK_ARG(fileName)) const
00199 {
00200     FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));
00201     return false;
00202 }
00203 #endif
00204 
00205 /*-------------------------------------------------------------------------*/
00206 /*                              cvs id's                                   */
00207 
00208 #ifdef __sgi
00209 #pragma set woff 1174
00210 #endif
00211 
00212 #ifdef OSG_LINUX_ICC
00213 #pragma warning( disable : 177 )
00214 #endif
00215 
00216 namespace
00217 {
00218     static Char8 cvsid_cpp[] = "@(#)$Id: $";
00219     static Char8 cvsid_hpp[] = OSGSCENEFILETYPE_HEADER_CVSID;
00220 }

Generated on Thu Aug 25 04:09:07 2005 for OpenSG by  doxygen 1.4.3