-
Notifications
You must be signed in to change notification settings - Fork 0
/
Parser.cpp
39 lines (36 loc) · 900 Bytes
/
Parser.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "Parser.h"
#include "Contstants.h"
#include <QTextStream>
#include <QDebug>
Parser::Parser(QFile& file)
{
QTextStream input(&file);
QFile outf("/home/zamazan4ik/azaza.txt");
outf.open(QIODevice::WriteOnly);
QTextStream out(&outf);
QString str;
while(input.readLineInto(&str))
{
for(const auto& x : NamesOfProp)
{
if(str.contains(x))
{
QString value;
int posEqual = str.indexOf('=');
value = str.mid(posEqual + 1).trimmed();
prop.insert(x, value);
break;
}
}
}
outf.close();
}
QVector<QPair<QString, QVariant> > Parser::getVector() const
{
QVector<QPair<QString, QVariant> > result;
for(const auto& x : NamesOfProp)
{
result << QPair<QString, QVariant>(x, prop[x]);
}
return result;
}