class int_pairs_to_points_map

A map int_pair_set -> point_set , where each entry represents the mapping from a source position to the set of points at that source position.

int_pairs_to_points_map Details

class cs.int_pairs_to_points_map

A map int_pair_set -> point_set , where each entry represents the mapping from a source position to the set of points at that source position.

__init__(sfi)

Constructor: create a new int_pairs_to_points_map representing the source location -> point set mapping for the specified source file instance.

Parameters:sfi (sfileinst) – The source file instance ( sfileinst ) of interest.
Raises:result.NO_POSITION if the source file instance does not have any position information, for example because it was generated by the back end.
>>> sf = next(project.current().sfiles())
>>> int_pairs_to_points_map(sf.arbitrary_instance())
<cs.int_pairs_to_points_map ...>
__contains__(i)

Check: does an int_pairs_to_points_map include a nonempty mapping for a specified range of source locations?

Parameters:i ((int, int)) – An (int, int) representing the range of source locations: i[0] denotes the start of the range; i[1] denotes the size of the range (follows the convention that this size is one less than the actual length of the range).
Return type:bool
Returns:True if the int_pairs_to_points_map has at least one point associated with the source text between offset i[0] and offset i[0] + i[1], inclusive, False otherwise.
Raises:OverflowError
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> (205, 12)  in ippm
True
__eq__(b)

Equality operator for int_pairs_to_points_map .

Parameters:b (int_pairs_to_points_map) – The int_pairs_to_points_map object to compare against.
Return type:bool
Returns:True if self and b refer to the same underlying map instance; False otherwise.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> ippm == ippm
True
__getitem__(i)

Find a point_set for a specified range of source locations, relative to an int_pairs_to_points_map .

Parameters:i ((int, int)) – An (int, int) representing the range of source locations: i[0] denotes the start of the range; i[1] denotes the size of the range (follows the convention that this size is one less than the actual length of the range).
Return type:point_set
Returns:A point_set containing every vertex associated with the source text between offset i[0] and offset i[0] + i[1], inclusive.
Raises:OverflowError
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> ippm[(205,12)]
<cs.point_set {<cs.point [call-site] bar(int, void *, int)>, <cs.point [expression] x = _Z3bariPvi$result1>}>
__hash__()

Hash function for int_pairs_to_points_map .

Return type:int
Returns:A hash of the int_pairs_to_points_map .
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> hash(ippm)
3233162384
__ne__(b)

Inquality operator for int_pairs_to_points_map .

Parameters:b (int_pairs_to_points_map) – The int_pairs_to_points_map object to compare against.
Return type:bool
Returns:False if self and b refer to the same underlying map instance; True otherwise.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> ippm != ippm
False
__repr__()

Get a representation of a int_pairs_to_points_map object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> repr(ippm)
'<cs.int_pairs_to_points_map ...>'
__str__()

Get a simple string representation of a int_pairs_to_points_map object.

Return type:str
Returns:The string representation.
>>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> str(ippm)
'<cs.int_pairs_to_points_map ...>'
get(i)

Find a point_set for a specified range of source locations, relative to an int_pairs_to_points_map .

Parameters:i ((int, int)) – An (int, int) representing the range of source locations: i[0] denotes the start of the range; i[1] denotes the size of the range (follows the convention that this size is one less than the actual length of the range).
Return type:point_set
Raises:OverflowError
>> cu = next(c for c in project.current().compunits() if c.name().endswith('apitest.cpp'))
>>> ippm = int_pairs_to_points_map(cu.get_sfileinst())
>>> ippm.get((205,12))
<cs.point_set {<cs.point [call-site] bar(int, void *, int)>, <cs.point [expression] x = _Z3bariPvi$result1>}>