Logo Search packages:      
Sourcecode: ktechlab version File versions

MessageInfo Language::extractMessageInfo ( const QString &  text  )  [protected, virtual, inherited]

Examines the string for the line number if applicable, and creates a new MessageInfo for it.

Reimplemented in Gpdasm, Gplib, and Gplink.

Definition at line 99 of file language.cpp.

{
      if ( !text.startsWith("/") )
            return MessageInfo();
      
      const int index = text.find( ":", 0, false );
      if ( index == -1 )
            return MessageInfo();
      const QString fileName = text.left(index);
      
      // Extra line number
      const QString message = text.right(text.length()-index);
      const int linePos = message.find( QRegExp(":[\\d]+") );
      int line = -1;
      if ( linePos != -1 )
      {
            const int linePosEnd = message.find( ':', linePos+1 );
            if ( linePosEnd != -1 )
            {
                  const QString number = message.mid( linePos+1, linePosEnd-linePos-1 ).stripWhiteSpace();
                  bool ok;
                  line = number.toInt(&ok)-1;
                  if (!ok) line = -1;
            }
      }
      return MessageInfo( fileName, line );
}


Generated by  Doxygen 1.6.0   Back to index