mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-06 13:24:28 +02:00
Make buildable with VS 2017
This commit is contained in:
parent
c4333b49f5
commit
0cf10c6306
@ -37,19 +37,8 @@ public:
|
|||||||
Value GetResult();
|
Value GetResult();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Node
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
Dictionary *Object;
|
|
||||||
Array *Aray;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool IsObject;
|
|
||||||
};
|
|
||||||
|
|
||||||
Value m_Root;
|
Value m_Root;
|
||||||
std::stack<Node> m_CurrentSubtree;
|
std::stack<std::pair<Dictionary*, Array*>> m_CurrentSubtree;
|
||||||
String m_CurrentKey;
|
String m_CurrentKey;
|
||||||
|
|
||||||
void FillCurrentTarget(Value value);
|
void FillCurrentTarget(Value value);
|
||||||
@ -280,7 +269,7 @@ bool JsonSax::start_object(std::size_t)
|
|||||||
|
|
||||||
FillCurrentTarget(object);
|
FillCurrentTarget(object);
|
||||||
|
|
||||||
m_CurrentSubtree.push(Node{{.Object = object}, true});
|
m_CurrentSubtree.push({object, nullptr});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -309,7 +298,7 @@ bool JsonSax::start_array(std::size_t)
|
|||||||
|
|
||||||
FillCurrentTarget(array);
|
FillCurrentTarget(array);
|
||||||
|
|
||||||
m_CurrentSubtree.push(Node{{.Aray = array}, false});
|
m_CurrentSubtree.push({nullptr, array});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -342,10 +331,10 @@ void JsonSax::FillCurrentTarget(Value value)
|
|||||||
} else {
|
} else {
|
||||||
auto& node (m_CurrentSubtree.top());
|
auto& node (m_CurrentSubtree.top());
|
||||||
|
|
||||||
if (node.IsObject) {
|
if (node.first) {
|
||||||
node.Object->Set(m_CurrentKey, value);
|
node.first->Set(m_CurrentKey, value);
|
||||||
} else {
|
} else {
|
||||||
node.Aray->Add(value);
|
node.second->Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user