src/parser.cpp

changeset 327
2aa15daa0216
parent 264
76a025db4948
child 328
3ea38fd469ca
equal deleted inserted replaced
326:65dbfcb859a7 327:2aa15daa0216
51 bool invertNext = false; 51 bool invertNext = false;
52 while (not this->device.atEnd()) 52 while (not this->device.atEnd())
53 { 53 {
54 // Some LDraw parts such as 53588.dat can contain "BFC INVERTNEXT" with multiple inner whitespaces. 54 // Some LDraw parts such as 53588.dat can contain "BFC INVERTNEXT" with multiple inner whitespaces.
55 // So we need to pass the string through QString::simplified to catch these cases. 55 // So we need to pass the string through QString::simplified to catch these cases.
56 const QString line = this->readLine().simplified(); 56 const QString line = this->readLine().trimmed();
57 if (line == "0 BFC INVERTNEXT" or line == "0 BFC CERTIFY INVERTNEXT") 57 if (line == "0 BFC INVERTNEXT" or line == "0 BFC CERTIFY INVERTNEXT")
58 { 58 {
59 invertNext = true; 59 invertNext = true;
60 continue; 60 continue;
61 } 61 }
198 return std::make_pair(vertices, color); 198 return std::make_pair(vertices, color);
199 } 199 }
200 200
201 ModelElement parseLDrawLine(QString line) 201 ModelElement parseLDrawLine(QString line)
202 { 202 {
203 line = line.trimmed();
204 try 203 try
205 { 204 {
206 const QStringList tokens = line.simplified().split(" "); 205 const QStringList tokens = line.simplified().split(" ");
207 if (tokens.empty() or tokens == QStringList{{""}}) 206 if (tokens.empty() or tokens == QStringList{{""}})
208 { 207 {

mercurial