From e9dcad418183e0786613a97d424e3ad607401d22 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 31 Jan 2015 21:23:50 +0100 Subject: [PATCH] openddl-parser: latest greatest. Signed-off-by: Kim Kulling --- contrib/openddlparser/code/DDLNode.cpp | 8 -------- contrib/openddlparser/code/OpenDDLParser.cpp | 12 +++++++----- .../openddlparser/include/openddlparser/DDLNode.h | 2 -- .../include/openddlparser/OpenDDLCommon.h | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/contrib/openddlparser/code/DDLNode.cpp b/contrib/openddlparser/code/DDLNode.cpp index 94e8eb4d7..d7c034ba1 100644 --- a/contrib/openddlparser/code/DDLNode.cpp +++ b/contrib/openddlparser/code/DDLNode.cpp @@ -116,14 +116,6 @@ const std::string &DDLNode::getName() const { return m_name; } -void DDLNode::setProperties( Property *first ) { - m_properties = first; -} - -Property *DDLNode::getProperties() const { - return m_properties; -} - void DDLNode::setValue( Value *val ) { m_value = val; } diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index 0acd9dd39..66f55f057 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -72,7 +72,7 @@ static bool isIntegerType( Value::ValueType integerType ) { return true; } -static DDLNode *createDDLNode( Identifier *id, Property *first, OpenDDLParser *parser ) { +static DDLNode *createDDLNode( Identifier *id, OpenDDLParser *parser ) { if( nullptr == id || ddl_nullptr == parser ) { return ddl_nullptr; } @@ -80,9 +80,6 @@ static DDLNode *createDDLNode( Identifier *id, Property *first, OpenDDLParser *p const std::string type( id->m_buffer ); DDLNode *parent( parser->top() ); DDLNode *node = DDLNode::create( type, "", parent ); - if( ddl_nullptr != first ) { - node->setProperties( first ); - } return node; } @@ -254,8 +251,13 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { in++; } + // set the properties + if( ddl_nullptr != first ) { + m_context->setProperties( first ); + } + // store the node - DDLNode *node( createDDLNode( id, first, this ) ); + DDLNode *node( createDDLNode( id, this ) ); if( nullptr != node ) { pushNode( node ); } else { diff --git a/contrib/openddlparser/include/openddlparser/DDLNode.h b/contrib/openddlparser/include/openddlparser/DDLNode.h index ceaff3d5e..85b542b5e 100644 --- a/contrib/openddlparser/include/openddlparser/DDLNode.h +++ b/contrib/openddlparser/include/openddlparser/DDLNode.h @@ -55,8 +55,6 @@ public: const std::string &getType() const; void setName( const std::string &name ); const std::string &getName() const; - void setProperties( Property *first ); - Property *getProperties() const; void setValue( Value *val ); Value *getValue() const; void setDataArrayList( DataArrayList *dtArrayList ); diff --git a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h index 4a3c16782..65530c866 100644 --- a/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h +++ b/contrib/openddlparser/include/openddlparser/OpenDDLCommon.h @@ -141,8 +141,22 @@ struct Context { , m_root( ddl_nullptr ) { // empty } + + void setProperties( Property *first ); + Property *getProperties() const; }; + +inline +void Context::setProperties( Property *first ) { + m_properties = first; +} + +inline +Property *Context::getProperties() const { + return m_properties; +} + END_ODDLPARSER_NS #define ODDL_NO_COPYING( classname ) \