Version.cpp: Format parse function code using clang-format

Signed-off-by: Edgars Cīrulis <edgarsscirulis@gmail.com>
This commit is contained in:
Edgars Cīrulis 2023-01-15 17:44:17 +02:00
parent 198139feb4
commit a84e4b0e07
No known key found for this signature in database
GPG Key ID: 307C4E4663F1FCC3

View File

@ -75,22 +75,21 @@ void Version::parse()
{
m_sections.clear();
QString currentSection;
auto classChange = [] (QChar lastChar, QChar currentChar) {
return (( lastChar.isLetter() && currentChar.isDigit() ) || (lastChar.isDigit() && currentChar.isLetter()) );
auto classChange = [](QChar lastChar, QChar currentChar) {
return ((lastChar.isLetter() && currentChar.isDigit()) || (lastChar.isDigit() && currentChar.isLetter()));
};
for (int i = 0; i < m_string.size(); ++i) {
const auto& current_char = m_string.at(i);
if(current_char.isDigit() || current_char.isLetter()){
if(i>0 && classChange(m_string.at(i-1), current_char)){
if(!currentSection.isEmpty()){
if (current_char.isDigit() || current_char.isLetter()) {
if (i > 0 && classChange(m_string.at(i - 1), current_char)) {
if (!currentSection.isEmpty()) {
m_sections.append(Section(currentSection));
}
currentSection = "";
}
currentSection += current_char;
}
else if(current_char == '.' || current_char == '-' || current_char == '_'){
if(!currentSection.isEmpty()){
} else if (current_char == '.' || current_char == '-' || current_char == '_') {
if (!currentSection.isEmpty()) {
m_sections.append(Section(currentSection));
}
currentSection = "";