src/parser.cpp

changeset 328
3ea38fd469ca
parent 327
2aa15daa0216
child 333
07e65a4c6611
--- a/src/parser.cpp	Sun Jul 03 22:32:50 2022 +0300
+++ b/src/parser.cpp	Sun Jul 03 23:54:22 2022 +0300
@@ -30,16 +30,16 @@
 /*
  * Constructs an LDraw parser
  */
-Parser::Parser(QIODevice& device, QObject* parent) :
+Parser::Parser(QTextStream& stream, QObject* parent) :
 	QObject {parent},
-	device {device} {}
+	stream {stream} {}
 
 /*
  * Reads a single line from the device.
  */
 QString Parser::readLine()
 {
-	return QString::fromUtf8(this->device.readLine()).trimmed();
+	return this->stream.readLine().trimmed();
 }
 
 /**
@@ -49,7 +49,7 @@
 void Parser::parseBody(Model& model)
 {
 	bool invertNext = false;
-	while (not this->device.atEnd())
+	while (not this->stream.atEnd())
 	{
 		// Some LDraw parts such as 53588.dat can contain "BFC  INVERTNEXT" with multiple inner whitespaces.
 		// So we need to pass the string through QString::simplified to catch these cases.

mercurial