PTDictIterator

@interface PTDictIterator : NSObject

DictIterator is used to traverse key/value pairs in a dictionary. For example a DictIterator can be used to print out all the entries in a given Obj dictionary as follows:

 DictIterator itr = dict.GetDictIterator();
 while (itr.HasNext()) {
     Obj key = itr.Key();
    cout << key.GetName() << endl;
     Obj value = itr.Value();
     // ...
     itr.Next()
  }
  • Advances the iterator to the next element of the collection.

    Declaration

    Objective-C

    - (void)Next;

    Swift

    func next()
  • Declaration

    Objective-C

    - (PTObj *)Key;

    Swift

    func key() -> PTObj!

    Return Value

    the key of the current dictionary entry.

  • Declaration

    Objective-C

    - (PTObj *)Value;

    Swift

    func value() -> PTObj!

    Return Value

    the value of the current dictionary entry.

  • Declaration

    Objective-C

    - (BOOL)HasNext;

    Swift

    func hasNext() -> Bool

    Return Value

    true if the iterator can be successfully advanced to the next element; false if the end collection is reached.

  • Copy constructor.

    Declaration

    Objective-C

    - (instancetype)initWithC:(PTDictIterator *)c;

    Swift

    init!(c: PTDictIterator!)