hoppy-std-0.1.0: C++ FFI generator - Standard library bindings

Safe HaskellNone
LanguageHaskell2010

Foreign.Hoppy.Generator.Std.Iterator

Description

Support for STL-style iterators. The functions in this module modify a class to add functionality that is provided by different types of STL iterators. In the method pseudotypes documented here, the parameter types are Types, and all methods are nonpure.

Synopsis

Documentation

data IteratorMutability Source

Whether an iterator may be used to modify the underlying collection.

Constructors

Constant 
Mutable 

makeTrivialIterator :: IteratorMutability -> Maybe Type -> Class -> Class Source

makeTrivialIteartor mutable valueTypeMaybe cls turns a class into a trivial iterator, adding:

  • A default constructor named new.
  • The class features Assignable, Copyable, and Equatable.
  • operator*: getConst :: this -> TRef (TConst valueType); if valueTypeMaybe is present.
  • operator*: get :: this -> TRef valueType; if valueTypeMaybe is present and mutable is Mutable.
  • *iter = x: put :: this -> valueType -> TVoid; if valueTypeMaybe is present and mutable is Mutable.

makeForwardIterator :: IteratorMutability -> Maybe Type -> Class -> Class Source

Turns a class into a forward iterator, including everything from makeTrivialIterator plus the pre-increment operator:

  • operator++: next :: this -> TRef (TObj cls).

makeBidirectionalIterator :: IteratorMutability -> Maybe Type -> Class -> Class Source

Turns a class into a bidirectional iterator, including everything from makeForwardIterator plus the pre-decrement operator:

  • operator--: prev :: this -> TRef (TObj cls).

makeRandomIterator :: IteratorMutability -> Maybe Type -> Type -> Class -> Class Source

makeRandomIterator mutable valueTypeMaybe distanceType cls turns a class into a random iterator, including everything from makeBidirectionalIterator plus some methods:

  • operator+=: add :: this -> distanceType -> TRef (TObj cls).
  • operator+: plusNew :: this -> distanceType -> TObjToHeap cls.
  • operator-=: subtract :: distanceType -> TRef (TObj cls).
  • operator-: minusNew :: distanceType -> TObjToHeap cls.
  • operator-: difference :: this -> this -> distanceType.
  • operator[]: atConst :: distanceType -> TRef (TConst valueType); if valueTypeMaybe is present.
  • operator[]: at :: distanceType -> TRef valueType; if valueTypeMaybe is present and mutable is Mutable.