[Flightgear-devel] Properties, by position
In props.cxx I find this code: /** * Get a child node by position (*NOT* index). */ SGPropertyNode * getChild (int position); Can anyone differentiate for me the concept of position as contrasted to index in this situation? Jon ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Properties, by position
Jon Berndt wrote: In props.cxx I find this code: /** * Get a child node by position (*NOT* index). */ SGPropertyNode * getChild (int position); Can anyone differentiate for me the concept of position as contrasted to index in this situation? A position and index or not necessarily the same. The position is the index of the C array, but the index can me manually altered by specifying n=xx as an XML attribute. You could for instance define n=99 but it's array position could be 2. Erik ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d
Re: [Flightgear-devel] Properties, by position
Jon Berndt wrote: Can anyone differentiate for me the concept of position as contrasted to index in this situation? Position is arbitrary. I think it corresponds to the order of which the nodes were added to the parent. The only use I can think of for this method is enumerating over all properties, as in: for(int i=0; inode-nChildren(); i++) doWhatever(node-getChild(i)); Note that index is not always contiguous. It is perfectly legal to have a node with 4 children, which have indices 0, 7, 21 and 123, for instance. Andy ___ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d