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

osg::ScanParseSkel Class Reference

#include <OSGScanParseSkel.h>

Inheritance diagram for osg::ScanParseSkel:

osg::ScanParseSkelBase osg::ScanParseFieldTypeMapper< ScanParseSkel > osg::OSGLoader List of all members.

Member

void reset (void)
void setMapTypeIds (bool bVal)
void setReferenceHeader (const Char8 *szReferenceHeader)
*bool _bMapTypeIds
Char8_szReferenceHeader
OSGScanParseLexer_pLexer

Public Types

enum  BuildInFieldType {
  OSGsfBool = TOK_SFBOOL, OSGsfColor = TOK_SFCOLOR, OSGsfFloat = TOK_SFFLOAT, OSGsfImage = TOK_SFIMAGE,
  OSGsfInt32 = TOK_SFINT32, OSGsfNode = TOK_SFNODE, OSGsfRotation = TOK_SFROTATION, OSGsfString = TOK_SFSTRING,
  OSGsfTime = TOK_SFTIME, OSGsfVec2f = TOK_SFVEC2F, OSGsfVec3f = TOK_SFVEC3F, OSGmfColor = TOK_MFCOLOR,
  OSGmfFloat = TOK_MFFLOAT, OSGmfInt32 = TOK_MFINT32, OSGmfNode = TOK_MFNODE, OSGmfRotation = TOK_MFROTATION,
  OSGmfString = TOK_MFSTRING, OSGmfTime = TOK_MFTIME, OSGmfVec2f = TOK_MFVEC2F, OSGmfVec3f = TOK_MFVEC3F,
  OSGmfColor4f = TOK_MFCOLOR4F, OSGmfColor4i = TOK_MFCOLOR4I, OSGmfColor3f = TOK_MFCOLOR3F, OSGmfMatrix = TOK_MFMATRIX,
  OSGmfPnt2f = TOK_MFPNT2F, OSGmfPnt3f = TOK_MFPNT3F, OSGmfPnt4f = TOK_MFPNT4F, OSGmfVec4f = TOK_MFVEC4F,
  OSGmfPlane = TOK_MFPLANE, OSGsfColor4f = TOK_SFCOLOR4F, OSGsfColor4i = TOK_SFCOLOR4I, OSGsfColor3f = TOK_SFCOLOR3F,
  OSGsfMatrix = TOK_SFMATRIX, OSGsfPnt2f = TOK_SFPNT2F, OSGsfPnt3f = TOK_SFPNT3F, OSGsfPnt4f = TOK_SFPNT4F,
  OSGsfVec4f = TOK_SFVEC4F, OSGsfPlane = TOK_SFPLANE, OSGsfVolume = TOK_SFVOLUME
}
enum  { LastOption = 0x0001 }

Public Member Functions

Constructors
ScanParseSkel (void)
Destructor
*virtual ~ScanParseSkel (void)
Scan
*virtual void scanStream (std::istream &is)
virtual void scanFile (const Char8 *szFilename)
virtual Int32 lex (void)
virtual const Char8getText (void)
void expectType (Int32 iNextType)
virtual void handleError (const Char8 *szErrorText)
Prototypes
*virtual bool verifyHeader (const Char8 *szHeader)
virtual void beginProto (const Char8 *szProtoname)
virtual void endProto (void)
virtual void beginExternProto (const Char8 *szProtoname)
virtual void endExternProtoInterface (void)
virtual void endExternProto (void)
virtual void beginScript (const Char8 *szProtoname)
virtual void endScript (void)
virtual void beginEventInDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName)
virtual void beginEventOutDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName)
virtual void endEventDecl (void)
virtual void beginFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void endFieldDecl (void)
virtual void beginExposedFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void endExposedFieldDecl (void)
virtual void addExternEventInDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName)
virtual void addExternEventOutDecl (const Char8 *szEventType, const UInt32 uiFieldTypeId, const Char8 *szEventName)
virtual void addExternFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void addExternExposedFieldDecl (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
Fields
*virtual void beginField (const Char8 *szFieldname, const UInt32 uiFieldTypeId)
virtual void endField (void)
Nodes
*virtual void beginNode (const Char8 *szNodeTypename, const Char8 *szNodename)
virtual void endNode (void)
virtual void use (const Char8 *szName)
virtual void is (const Char8 *szName)
Misc
*virtual void addFieldValue (const Char8 *szFieldVal)
virtual void addRoute (const Char8 *szOutNodename, const Char8 *szOutFieldname, const Char8 *szInNodename, const Char8 *szInFieldname)
virtual void profileElement (const Char8 *szProfileName)
virtual void componentElement (const Char8 *szComponentName)
virtual void metaElement (const Char8 *szMetaKey, const Char8 *szMetaValue)
virtual void importElement (const Char8 *szInlineName, const Char8 *szNodeName, const Char8 *szImportAs)
virtual void exportElement (const Char8 *szNodeName, const Char8 *szExportAs)
Type Information
*bool getMapFieldTypes (void)
virtual Int32 mapExtIntFieldType (const Char8 *szFieldname, const Int32 iFieldTypeId)
virtual UInt32 getFieldType (const Char8 *szFieldname)

Private Member Functions

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

Detailed Description

Parser / Scanner Skeleton for VRML97 syntax based file formats

Definition at line 62 of file OSGScanParseSkel.h.


Member Enumeration Documentation

enum osg::ScanParseSkel::BuildInFieldType
 

Enumerator:
OSGsfBool 
OSGsfColor 
OSGsfFloat 
OSGsfImage 
OSGsfInt32 
OSGsfNode 
OSGsfRotation 
OSGsfString 
OSGsfTime 
OSGsfVec2f 
OSGsfVec3f 
OSGmfColor 
OSGmfFloat 
OSGmfInt32 
OSGmfNode 
OSGmfRotation 
OSGmfString 
OSGmfTime 
OSGmfVec2f 
OSGmfVec3f 
OSGmfColor4f 
OSGmfColor4i 
OSGmfColor3f 
OSGmfMatrix 
OSGmfPnt2f 
OSGmfPnt3f 
OSGmfPnt4f 
OSGmfVec4f 
OSGmfPlane 
OSGsfColor4f 
OSGsfColor4i 
OSGsfColor3f 
OSGsfMatrix 
OSGsfPnt2f 
OSGsfPnt3f 
OSGsfPnt4f 
OSGsfVec4f 
OSGsfPlane 
OSGsfVolume 

Definition at line 67 of file OSGScanParseSkel.h.

00068     {
00069         OSGsfBool     = TOK_SFBOOL,
00070         OSGsfColor    = TOK_SFCOLOR,
00071         OSGsfFloat    = TOK_SFFLOAT,
00072         OSGsfImage    = TOK_SFIMAGE,
00073         OSGsfInt32    = TOK_SFINT32,
00074         OSGsfNode     = TOK_SFNODE,
00075         OSGsfRotation = TOK_SFROTATION,
00076         OSGsfString   = TOK_SFSTRING,
00077         OSGsfTime     = TOK_SFTIME,
00078         OSGsfVec2f    = TOK_SFVEC2F,
00079         OSGsfVec3f    = TOK_SFVEC3F,
00080         OSGmfColor    = TOK_MFCOLOR,
00081         OSGmfFloat    = TOK_MFFLOAT,
00082         OSGmfInt32    = TOK_MFINT32,
00083         OSGmfNode     = TOK_MFNODE,
00084         OSGmfRotation = TOK_MFROTATION,
00085         OSGmfString   = TOK_MFSTRING,
00086         OSGmfTime     = TOK_MFTIME,
00087         OSGmfVec2f    = TOK_MFVEC2F,
00088         OSGmfVec3f    = TOK_MFVEC3F,
00089 
00090         OSGmfColor4f  = TOK_MFCOLOR4F,
00091         OSGmfColor4i  = TOK_MFCOLOR4I,
00092         OSGmfColor3f  = TOK_MFCOLOR3F,
00093         OSGmfMatrix   = TOK_MFMATRIX,
00094         OSGmfPnt2f    = TOK_MFPNT2F,
00095         OSGmfPnt3f    = TOK_MFPNT3F,
00096         OSGmfPnt4f    = TOK_MFPNT4F,
00097         OSGmfVec4f    = TOK_MFVEC4F,
00098         OSGmfPlane    = TOK_MFPLANE,
00099         OSGsfColor4f  = TOK_SFCOLOR4F,
00100         OSGsfColor4i  = TOK_SFCOLOR4I,
00101         OSGsfColor3f  = TOK_SFCOLOR3F,
00102         OSGsfMatrix   = TOK_SFMATRIX,
00103         OSGsfPnt2f    = TOK_SFPNT2F,
00104         OSGsfPnt3f    = TOK_SFPNT3F,
00105         OSGsfPnt4f    = TOK_SFPNT4F,
00106         OSGsfVec4f    = TOK_SFVEC4F,
00107         OSGsfPlane    = TOK_SFPLANE,
00108         OSGsfVolume   = TOK_SFVOLUME
00109     };

anonymous enum
 

Enumerator:
LastOption 

Definition at line 111 of file OSGScanParseSkel.h.

00112     {
00113         LastOption = 0x0001
00114     };


Constructor & Destructor Documentation

ScanParseSkel::ScanParseSkel void   ) 
 

Definition at line 65 of file OSGScanParseSkel.cpp.

00065                                  :
00066     _bMapTypeIds      (false),
00067     _szReferenceHeader(NULL ),
00068     _pLexer           (NULL )
00069 {
00070 }

ScanParseSkel::~ScanParseSkel void   )  [virtual]
 

Definition at line 75 of file OSGScanParseSkel.cpp.

00076 {
00077 }

osg::ScanParseSkel::ScanParseSkel const ScanParseSkel source  )  [private]
 


Member Function Documentation

void ScanParseSkel::scanStream std::istream &  is  )  [virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 85 of file OSGScanParseSkel.cpp.

References _pLexer, and OSGScanParseSkel_parse().

Referenced by scanFile(), and osg::OSGLoader::scanStream().

00086 {
00087     if(is.good())
00088     {
00089         delete _pLexer;
00090 
00091         _pLexer = new OSGScanParseLexer(this, &is);
00092 
00093         OSGScanParseSkel_parse(this);
00094     }
00095 }

void ScanParseSkel::scanFile const Char8 szFilename  )  [virtual]
 

Definition at line 98 of file OSGScanParseSkel.cpp.

References is(), OSGScanParseSkel_parse(), PNOTICE, and scanStream().

00099 {
00100     if(szFilename == NULL)
00101         return;
00102 
00103 #ifdef OSG_FLEX_USE_IOSTREAM_INPUT
00104     std::ifstream is(szFilename);
00105 
00106     if(is.good())
00107     {
00108         PNOTICE << "Loading Stream: " << szFilename << std::endl;
00109 
00110         scanStream(is);
00111 
00112         is.close();
00113     }
00114 #else
00115     FILE *pInFile = fopen(szFilename, "r");
00116 
00117     if(pInFile != NULL)
00118     {
00119         PNOTICE << "Loading File : " << szFilename << std::endl;
00120 
00121         OSGScanParseSkel_in = pInFile;
00122 
00123         OSGScanParseSkel_parse(this);
00124 
00125         fclose(pInFile);
00126     }
00127 #endif
00128 }

Int32 ScanParseSkel::lex void   )  [virtual]
 

Definition at line 130 of file OSGScanParseSkel.cpp.

References _pLexer, and OSGScanParseLexer::yylex().

00131 {
00132     Int32 returnValue = -1;
00133 
00134     if(_pLexer != NULL)
00135         returnValue = _pLexer->yylex();
00136 
00137     return returnValue;
00138 }

const Char8 * ScanParseSkel::getText void   )  [virtual]
 

Definition at line 140 of file OSGScanParseSkel.cpp.

References _pLexer.

00141 {
00142     const Char8 *returnValue = NULL;
00143 
00144     if(_pLexer != NULL)
00145         returnValue = _pLexer->YYText();
00146 
00147     return returnValue;
00148 }

void ScanParseSkel::expectType Int32  iNextType  ) 
 

Definition at line 150 of file OSGScanParseSkel.cpp.

References _pLexer, and OSGScanParseLexer::expectType().

00151 {
00152     if(_pLexer != NULL)
00153         _pLexer->expectType(iNextType);
00154 }

void ScanParseSkel::handleError const Char8 szErrorText  )  [virtual]
 

Implements osg::ScanParseSkelBase.

Definition at line 157 of file OSGScanParseSkel.cpp.

References _pLexer, and FWARNING.

00158 {
00159     FWARNING(("-----> %s in Line %d, read\n", 
00160               szErrorText, 
00161               _pLexer->lineno(), 
00162               _pLexer->YYText()));
00163 }

bool ScanParseSkel::verifyHeader const Char8 szHeader  )  [virtual]
 

Implements osg::ScanParseSkelBase.

Definition at line 168 of file OSGScanParseSkel.cpp.

References _szReferenceHeader, SLOG, and osg::stringlen().

00169 {
00170     bool returnValue = true;
00171 
00172     if(szHeader == NULL)
00173     {
00174         SLOG << "Error Null Header String Read" << std::endl;
00175         return false;
00176     }
00177 
00178     if(_szReferenceHeader != NULL)
00179     {
00180         if(strncmp(szHeader,
00181                    _szReferenceHeader,
00182                    stringlen(_szReferenceHeader)) != 0)
00183         {
00184             SLOG << "Error : Header [" << szHeader << "] does not "
00185                     << "match reference [" << _szReferenceHeader << "]"
00186                     << std::endl;
00187 
00188             returnValue = false;
00189         }
00190     }
00191     else
00192     {
00193         SLOG << "Error Null Reference Header, Check disabled " << std::endl;
00194         return true;
00195     }
00196 
00197     return returnValue;
00198 }

void ScanParseSkel::beginProto const Char8 szProtoname  )  [virtual]
 

Definition at line 200 of file OSGScanParseSkel.cpp.

00201 {
00202 }

void ScanParseSkel::endProto void   )  [virtual]
 

Definition at line 204 of file OSGScanParseSkel.cpp.

00205 {
00206 }

void ScanParseSkel::beginExternProto const Char8 szProtoname  )  [virtual]
 

Definition at line 208 of file OSGScanParseSkel.cpp.

00209 {
00210 }

void ScanParseSkel::endExternProtoInterface void   )  [virtual]
 

Definition at line 212 of file OSGScanParseSkel.cpp.

00213 {
00214 }

void ScanParseSkel::endExternProto void   )  [virtual]
 

Definition at line 216 of file OSGScanParseSkel.cpp.

00217 {
00218 }

void ScanParseSkel::beginScript const Char8 szProtoname  )  [virtual]
 

Definition at line 220 of file OSGScanParseSkel.cpp.

00221 {
00222 }

void ScanParseSkel::endScript void   )  [virtual]
 

Definition at line 224 of file OSGScanParseSkel.cpp.

00225 {
00226 }

void ScanParseSkel::beginEventInDecl const Char8 szEventType,
const UInt32  uiFieldTypeId,
const Char8 szEventName
[virtual]
 

Definition at line 228 of file OSGScanParseSkel.cpp.

00231 {
00232 }

void ScanParseSkel::beginEventOutDecl const Char8 szEventType,
const UInt32  uiFieldTypeId,
const Char8 szEventName
[virtual]
 

Definition at line 234 of file OSGScanParseSkel.cpp.

00237 {
00238 }

void ScanParseSkel::endEventDecl void   )  [virtual]
 

Definition at line 240 of file OSGScanParseSkel.cpp.

00241 {
00242 }

void ScanParseSkel::beginFieldDecl const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName
[virtual]
 

Definition at line 244 of file OSGScanParseSkel.cpp.

00247 {
00248 }

void ScanParseSkel::endFieldDecl void   )  [virtual]
 

Definition at line 250 of file OSGScanParseSkel.cpp.

00251 {
00252 }

void ScanParseSkel::beginExposedFieldDecl const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName
[virtual]
 

Definition at line 254 of file OSGScanParseSkel.cpp.

00257 {
00258 }

void ScanParseSkel::endExposedFieldDecl void   )  [virtual]
 

Definition at line 260 of file OSGScanParseSkel.cpp.

00261 {
00262 }

void ScanParseSkel::addExternEventInDecl const Char8 szEventType,
const UInt32  uiFieldTypeId,
const Char8 szEventName
[virtual]
 

Definition at line 265 of file OSGScanParseSkel.cpp.

00268 {
00269 }

void ScanParseSkel::addExternEventOutDecl const Char8 szEventType,
const UInt32  uiFieldTypeId,
const Char8 szEventName
[virtual]
 

Definition at line 271 of file OSGScanParseSkel.cpp.

00274 {
00275 }

void ScanParseSkel::addExternFieldDecl const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName
[virtual]
 

Definition at line 277 of file OSGScanParseSkel.cpp.

00280 {
00281 }

void ScanParseSkel::addExternExposedFieldDecl const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName
[virtual]
 

Definition at line 283 of file OSGScanParseSkel.cpp.

00286 {
00287 }

void ScanParseSkel::beginField const Char8 szFieldname,
const UInt32  uiFieldTypeId
[virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 292 of file OSGScanParseSkel.cpp.

00294 {
00295 }

void ScanParseSkel::endField void   )  [virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 297 of file OSGScanParseSkel.cpp.

00298 {
00299 }

void ScanParseSkel::beginNode const Char8 szNodeTypename,
const Char8 szNodename
[virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 304 of file OSGScanParseSkel.cpp.

00306 {
00307     fprintf(stderr, "Calling default begin node %s %s\n",
00308             szNodeTypename,
00309             szNodename);
00310 }

void ScanParseSkel::endNode void   )  [virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 312 of file OSGScanParseSkel.cpp.

00313 {
00314 }

void ScanParseSkel::use const Char8 szName  )  [virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 316 of file OSGScanParseSkel.cpp.

References PINFO.

00317 {
00318     PINFO << "Use : " << szName << std::endl;
00319 }

void ScanParseSkel::is const Char8 szName  )  [virtual]
 

Definition at line 321 of file OSGScanParseSkel.cpp.

Referenced by scanFile().

00322 {
00323 }

void ScanParseSkel::addFieldValue const Char8 szFieldVal  )  [virtual]
 

Implements osg::ScanParseSkelBase.

Reimplemented in osg::OSGLoader.

Definition at line 358 of file OSGScanParseSkel.cpp.

00359 {
00360 }

void ScanParseSkel::addRoute const Char8 szOutNodename,
const Char8 szOutFieldname,
const Char8 szInNodename,
const Char8 szInFieldname
[virtual]
 

Definition at line 362 of file OSGScanParseSkel.cpp.

00366 {
00367 }

void ScanParseSkel::profileElement const Char8 szProfileName  )  [virtual]
 

Definition at line 325 of file OSGScanParseSkel.cpp.

00326 {
00327     fprintf(stderr, "PROFILE %s\n", szProfileName);
00328 }

void ScanParseSkel::componentElement const Char8 szComponentName  )  [virtual]
 

Definition at line 330 of file OSGScanParseSkel.cpp.

00331 {
00332     fprintf(stderr, "COMPONENT %s\n", szComponentName);
00333 }

void ScanParseSkel::metaElement const Char8 szMetaKey,
const Char8 szMetaValue
[virtual]
 

Definition at line 335 of file OSGScanParseSkel.cpp.

00337 {
00338     fprintf(stderr, "META %s %s\n", szMetaKey, szMetaValue);
00339 }

void ScanParseSkel::importElement const Char8 szInlineName,
const Char8 szNodeName,
const Char8 szImportAs
[virtual]
 

Definition at line 341 of file OSGScanParseSkel.cpp.

00344 {
00345     fprintf(stderr, "IMPORT %s.%s AS %s\n", 
00346                     szInlineName, szNodeName, szImportAs);
00347 }

void ScanParseSkel::exportElement const Char8 szNodeName,
const Char8 szExportAs
[virtual]
 

Definition at line 349 of file OSGScanParseSkel.cpp.

00351 {
00352     fprintf(stderr, "EXPORT %s AS %s\n", szNodeName, szExportAs);
00353 }

bool ScanParseSkel::getMapFieldTypes void   ) 
 

Definition at line 372 of file OSGScanParseSkel.cpp.

References _bMapTypeIds.

00373 {
00374     return _bMapTypeIds;
00375 }

Int32 ScanParseSkel::mapExtIntFieldType const Char8 szFieldname,
const Int32  iFieldTypeId
[virtual]
 

Reimplemented in osg::OSGLoader, and osg::ScanParseFieldTypeMapper< ScanParseSkel >.

Definition at line 377 of file OSGScanParseSkel.cpp.

00378 {
00379     return iFieldType;
00380 }

UInt32 ScanParseSkel::getFieldType const Char8 szFieldname  )  [virtual]
 

Reimplemented in osg::OSGLoader.

Definition at line 382 of file OSGScanParseSkel.cpp.

00383 {
00384     return 0;
00385 }

void ScanParseSkel::reset void   )  [protected]
 

Definition at line 390 of file OSGScanParseSkel.cpp.

00391 {
00392 }

void ScanParseSkel::setMapTypeIds bool  bVal  )  [protected]
 

Definition at line 394 of file OSGScanParseSkel.cpp.

References _bMapTypeIds.

00395 {
00396     _bMapTypeIds = bVal;
00397 }

void ScanParseSkel::setReferenceHeader const Char8 szReferenceHeader  )  [protected]
 

Definition at line 399 of file OSGScanParseSkel.cpp.

References _szReferenceHeader, and osg::stringDup().

Referenced by osg::OSGLoader::OSGLoader().

00400 {
00401     stringDup(szReferenceHeader, _szReferenceHeader);
00402 }

void osg::ScanParseSkel::operator= const ScanParseSkel source  )  [private]
 


Member Data Documentation

* bool osg::ScanParseSkel::_bMapTypeIds [protected]
 

Definition at line 272 of file OSGScanParseSkel.h.

Referenced by getMapFieldTypes(), and setMapTypeIds().