Collection of data nodes.
| 1067 | |
| 1068 | |
| 1069 | class Nodes(Collection): |
| 1070 | """Collection of data nodes.""" |
| 1071 | |
| 1072 | @classmethod |
| 1073 | def constructor(cls, world, node): |
| 1074 | assert isinstance(world, World) |
| 1075 | assert type(node) == POINTER(Node) |
| 1076 | return Node.wrap(world, c.node_duplicate(node)) |
| 1077 | |
| 1078 | def __init__(self, world, collection, owning=False): |
| 1079 | assert type(collection) == POINTER(Nodes) |
| 1080 | |
| 1081 | self.owning = owning |
| 1082 | super(Nodes, self).__init__( |
| 1083 | world, |
| 1084 | collection, |
| 1085 | c.nodes_begin, |
| 1086 | Nodes.constructor, |
| 1087 | c.nodes_get, |
| 1088 | c.nodes_next, |
| 1089 | c.nodes_is_end, |
| 1090 | ) |
| 1091 | |
| 1092 | def __del__(self): |
| 1093 | if self.owning and self.world.world: |
| 1094 | c.nodes_free(self.collection) |
| 1095 | |
| 1096 | def __contains__(self, value): |
| 1097 | return c.nodes_contains(self.collection, value.node) |
| 1098 | |
| 1099 | def __len__(self): |
| 1100 | return c.nodes_size(self.collection) |
| 1101 | |
| 1102 | def merge(self, b): |
| 1103 | return Nodes( |
| 1104 | self.world, c.nodes_merge(self.collection, b.collection), True |
| 1105 | ) |
| 1106 | |
| 1107 | |
| 1108 | class Namespace: |
no outgoing calls
no test coverage detected