diff options
author | Edgars Cīrulis <edgarsscirulis@gmail.com> | 2023-01-15 17:07:44 +0200 |
---|---|---|
committer | Edgars Cīrulis <edgarsscirulis@gmail.com> | 2023-01-17 07:14:37 +0200 |
commit | 198139feb4546fbe819b7076c1689582ea67caa7 (patch) | |
tree | c8ea4ee027dc62537b6d0f51bb5082f90eebb54b /launcher | |
parent | de11017552a5e3e06c436051b2218c4411a0fb24 (diff) | |
download | PrismLauncher-198139feb4546fbe819b7076c1689582ea67caa7.tar.gz PrismLauncher-198139feb4546fbe819b7076c1689582ea67caa7.tar.bz2 PrismLauncher-198139feb4546fbe819b7076c1689582ea67caa7.zip |
Version.cpp: Simplify Version::parse by using const auto& current_char
Signed-off-by: Edgars Cīrulis <edgarsscirulis@gmail.com>
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/Version.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/launcher/Version.cpp b/launcher/Version.cpp index f61d53e8..73be6058 100644 --- a/launcher/Version.cpp +++ b/launcher/Version.cpp @@ -79,16 +79,17 @@ void Version::parse() return (( lastChar.isLetter() && currentChar.isDigit() ) || (lastChar.isDigit() && currentChar.isLetter()) ); }; for (int i = 0; i < m_string.size(); ++i) { - if(m_string[i].isDigit() || m_string[i].isLetter()){ - if(i>0 && classChange(m_string[i-1], m_string[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()){ m_sections.append(Section(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()){ m_sections.append(Section(currentSection)); } |