// --------------------------------------------------------------------------- // • AddModelTokensFromList // --------------------------------------------------------------------------- // Adds the appropriate token for each item in the list to destList. If an element // is a list, it recursively descends to each element. OSErr UAppleEventsMgr::AddModelTokensFromList(const AEDescList& srcList, AEDescList& destList, DescType inDesiredClass, DescType inKeyForm, const AEDesc &inKeyData) { //make sure we have lists if ((srcList.descriptorType != typeAEList) || (destList.descriptorType != typeAEList)) return errAEWrongDataType; //get count of lists SInt32 srcCnt, destCnt; OSErr err = ::AECountItems(&srcList, &srcCnt); if (noErr != err) return err; err = ::AECountItems(&destList, &destCnt); if (noErr != err) return err; //loop through srcList for (SInt32 i=1; i <= srcCnt; i++) { StAEDescriptor anElementDesc; DescType theKeyword; err = ::AEGetNthDesc(&srcList, i, typeWildCard, &theKeyword, anElementDesc); ThrowIfOSErr_(err); if (anElementDesc.DescriptorType() == typeAEList) AddModelTokensFromList(anElementDesc, destList, inDesiredClass, inKeyForm, inKeyData); else { StAEDescriptor subModelDesc; LModelObject *container = LModelObject::GetModelFromToken(anElementDesc); container->GetModelToken(inDesiredClass, inKeyForm, inKeyData, subModelDesc); UAEDesc::AddDesc(&destList, 0, subModelDesc); } } return noErr; }