remove button colors from quarks gui (cocoa + swing)
[supercollider.git] / external_libraries / yaml-cpp-0.2.6 / src / contrib / graphbuilderadapter.cpp
blob557e97c8929f1d46aace03abef2d469a75e8615d
1 #include "graphbuilderadapter.h"
3 namespace YAML
5 int GraphBuilderAdapter::ContainerFrame::sequenceMarker;
7 void GraphBuilderAdapter::OnNull(const Mark& mark, anchor_t anchor)
9 void *pParent = GetCurrentParent();
10 void *pNode = m_builder.NewNull(mark, pParent);
11 RegisterAnchor(anchor, pNode);
13 DispositionNode(pNode);
16 void GraphBuilderAdapter::OnAlias(const Mark& mark, anchor_t anchor)
18 void *pReffedNode = m_anchors.Get(anchor);
19 DispositionNode(m_builder.AnchorReference(mark, pReffedNode));
22 void GraphBuilderAdapter::OnScalar(const Mark& mark, const std::string& tag, anchor_t anchor, const std::string& value)
24 void *pParent = GetCurrentParent();
25 void *pNode = m_builder.NewScalar(mark, tag, pParent, value);
26 RegisterAnchor(anchor, pNode);
28 DispositionNode(pNode);
31 void GraphBuilderAdapter::OnSequenceStart(const Mark& mark, const std::string& tag, anchor_t anchor)
33 void *pNode = m_builder.NewSequence(mark, tag, GetCurrentParent());
34 m_containers.push(ContainerFrame(pNode));
35 RegisterAnchor(anchor, pNode);
38 void GraphBuilderAdapter::OnSequenceEnd()
40 void *pSequence = m_containers.top().pContainer;
41 m_containers.pop();
43 DispositionNode(pSequence);
46 void GraphBuilderAdapter::OnMapStart(const Mark& mark, const std::string& tag, anchor_t anchor)
48 void *pNode = m_builder.NewMap(mark, tag, GetCurrentParent());
49 m_containers.push(ContainerFrame(pNode, m_pKeyNode));
50 m_pKeyNode = NULL;
51 RegisterAnchor(anchor, pNode);
54 void GraphBuilderAdapter::OnMapEnd()
56 void *pMap = m_containers.top().pContainer;
57 m_pKeyNode = m_containers.top().pPrevKeyNode;
58 m_containers.pop();
59 DispositionNode(pMap);
62 void *GraphBuilderAdapter::GetCurrentParent() const
64 if (m_containers.empty()) {
65 return NULL;
67 return m_containers.top().pContainer;
70 void GraphBuilderAdapter::RegisterAnchor(anchor_t anchor, void *pNode)
72 if (anchor) {
73 m_anchors.Register(anchor, pNode);
77 void GraphBuilderAdapter::DispositionNode(void *pNode)
79 if (m_containers.empty()) {
80 m_pRootNode = pNode;
81 return;
84 void *pContainer = m_containers.top().pContainer;
85 if (m_containers.top().isMap()) {
86 if (m_pKeyNode) {
87 m_builder.AssignInMap(pContainer, m_pKeyNode, pNode);
88 m_pKeyNode = NULL;
89 } else {
90 m_pKeyNode = pNode;
92 } else {
93 m_builder.AppendToSequence(pContainer, pNode);