osg::VRMLSceneFileType Class Reference
[File Input/Output]

VRMLSceneFileType.

#include <OSGVRMLSceneFileType.h>

Inheritance diagram for osg::VRMLSceneFileType:
osg::SceneFileType

List of all members.

Public Types

typedef std::vector
< FieldContainerPtr
FCPtrStore
Flags



enum  { OSG_READ_SUPPORTED = 1, OSG_WRITE_SUPPORTED = 2 }

Public Member Functions

Destructor



virtual ~VRMLSceneFileType (void)
Get



virtual const Char8getName (void) const
Read



virtual NodePtr read (std::istream &is, const Char8 *fileNameOrExtension) const
Write



virtual bool write (const NodePtr &node, std::ostream &os, const Char8 *fileNameOrExtension) const
Set



void setOptions (const Char8 *options)
Get



virtual std::list< IDString > & suffixList (void)
bool doOverride (void)
UInt32 getOverridePriority (void)
UInt32 getFlags (void)
const Char8getOptions (void)
Read



virtual NodePtr readFile (const Char8 *fileName) const
Write



virtual bool writeFile (const NodePtr &node, const Char8 *fileName) const
Debug



void print (void)

Static Public Member Functions

Class Get



static VRMLSceneFileTypethe (void)

Protected Member Functions

Constructors



 VRMLSceneFileType (const Char8 *suffixArray[], UInt16 suffixByteCount, bool override, UInt32 overridePriority, UInt32 flags)

Protected Attributes

Member



std::list< IDString_suffixList
bool _override
UInt32 _overridePriority
UInt32 _flags
std::string _options

Static Protected Attributes

Member



static const Char8_suffixA [] = { "wrl" }
static VRMLSceneFileType _the

Private Types

typedef SceneFileType Inherited

Private Member Functions

 VRMLSceneFileType (const VRMLSceneFileType &source)
 prohibit default function (move to 'public' if needed)
void operator= (const VRMLSceneFileType &source)
 prohibit default function (move to 'public' if needed)

Detailed Description

Definition at line 54 of file OSGVRMLSceneFileType.h.


Member Typedef Documentation

Reimplemented from osg::SceneFileType.

Definition at line 59 of file OSGVRMLSceneFileType.h.

Definition at line 123 of file OSGVRMLSceneFileType.h.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
OSG_READ_SUPPORTED 
OSG_WRITE_SUPPORTED 

Definition at line 78 of file OSGSceneFileType.h.

00079     {
00080         OSG_READ_SUPPORTED = 1,
00081         OSG_WRITE_SUPPORTED = 2
00082     };


Constructor & Destructor Documentation

VRMLSceneFileType::~VRMLSceneFileType ( void   )  [virtual]

Definition at line 76 of file OSGVRMLSceneFileType.cpp.

00077 {
00078 }

VRMLSceneFileType::VRMLSceneFileType ( const Char8 suffixArray[],
UInt16  suffixByteCount,
bool  override,
UInt32  overridePriority,
UInt32  flags 
) [protected]

Definition at line 146 of file OSGVRMLSceneFileType.cpp.

00150                                                           :
00151     Inherited(suffixArray,
00152               suffixByteCount,
00153               override,
00154               overridePriority,
00155               flags)
00156 {
00157 }

osg::VRMLSceneFileType::VRMLSceneFileType ( const VRMLSceneFileType source  )  [private]

Member Function Documentation

VRMLSceneFileType & VRMLSceneFileType::the ( void   )  [static]

Definition at line 67 of file OSGVRMLSceneFileType.cpp.

References _the.

00068 {
00069     return _the;
00070 }

const Char8 * VRMLSceneFileType::getName ( void   )  const [virtual]

Implements osg::SceneFileType.

Definition at line 83 of file OSGVRMLSceneFileType.cpp.

00084 {
00085     return "VRML Geometry";
00086 }

NodePtr VRMLSceneFileType::read ( std::istream &  is,
const Char8 fileNameOrExtension 
) const [virtual]

Reimplemented from osg::SceneFileType.

Definition at line 91 of file OSGVRMLSceneFileType.cpp.

References osg::SceneFileType::_options, osg::VRMLFile::createStandardPrototypes(), osg::VRMLFile::getRoot(), osg::NullFC, osg::VRMLFile::PushNames, osg::VRMLFile::scanStream(), and SINFO.

00092 {
00093     SINFO << "Source/System/FileIO/WRL/VRMLSceneFileType::read" << std::endl;
00094 
00095     NodePtr root = NullFC;
00096 
00097     VRMLFile *loader = new VRMLFile();
00098     
00099     // parse options
00100     if(_options.find("pushNames=true") != std::string::npos)
00101         loader->addOptions(VRMLFile::PushNames);
00102     else if(_options.find("pushNames=false") != std::string::npos)
00103         loader->subOptions(VRMLFile::PushNames);
00104     
00105     loader->createStandardPrototypes();
00106     loader->scanStream(is);
00107     root = loader->getRoot();
00108     delete loader;
00109 
00110     return root;
00111 }

bool VRMLSceneFileType::write ( const NodePtr node,
std::ostream &  os,
const Char8 fileNameOrExtension 
) const [virtual]

Reimplemented from osg::SceneFileType.

Definition at line 116 of file OSGVRMLSceneFileType.cpp.

References osg::SceneFileType::_options, osg::VRMLWriteAction::addOptions(), osg::VRMLWriteAction::close(), osg::VRMLWriteAction::create(), osg::VRMLWriteAction::open(), osg::VRMLWriteAction::OSGPixelTextures, osg::VRMLWriteAction::subOptions(), and osg::VRMLWriteAction::write().

00118 {
00119     // This is a hack but should be safer.
00120     std::ofstream *osf = dynamic_cast<std::ofstream *>(&os);
00121     if(osf != NULL)
00122         osf->close();
00123     
00124     VRMLWriteAction *pWriter = VRMLWriteAction::create();
00125 
00126     // parse options
00127     if(_options.find("inlineTextures=true") != std::string::npos)
00128         pWriter->addOptions(VRMLWriteAction::OSGPixelTextures);
00129     else if(_options.find("inlineTextures=false") != std::string::npos)
00130         pWriter->subOptions(VRMLWriteAction::OSGPixelTextures);
00131 
00132     pWriter->open(fileNameOrExtension);
00133 
00134     pWriter->write(node);
00135 
00136     pWriter->close();
00137 
00138     delete pWriter;
00139 
00140     return true;
00141 }

void osg::VRMLSceneFileType::operator= ( const VRMLSceneFileType source  )  [private]

Reimplemented from osg::SceneFileType.

void SceneFileType::setOptions ( const Char8 options  )  [inherited]

Definition at line 115 of file OSGSceneFileType.cpp.

References osg::SceneFileType::_options.

Referenced by osg::SceneFileHandler::setOptions().

00116 {
00117     _options = options;
00118 }

std::list< IDString > & SceneFileType::suffixList ( void   )  [virtual, inherited]
bool SceneFileType::doOverride ( void   )  [inherited]
UInt32 SceneFileType::getOverridePriority ( void   )  [inherited]
UInt32 SceneFileType::getFlags ( void   )  [inherited]

Definition at line 159 of file OSGSceneFileType.cpp.

References osg::SceneFileType::_flags.

Referenced by osg::SceneFileHandler::getSuffixList(), and osg::SceneFileHandler::print().

00160 {
00161     return _flags;
00162 }

const Char8 * SceneFileType::getOptions ( void   )  [inherited]

Definition at line 166 of file OSGSceneFileType.cpp.

References osg::SceneFileType::_options.

Referenced by osg::SceneFileHandler::getOptions().

00167 {
00168     return _options.c_str();
00169 }

NodePtr SceneFileType::readFile ( const Char8 fileName  )  const [virtual, inherited]

Definition at line 181 of file OSGSceneFileType.cpp.

References FWARNING, and osg::NullFC.

Referenced by osg::SceneFileHandler::read().

00182 {
00183     FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));
00184     return NullFC;
00185 }

bool SceneFileType::writeFile ( const NodePtr node,
const Char8 fileName 
) const [virtual, inherited]

Definition at line 197 of file OSGSceneFileType.cpp.

References FWARNING.

Referenced by osg::SceneFileHandler::write().

00199 {
00200     FWARNING (("FILE INTERFACE NOT IMPLEMENTED!\n"));
00201     return false;
00202 }

void SceneFileType::print ( void   )  [inherited]

Definition at line 121 of file OSGSceneFileType.cpp.

References osg::SceneFileType::_suffixList, osg::SceneFileType::getName(), osg::LOG_DEBUG, osg::osgLog(), and osg::Log::stream().

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 }


Member Data Documentation

const Char8 * VRMLSceneFileType::_suffixA = { "wrl" } [static, protected]

Definition at line 105 of file OSGVRMLSceneFileType.h.

Definition at line 106 of file OSGVRMLSceneFileType.h.

Referenced by the().

std::list<IDString> osg::SceneFileType::_suffixList [protected, inherited]
bool osg::SceneFileType::_override [protected, inherited]

Definition at line 154 of file OSGSceneFileType.h.

Referenced by osg::SceneFileType::doOverride().

Definition at line 155 of file OSGSceneFileType.h.

Referenced by osg::SceneFileType::getOverridePriority().

UInt32 osg::SceneFileType::_flags [protected, inherited]

Definition at line 156 of file OSGSceneFileType.h.

Referenced by osg::SceneFileType::getFlags().

std::string osg::SceneFileType::_options [protected, inherited]

The documentation for this class was generated from the following files:

Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1