Ejemplo n.º 1
0
    def __init__(self, cache, obj):
        self._cache = cache
        self._nl_object = None

        if not obj:
            self._end = 1
        else:
            capi.nl_object_get(obj)
            self._nl_object = obj
            self._first = 1
            self._end = 0
Ejemplo n.º 2
0
	def __init__(self, cache, obj):
                self._cache = cache
                self._nl_object = None

		if not obj:
                        self._end = 1
                else:
                        capi.nl_object_get(obj)
                        self._nl_object = obj
                        self._first = 1
                        self._end = 0
Ejemplo n.º 3
0
    def next(self):
        if self._end:
            raise StopIteration()

        if self._first:
            ret = self._nl_object
            self._first = 0
        else:
            ret = self.get_next()
            if not ret:
                self._end = 1
                raise StopIteration()

        # return ref of previous element and acquire ref of current
        # element to have object stay around until we fetched the
        # next ptr
        capi.nl_object_put(self._nl_object)
        capi.nl_object_get(ret)
        self._nl_object = ret

        # reference used inside object
        capi.nl_object_get(ret)
        return self._cache._new_object(ret)
Ejemplo n.º 4
0
	def next(self):
		if self._end:
                        raise StopIteration()

        	if self._first:
                        ret = self._nl_object
                        self._first = 0
                else:
                        ret = self.get_next()
                        if not ret:
                                self._end = 1
                                raise StopIteration()

		# return ref of previous element and acquire ref of current
		# element to have object stay around until we fetched the
		# next ptr
                capi.nl_object_put(self._nl_object)
                capi.nl_object_get(ret)
                self._nl_object = ret

		# reference used inside object
                capi.nl_object_get(ret)
                return self._cache._new_object(ret)