/** Returns pointer to the next object. The function returns NULL when there are no more objects to iterate. */ QObject* GCF::ObjectIterator::nextObject() const { // Reset information about the current object d->current.object = 0; d->current.name.clear(); d->current.component = 0; // If there is no way to fetch more object information, // then return NULL if(d->componentIndex < 0 || d->componentIndex >= d->components.count()) return 0; // Look for the next object QObject* obj = 0; while(!obj) { obj = this->nextObjectInternal(); if(obj) break; if(d->current.guiNodeIndex >= d->current.gui.nodeCount()) { // We are done looking at nodes in the current component, // so lets go to the next component. bool success = nextComponent(); if(!success) return 0; } } GCF::ComponentGuiNode node = d->current.gui.node(d->current.guiNodeIndex); d->current.object = obj; d->current.name = node.completeName(); d->current.component = node.component(); return d->current.object; }
void expandFileNames( char *string, STRINGLIST **sourceList, STRINGLIST **macroList ) { char *s, *t = NULL; STRINGLIST *p; // Main list pointer STRINGLIST *pNew, // Pointer to new list *pBack; // Pointer to one element back char *saveText = NULL; for (pBack = NULL, p = *sourceList; p;) { // If no expand-character is found, continue to next list element. if (!_tcspbrk(p->text, string)) { pBack = p; p = pBack->next; continue; } // Either expand macros or wildcards. if (*string == '$') { t = expandMacros(p->text, macroList); FREE(p->text); } else { // If the wildcard string does not expand to anything, go to // next list elment. Do not remove p from the original list // else we must check for null elsewhere. // -- do not attempt to expand wildcards that // occur in inference rules if (isRule(p->text) || (pNew = expandWildCards(p->text)) == NULL) { pBack = p; p = pBack->next; continue; } saveText = p->text; } // At this point we have a list of expanded names to replace p with. if (pBack) { pBack->next = p->next; FREE_STRINGLIST(p); p = pBack->next; } else { *sourceList = p->next; FREE_STRINGLIST(p); p = *sourceList; } if (*string == '$') { // if expanding macros char *str = t; if ((s = nextComponent(&str))) { do { // put expanded names pNew = makeNewStrListElement(); // at front of list pNew->text = makeString(s); // so we won't try to prependItem(sourceList, pNew); // re-expand them if (!pBack) pBack = pNew; } while ((s = nextComponent(&str))); } FREE(t); continue; } else if (pNew) { // if matches for * ? if (!pBack) for (pBack = pNew; pBack->next; pBack = pBack->next) ; appendItem(&pNew, *sourceList); // put at front of old list *sourceList = pNew; } FREE(saveText); } }