Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Atom traversing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Atom traversing



Ok, I'm a tad confused here!

I'm trying to dump the atom structure from a MovieExporter (see previous
pleas for help on this subject!!). So, I get an AtomContainer, which I
print out. It tells me its size is 490, which I take to mean 490 atoms.

So far so good, I then get the parent Atom with the following code:

int nbrAtomTypes = ac.countChildrenOfType(null, 0); // count ALL children of
container, comes back as 1 i.e. the root
int atomType = ac.getNextChildType(null, atomType); // get the type of the
root, comes back with a typey sort of number

// Find the root atom itself
Atom root = ac.findChildByIndex_Atom(null, atomType, 1);

So far so good, I;ve got the root object,

I now try to iterate through the rest of the structure, regardless of type
by following:

int nbrChildren = ac.countChildrenOfType(root, 0); // returns 7,
Atom child = null;

while ((child = ac.nextChildAnyType(root, child)) != null)
{
// Never get here!! Purports to have no children!!
}


Soo.. in desperation, I tried iterating by type, using the types with the
following

while ((atomType = ac.getNextChildType(root, atomType)) != 0)
{
int nbrTypedChildren = ac.countChildrenOfType(root, atomType); //
Generally returns 1
// I dump the children here. However, I only get leaf atoms, no lower
level parents
}

So there appears to be a contradiction here on the number of children being
reported.

Using the Typed approach, I only ever get leaf nodes, no sub-parents.

Am I missing something here?

Any help gratefully received

Cheers




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.