Fix change in C++ API of deleted default constructors for builders
This commit is contained in:
@@ -195,15 +195,18 @@ cdef class _DynamicListBuilder:
|
|||||||
for phone in phones:
|
for phone in phones:
|
||||||
print phone.number
|
print phone.number
|
||||||
"""
|
"""
|
||||||
cdef C_DynamicList.Builder thisptr
|
cdef C_DynamicList.Builder * thisptr
|
||||||
cdef public object _parent
|
cdef public object _parent
|
||||||
cdef _init(self, C_DynamicList.Builder other, object parent):
|
cdef _init(self, C_DynamicList.Builder other, object parent):
|
||||||
self.thisptr = other
|
self.thisptr = new C_DynamicList.Builder(other)
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __dealloc__(self):
|
||||||
|
del self.thisptr
|
||||||
|
|
||||||
cdef _get(self, index) except +ValueError:
|
cdef _get(self, index) except +ValueError:
|
||||||
return toPython(self.thisptr[index], self._parent)
|
return toPython(deref(self.thisptr)[index], self._parent)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
size = self.thisptr.size()
|
size = self.thisptr.size()
|
||||||
@@ -299,6 +302,7 @@ cdef toPythonReader(C_DynamicValue.Reader self, object parent):
|
|||||||
temp = self.asData()
|
temp = self.asData()
|
||||||
return (<char*>temp.begin())[:temp.size()]
|
return (<char*>temp.begin())[:temp.size()]
|
||||||
elif type == capnp.TYPE_LIST:
|
elif type == capnp.TYPE_LIST:
|
||||||
|
print 'list'
|
||||||
return list(_DynamicListReader()._init(self.asList(), parent))
|
return list(_DynamicListReader()._init(self.asList(), parent))
|
||||||
elif type == capnp.TYPE_STRUCT:
|
elif type == capnp.TYPE_STRUCT:
|
||||||
return _DynamicStructReader()._init(self.asStruct(), parent)
|
return _DynamicStructReader()._init(self.asStruct(), parent)
|
||||||
@@ -404,13 +408,16 @@ cdef class _DynamicStructBuilder:
|
|||||||
setattr(person, 'field-with-hyphens', 'foo') # for names that are invalid for python, use setattr
|
setattr(person, 'field-with-hyphens', 'foo') # for names that are invalid for python, use setattr
|
||||||
print getattr(person, 'field-with-hyphens') # for names that are invalid for python, use getattr
|
print getattr(person, 'field-with-hyphens') # for names that are invalid for python, use getattr
|
||||||
"""
|
"""
|
||||||
cdef C_DynamicStruct.Builder thisptr
|
cdef C_DynamicStruct.Builder * thisptr
|
||||||
cdef public object _parent
|
cdef public object _parent
|
||||||
cdef _init(self, C_DynamicStruct.Builder other, object parent):
|
cdef _init(self, C_DynamicStruct.Builder other, object parent):
|
||||||
self.thisptr = other
|
self.thisptr = new C_DynamicStruct.Builder(other)
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __dealloc__(self):
|
||||||
|
del self.thisptr
|
||||||
|
|
||||||
cdef _get(self, field) except +ValueError:
|
cdef _get(self, field) except +ValueError:
|
||||||
return toPython(self.thisptr.get(field), self._parent)
|
return toPython(self.thisptr.get(field), self._parent)
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
|||||||
StructSchema getSchema()
|
StructSchema getSchema()
|
||||||
Maybe[StructSchema.Field] which()
|
Maybe[StructSchema.Field] which()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
Builder(Builder &)
|
||||||
DynamicValueForward.Builder get(char *)
|
DynamicValueForward.Builder get(char *)
|
||||||
bint has(char *) except +ValueError
|
bint has(char *) except +ValueError
|
||||||
void set(char *, DynamicValueForward.Reader&) except +ValueError
|
void set(char *, DynamicValueForward.Reader&) except +ValueError
|
||||||
@@ -117,6 +118,7 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
|||||||
DynamicValueForward.Reader operator[](uint) except +ValueError
|
DynamicValueForward.Reader operator[](uint) except +ValueError
|
||||||
uint size()
|
uint size()
|
||||||
cppclass Builder:
|
cppclass Builder:
|
||||||
|
Builder(Builder &)
|
||||||
DynamicValueForward.Builder operator[](uint)
|
DynamicValueForward.Builder operator[](uint)
|
||||||
uint size()
|
uint size()
|
||||||
void set(uint index, DynamicValueForward.Reader& value) except +ValueError
|
void set(uint index, DynamicValueForward.Reader& value) except +ValueError
|
||||||
|
|||||||
Reference in New Issue
Block a user