00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
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
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 }