Skip to content
Snippets Groups Projects
Unverified Commit 76d4ba56 authored by Jan Trávníček's avatar Jan Trávníček Committed by Tomáš Pecka
Browse files

str: fix searching for a string parser group

parent a5cc7e9e
No related branches found
No related tags found
1 merge request!192Some backlog changes from g++-11 adaptation attempts
......@@ -32,9 +32,25 @@ std::shared_ptr < abstraction::OperationAbstraction > StringReaderRegistry::getA
return entry.first ( ss );
};
 
const auto & entryIterator = getEntries ( ).find ( group );
if ( entryIterator == getEntries ( ).end ( ) )
throw exception::CommonException ( "Entry " + group + " not available." );
auto entryIterator = getEntries ( ).end ( );
for ( auto iter = getEntries ( ).begin ( ); iter != getEntries ( ).end ( ); ++ iter )
if ( ext::is_same_type ( group, iter->first ) ) {
if ( entryIterator == getEntries ( ).end ( ) )
entryIterator = iter;
else
throw std::invalid_argument ( "Entry " + group + " is ambigous." );
}
if ( entryIterator == getEntries ( ).end ( ) ) {
std::stringstream entryList;
bool first = true;
for ( const auto & entry : getEntries ( ) ) {
entryList << ( ( ! first ) ? ", " : "" ) << entry.first;
first = false;
}
throw exception::CommonException ( "Entry " + group + " not available. Available entries are: " + entryList.str ( ) );
}
 
const auto & entries = entryIterator->second;
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment