[V4CC][NEW] Enumerators & FastEnumeration support.

In v4.8 we have implement
a) Enumerators for all V4CC classes where this was possible and
b) for Fields we have provide also FastEnumeration protocol in classes VTable and VCursor, because this is the most often usage case.

Let’s note that e.g. for VDatabase class, we have different collections of sub-elements: Tables, Links, Triggers, Indexes, … Fast enumeration protocol itself is able to handle only single collection for a class. To be able handle all collections we have to use NSEnumerator. As result, you can now write:

    for( VTable* ptbl in [mydb tableEnumerator]  )
    {
        ...
    }

instead of

    int tblCount = mydb.TableCountl;
    for( int i = 1; i <= tblCount; ++i  )
    {
        VTable* ptbl = [mydb tableAt:i];
        ...
    }

By analogy you can iterate other collections, for example:

    for( VLink* pLink in [mydb linkEnumerator] )

For Fields of VTable and VCursor  classes we have provide FastEnumeration protocol, so you can use even more short notation:

    for( VField* pField in cursor1 )

Published by

Ruslan Zasukhin

VP Engineering and New Technology Paradigma Software, Inc

Leave a Reply