openddl-parser latest greatest

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>
This commit is contained in:
Kim Kulling
2015-04-16 11:09:54 +02:00
parent 56e8dc5a43
commit 223a5385af
8 changed files with 65 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
/*-----------------------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2014 Kim Kulling
Copyright (c) 2014-2015 Kim Kulling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -138,6 +138,31 @@ Property *DDLNode::getProperties() const {
return m_properties;
}
bool DDLNode::hasProperty( const std::string &name ) {
const Property *prop( findPropertyByName( name ) );
return ( ddl_nullptr != prop );
}
Property *DDLNode::findPropertyByName( const std::string &name ) {
if( name.empty() ) {
return ddl_nullptr;
}
if( ddl_nullptr == m_properties ) {
return ddl_nullptr;
}
Property *current( m_properties );
while( ddl_nullptr != current ) {
int res = strncmp( current->m_id->m_buffer, name.c_str(), name.size() );
if( 0 == res ) {
return current;
}
current = current->m_next;
}
return ddl_nullptr;
}
void DDLNode::setValue( Value *val ) {
m_value = val;
}