Repository navigation
Expand file tree
/
Copy pathparseworker.cpp
More file actions
52 lines (46 loc) · 1.39 KB
/
Copy pathparseworker.cpp
File metadata and controls
52 lines (46 loc) · 1.39 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "parseworker.h"
#include "util.h"
#include <QDebug>
void ParseWorker::run()
{
QString value = Util::readFile(PrePath+fileName);
Json::Reader reader;
if (reader.parse(value.toStdString(), autostate.root, false))
{
qDebug()<<" Json::Value root "<<autostate.root.size();
}
autostate.stage.clear();
int flag = 0;
State *state = NULL;
state = new State();
state->startIndex = 0;
for(int i=0;i<autostate.root.size();i++)
{
int action = autostate.root[i]["action"].asInt();
int actionSta = autostate.root[i]["ac_sta"].asInt();
QString content = QString::fromStdString(autostate.root[i]["ac_content"].asString());
if(action == NOAction){
if(flag!= 0){
if(actionSta == ActionState_DONE){
//qDebug()<<content;
state->endIndex = i;
state->content =content;
autostate.stage.append(*state);
state = new State();
state->startIndex = i;
flag = 0;
}else {
flag = 0;
}
}
}else{
if(flag == 0){
state->actionStartIndex = i;
state->actionID = action;
flag = 1;
}
}
}
autostate.printfInfo();
emit(parsed());
}