Add init method to lists

This commit is contained in:
Jason Paryani
2015-05-04 11:00:25 -07:00
parent 3d77722e88
commit a5bf532d53
4 changed files with 29 additions and 0 deletions

View File

@@ -115,6 +115,8 @@ cdef class _DynamicListBuilder:
cpdef adopt(self, index, _DynamicOrphan orphan)
cpdef disown(self, index)
cpdef init(self, index, size)
cdef to_python_reader(C_DynamicValue.Reader self, object parent)
cdef to_python_builder(C_DynamicValue.Builder self, object parent)
cdef _to_dict(msg, bint verbose, bint ordered)

View File

@@ -534,6 +534,17 @@ cdef class _DynamicListBuilder:
"""
return _DynamicOrphan()._init(self.thisptr.disown(index), self._parent)
cpdef init(self, index, size):
"""A method for initializing an element in a list
:type index: int
:param index: The index of the element in the list
:type size: int
:param size: Size of the element to be initialized.
"""
return to_python_builder(self.thisptr.init(index, size), self._parent)
def __str__(self):
return <char*>printListBuilder(self.thisptr).flatten().cStr()