enum Kompare::Format PerforceParser::determineFormat() { qCDebug(LIBKOMPAREDIFF2) << "Determining the format of the Perforce Diff"; QRegExp unifiedRE( "^@@" ); QRegExp contextRE( "^\\*{15}" ); QRegExp normalRE ( "^\\d+(|,\\d+)[acd]\\d+(|,\\d+)" ); QRegExp rcsRE ( "^[acd]\\d+ \\d+" ); // Summary is not supported since it gives no useful parsable info QStringList::ConstIterator it = m_diffLines.begin(); while( it != m_diffLines.end() ) { if( it->indexOf( unifiedRE, 0 ) == 0 ) { qCDebug(LIBKOMPAREDIFF2) << "Difflines are from a Unified diff..."; return Kompare::Unified; } else if( it->indexOf( contextRE, 0 ) == 0 ) { qCDebug(LIBKOMPAREDIFF2) << "Difflines are from a Context diff..."; return Kompare::Context; } else if( it->indexOf( normalRE, 0 ) == 0 ) { qCDebug(LIBKOMPAREDIFF2) << "Difflines are from a Normal diff..."; return Kompare::Normal; } else if( it->indexOf( rcsRE, 0 ) == 0 ) { qCDebug(LIBKOMPAREDIFF2) << "Difflines are from a RCS diff..."; return Kompare::RCS; } ++it; } qCDebug(LIBKOMPAREDIFF2) << "Difflines are from an unknown diff..."; return Kompare::UnknownFormat; }