void Message::setGroup( const std::string& msg, const FieldBase& field, const std::string& string, std::string::size_type& pos, FieldMap& map, const DataDictionary& dataDictionary ) { int group = field.getTag(); int delim; const DataDictionary* pDD = 0; if ( !dataDictionary.getGroup( msg, group, delim, pDD ) ) return ; std::unique_ptr<Group> pGroup; while ( pos < string.size() ) { std::string::size_type oldPos = pos; FieldBase field = extractField( string, pos, &dataDictionary, &dataDictionary, pGroup.get() ); // Start a new group because... if (// found delimiter (field.getTag() == delim) || // no delimiter, but field belongs to group OR field already processed (pDD->isField( field.getTag() ) && (pGroup.get() == 0 || pGroup->isSetField( field.getTag() )) )) { if ( pGroup.get() ) { map.addGroupPtr( group, pGroup.release(), false ); } pGroup.reset( new Group( field.getTag(), delim, pDD->getOrderedFields() ) ); } else if ( !pDD->isField( field.getTag() ) ) { if ( pGroup.get() ) { map.addGroupPtr( group, pGroup.release(), false ); } pos = oldPos; return ; } if ( !pGroup.get() ) return ; pGroup->setField( field, false ); setGroup( msg, field, string, pos, *pGroup, *pDD ); } }