MCPcopy Create free account
hub / github.com/assimp/assimp / Scope

Method Scope

code/AssetLib/FBX/FBXParser.cpp:174–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174Scope::Scope(Parser& parser,bool topLevel)
175{
176 if(!topLevel) {
177 TokenPtr t = parser.CurrentToken();
178 if (t->Type() != TokenType_OPEN_BRACKET) {
179 ParseError("expected open bracket",t);
180 }
181 }
182
183 StackAllocator &allocator = parser.GetAllocator();
184 TokenPtr n = parser.AdvanceToNextToken();
185 if (n == nullptr) {
186 ParseError("unexpected end of file");
187 }
188
189 // note: empty scopes are allowed
190 while(n->Type() != TokenType_CLOSE_BRACKET) {
191 if (n->Type() != TokenType_KEY) {
192 ParseError("unexpected token, expected TOK_KEY",n);
193 }
194
195 const std::string& str = n->StringContents();
196 if (str.empty()) {
197 ParseError("unexpected content: empty string.");
198 }
199
200 auto *element = new_Element(*n, parser);
201
202 // Element() should stop at the next Key token (or right after a Close token)
203 n = parser.CurrentToken();
204 if (n == nullptr) {
205 if (topLevel) {
206 elements.insert(ElementMap::value_type(str, element));
207 return;
208 }
209 delete_Element(element);
210 ParseError("unexpected end of file",parser.LastToken());
211 } else {
212 elements.insert(ElementMap::value_type(str, element));
213 }
214 }
215}
216
217// ------------------------------------------------------------------------------------------------
218Scope::~Scope()

Callers

nothing calls this directly

Calls 7

ParseErrorFunction · 0.85
CurrentTokenMethod · 0.80
AdvanceToNextTokenMethod · 0.80
StringContentsMethod · 0.80
LastTokenMethod · 0.80
TypeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected