--- a/src/parser.cpp Wed Sep 22 14:03:43 2021 +0300 +++ b/src/parser.cpp Mon Sep 27 21:04:45 2021 +0300 @@ -48,16 +48,6 @@ return QString::fromUtf8(this->device.readLine()).trimmed(); } -static const QMap<QString, LDHeader::FileType> typeStrings { - {"Part", LDHeader::Part}, - {"Subpart", LDHeader::Subpart}, - {"Shortcut", LDHeader::Shortcut}, - {"Primitive", LDHeader::Primitive}, - {"8_Primitive", LDHeader::Primitive_8}, - {"48_Primitive", LDHeader::Primitive_48}, - {"Configuration", LDHeader::Configuration}, -}; - /* * Parses a single line of the header. * Possible parse results: @@ -91,7 +81,7 @@ // consideration. if (partTypeString.startsWith("Unofficial_")) partTypeString = partTypeString.mid(strlen("Unofficial_")); - header.type = typeStrings.value(partTypeString, LDHeader::Part); + header.type = headerTypeFromString(partTypeString); header.qualfiers = {}; if (tokens.contains("Alias")) header.qualfiers |= LDHeader::Alias; @@ -183,12 +173,12 @@ header.cmdline = line.mid(strlen("0 !CMDLINE ")); return ParseSuccess; } - else if (line.startsWith("0 !LICENSE Redistributable under CCAL version 2.0")) + else if (line.startsWith(LDHeader::caLicenseString)) { header.license = LDHeader::CaLicense; return ParseSuccess; } - else if (line.startsWith("0 !LICENSE Not redistributable")) + else if (line.startsWith(LDHeader::nonCaLicenseString)) { header.license = LDHeader::NonCaLicense; return ParseSuccess;