Lines Matching +full:back +full:- +full:end

1 //===-- MsgPackDocument.cpp - MsgPack Document --------------------------*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 /// This file implements a class that exposes a simple in-memory representation
12 /// lighter-weight (in terms of memory allocations) replacement for
15 //===----------------------------------------------------------------------===//
24 void DocNode::convertToArray() { *this = getDocument()->getArrayNode(); } in convertToArray()
27 void DocNode::convertToMap() { *this = getDocument()->getMapNode(); } in convertToMap()
31 return find(getDocument()->getNode(S)); in find()
37 return (*this)[getDocument()->getNode(S)]; in operator []()
46 N = getDocument()->getEmptyNode(); in operator []()
53 return (*this)[getDocument()->getNode(Key)]; in operator []()
56 return (*this)[getDocument()->getNode(Key)]; in operator []()
59 return (*this)[getDocument()->getNode(Key)]; in operator []()
62 return (*this)[getDocument()->getNode(Key)]; in operator []()
69 Array->resize(Index + 1, getDocument()->getEmptyNode()); in operator []()
80 *this = getDocument()->getNode(Val); in operator =()
84 *this = getDocument()->getNode(Val); in operator =()
88 *this = getDocument()->getNode(Val); in operator =()
92 *this = getDocument()->getNode(Val); in operator =()
96 *this = getDocument()->getNode(Val); in operator =()
100 *this = getDocument()->getNode(Val); in operator =()
104 *this = getDocument()->getNode(Val); in operator =()
112 : Node(Node), Index(StartIndex), End(StartIndex + Length), in StackLevel()
116 size_t End; member
126 // If Multi, then this sets root to an array and adds top-level objects to it.
127 // If !Multi, then it only reads a single top-level object, even if there are
138 // Create the array for multiple top-level objects. in readFromBlob()
140 Stack.push_back(StackLevel(Root, 0, (size_t)-1)); in readFromBlob()
154 // OK to finish here as we've just done a top-level element with Multi in readFromBlob()
197 else if (Stack.back().Node.getKind() == Type::Array) { in readFromBlob()
199 auto &Array = Stack.back().Node.getArray(); in readFromBlob()
200 DestNode = &Array[Stack.back().Index++]; in readFromBlob()
202 auto &Map = Stack.back().Node.getMap(); in readFromBlob()
203 if (!Stack.back().MapEntry) { in readFromBlob()
205 Stack.back().MapKey = Node; in readFromBlob()
206 Stack.back().MapEntry = &Map[Node]; in readFromBlob()
210 DestNode = Stack.back().MapEntry; in readFromBlob()
211 Stack.back().MapEntry = nullptr; in readFromBlob()
212 ++Stack.back().Index; in readFromBlob()
215 if (!DestNode->isEmpty()) { in readFromBlob()
219 DocNode MapKey = !Stack.empty() && !Stack.back().MapKey.isEmpty() in readFromBlob()
220 ? Stack.back().MapKey in readFromBlob()
225 assert(!((Node.isMap() && !DestNode->isMap()) || in readFromBlob()
226 (Node.isArray() && !DestNode->isArray()))); in readFromBlob()
231 switch (DestNode->getKind()) { in readFromBlob()
242 if (Stack.back().MapEntry) in readFromBlob()
244 if (Stack.back().Index != Stack.back().End) in readFromBlob()
303 if (Stack.back().Node.getKind() == Type::Map) { in writeToBlob()
304 if (Stack.back().MapIt != Stack.back().Node.getMap().end()) in writeToBlob()
307 if (Stack.back().ArrayIt != Stack.back().Node.getArray().end()) in writeToBlob()
315 if (Stack.back().Node.getKind() == Type::Map) { in writeToBlob()
316 if (Stack.back().OnKey) { in writeToBlob()
318 Node = Stack.back().MapIt->first; in writeToBlob()
319 Stack.back().OnKey = false; in writeToBlob()
321 Node = Stack.back().MapIt->second; in writeToBlob()
322 ++Stack.back().MapIt; in writeToBlob()
323 Stack.back().OnKey = true; in writeToBlob()
326 Node = *Stack.back().ArrayIt; in writeToBlob()
327 ++Stack.back().ArrayIt; in writeToBlob()