ldtypes.cpp

changeset 69
6790dea720a8
parent 67
d523a370a17a
child 70
e6b8dab8f81a
equal deleted inserted replaced
68:c637b172d565 69:6790dea720a8
296 vector<LDObject*> LDSubfile::inlineContents (bool bDeepInline, bool bCache) { 296 vector<LDObject*> LDSubfile::inlineContents (bool bDeepInline, bool bCache) {
297 vector<LDObject*> objs, cache; 297 vector<LDObject*> objs, cache;
298 298
299 // If we have this cached, just clone that 299 // If we have this cached, just clone that
300 if (bDeepInline && pFile->objCache.size ()) { 300 if (bDeepInline && pFile->objCache.size ()) {
301 FOREACH (LDObject, *, obj, pFile->objCache) 301 for (LDObject* obj : pFile->objCache)
302 objs.push_back (obj->makeClone ()); 302 objs.push_back (obj->makeClone ());
303 } else { 303 } else {
304 if (!bDeepInline) 304 if (!bDeepInline)
305 bCache = false; 305 bCache = false;
306 306
307 FOREACH (LDObject, *, obj, pFile->objects) { 307 for (LDObject* obj : pFile->objects) {
308 // Skip those without schemantic meaning 308 // Skip those without schemantic meaning
309 switch (obj->getType ()) { 309 switch (obj->getType ()) {
310 case OBJ_Comment: 310 case OBJ_Comment:
311 case OBJ_Empty: 311 case OBJ_Empty:
312 case OBJ_Gibberish: 312 case OBJ_Gibberish:
323 if (bDeepInline && obj->getType() == OBJ_Subfile) { 323 if (bDeepInline && obj->getType() == OBJ_Subfile) {
324 LDSubfile* ref = static_cast<LDSubfile*> (obj); 324 LDSubfile* ref = static_cast<LDSubfile*> (obj);
325 325
326 vector<LDObject*> otherobjs = ref->inlineContents (true, false); 326 vector<LDObject*> otherobjs = ref->inlineContents (true, false);
327 327
328 FOREACH (LDObject, *, otherobj, otherobjs) { 328 for (LDObject* otherobj : otherobjs) {
329 // Cache this object if desired 329 // Cache this object if desired
330 if (bCache) 330 if (bCache)
331 cache.push_back (otherobj->makeClone ()); 331 cache.push_back (otherobj->makeClone ());
332 332
333 objs.push_back (otherobj); 333 objs.push_back (otherobj);
344 if (bCache) 344 if (bCache)
345 pFile->objCache = cache; 345 pFile->objCache = cache;
346 } 346 }
347 347
348 // Transform the objects 348 // Transform the objects
349 FOREACH (LDObject, *, obj, objs) 349 for (LDObject* obj : objs)
350 transformObject (obj, mMatrix, vPosition, dColor); 350 transformObject (obj, mMatrix, vPosition, dColor);
351 351
352 return objs; 352 return objs;
353 } 353 }
354 354

mercurial