class compunit_procedure_iterator

Iterator over the procedures ( procedure ) in a compilation unit ( compunit ).

Initialize with compunit.procedures().

Use as you would any other Python iterator. For example:

# set up compunit cu, then...
for e in cu.procedures():
    print('procedure: ', e)

compunit_procedure_iterator Details

class cs.compunit_procedure_iterator

Iterator over the procedures ( procedure ) in a compilation unit ( compunit ).

__eq__(other)

Iterator equality.

Parameters:other (compunit_procedure_iterator) –
Return type:bool
Returns:True if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> cp_iterA = cu.procedures()
>>> cp_iterB = cu.procedures()
>>> cp_iterA == cp_iterB
True
>>> for p in cp_iterA:
...     if p.name()=='foo':
...         break
...
>>> cp_iterA == cp_iterB
False
__iter__()

Get the iterator object.

Return type:compunit_procedure_iterator
Returns:self.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].procedures()
>>> iter(v2)
<cs.compunit_iterator begin>
__ne__(other)

Iterator inequality.

Parameters:other (compunit_procedure_iterator) – The iterator to compare against.
Return type:bool
Returns:False if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('api
test.cpp'))
>>> cp_iterA = cu.procedures()
>>> cp_iterB = cu.procedures()
>>> cp_iterA != cp_iterB
False
>>> for p in cp_iterA:
...     if p.name()=='foo':
...         break
...
>>> cp_iterA != cp_iterB
True
__next__()

Iterator dereference operator.

Return type:procedure
Returns:The element at the current iterator position.
Raises:StopIteration
  • Side effects: Modifies self.

The typical use is implicit:

>>> for item in myiter:
...   (do something to item)
>>> cu = next(u for u in project.current().compunits() if u.is_user())
>>> next(cu.procedures())
<cs.procedure #File_Initialization>
__repr__()

Get a representation of the iterator that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].procedures()
>>> repr(v2)
'<cs.compunit_iterator begin>'
__str__()

Get a simple string representation of the iterator.

Return type:str
Returns:The string representation.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].procedures()
>>> str(v2)
'<cs.compunit_iterator begin>'
at_end()

Check: is the iterator at the end of the structure?

Return type:bool
Returns:True if the iterator is at the end of the structure (there are no more elements to iterate over), False otherwise.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].procedures()
>>> v2.at_end()
False