First checkin of the Python XPCOM bindings.

This commit is contained in:
markh@activestate.com
2001-02-19 05:24:45 +00:00
parent a75c1ed1a1
commit 189159a116
74 changed files with 13656 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# Copyright (c) 2000-2001 ActiveState Tool Corporation.
# See the file LICENSE.txt for licensing information.
from xpcom import components
# This class is created by Python components when it
# needs to return an enumerator.
# For example, a component may implement a function:
# nsISimpleEnumerator enumSomething();
# This could could simply say:
# return SimpleEnumerator([something1, something2, something3])
class SimpleEnumerator:
_com_interfaces_ = [components.interfaces.nsISimpleEnumerator]
def __init__(self, data):
self._data = data
self._index = 0
def hasMoreElements(self):
return self._index < len(self._data)
def getNext(self):
self._index = self._index + 1
return self._data[self._index-1]