Work in progress: VRML2 parser
This commit is contained in:
parent
735137a26a
commit
b1177e9025
|
@ -206,7 +206,13 @@ bool WRL2BASE::Read( WRLPROC& proc )
|
|||
|
||||
if( !glob.compare( "PROTO" ) )
|
||||
{
|
||||
// XXX - implement
|
||||
if( !proc.ReadName( glob ) || !proc.ReadName( glob ) || !proc.DiscardList() )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << proc.GetError() << "\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if( !glob.compare( "EXTERNPROTO" ) )
|
||||
|
@ -326,3 +332,9 @@ bool WRL2BASE::Read( WRLPROC& proc )
|
|||
#warning TO BE IMPLEMENTED
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2BASE::isDangling( void )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
// functions inherited from WRL2NODE
|
||||
void unlinkChildNode( const WRL2NODE* aNode );
|
||||
void unlinkRefNode( const WRL2NODE* aNode );
|
||||
bool isDangling( void );
|
||||
|
||||
public:
|
||||
WRL2BASE();
|
||||
|
|
|
@ -266,3 +266,9 @@ WRL2NODES WRL2NODE::getNodeTypeID( const std::string aNodeName )
|
|||
|
||||
return WRL2_INVALID;
|
||||
}
|
||||
|
||||
|
||||
const char* WRL2NODE::GetError( void )
|
||||
{
|
||||
return m_error.c_str();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ protected:
|
|||
std::string m_Name; // name to use for referencing the node by name
|
||||
|
||||
std::list< WRL2NODE* > m_BackPointers; // nodes which hold a reference to this
|
||||
std::string m_error;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -107,6 +108,15 @@ public:
|
|||
*/
|
||||
void delNodeRef( WRL2NODE* aNode );
|
||||
|
||||
/**
|
||||
* Function isDangling
|
||||
* returns true if the object does not have a parent which is a logical
|
||||
* container for the object - for example if a Shape has a parent which
|
||||
* is a Base node. This function is used to determine whether an object
|
||||
* should be moved to a different parent during the VRML to SG* translation.
|
||||
*/
|
||||
virtual bool isDangling( void ) = 0;
|
||||
|
||||
public:
|
||||
WRL2NODE();
|
||||
virtual ~WRL2NODE();
|
||||
|
@ -157,6 +167,8 @@ public:
|
|||
virtual bool AddRefNode( WRL2NODE* aNode ) = 0;
|
||||
|
||||
virtual bool AddChildNode( WRL2NODE* aNode ) = 0;
|
||||
|
||||
const char* GetError( void );
|
||||
};
|
||||
|
||||
#endif // VRML2_NODE_H
|
||||
|
|
|
@ -292,8 +292,25 @@ bool WRLPROC::ReadName( std::string& aName )
|
|||
|
||||
while( m_buf[m_linepos] > 0x20 && m_linepos < ssize )
|
||||
{
|
||||
if( '[' == m_buf[m_linepos] || '{' == m_buf[m_linepos] )
|
||||
if( '[' == m_buf[m_linepos] || '{' == m_buf[m_linepos]
|
||||
|| '.' == m_buf[m_linepos] || '#' == m_buf[m_linepos] )
|
||||
{
|
||||
if( !aName.empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ":" << __FUNCTION__ << ":" << __LINE__ << "\n";
|
||||
ostr << " * [INFO] failed on file '" << m_filename << "'\n";
|
||||
ostr << " * [INFO] line " << m_fileline << ", column " << m_linepos;
|
||||
ostr << " -- invalid name";
|
||||
m_error = ostr.str();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_badchars.find( m_buf[m_linepos] ) != std::string::npos )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue