Version.cpp: Simplify Version::parse by using const auto& current_char
Signed-off-by: Edgars Cīrulis <edgarsscirulis@gmail.com>
This commit is contained in:
parent
de11017552
commit
198139feb4
@ -79,16 +79,17 @@ void Version::parse()
|
|||||||
return (( lastChar.isLetter() && currentChar.isDigit() ) || (lastChar.isDigit() && currentChar.isLetter()) );
|
return (( lastChar.isLetter() && currentChar.isDigit() ) || (lastChar.isDigit() && currentChar.isLetter()) );
|
||||||
};
|
};
|
||||||
for (int i = 0; i < m_string.size(); ++i) {
|
for (int i = 0; i < m_string.size(); ++i) {
|
||||||
if(m_string[i].isDigit() || m_string[i].isLetter()){
|
const auto& current_char = m_string.at(i);
|
||||||
if(i>0 && classChange(m_string[i-1], m_string[i])){
|
if(current_char.isDigit() || current_char.isLetter()){
|
||||||
|
if(i>0 && classChange(m_string.at(i-1), current_char)){
|
||||||
if(!currentSection.isEmpty()){
|
if(!currentSection.isEmpty()){
|
||||||
m_sections.append(Section(currentSection));
|
m_sections.append(Section(currentSection));
|
||||||
}
|
}
|
||||||
currentSection = "";
|
currentSection = "";
|
||||||
}
|
}
|
||||||
currentSection += m_string[i];
|
currentSection += current_char;
|
||||||
}
|
}
|
||||||
else if(m_string[i] == '.' || m_string[i] == '-' || m_string[i] == '_'){
|
else if(current_char == '.' || current_char == '-' || current_char == '_'){
|
||||||
if(!currentSection.isEmpty()){
|
if(!currentSection.isEmpty()){
|
||||||
m_sections.append(Section(currentSection));
|
m_sections.append(Section(currentSection));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user