From eb626939156a33454d6d3bcb604fc87f51352cf1 Mon Sep 17 00:00:00 2001 From: Colin Jermain Date: Tue, 6 Nov 2018 21:11:59 -0500 Subject: [PATCH] Exposing SchemaParser in Cython header --- capnp/lib/capnp.pxd | 12 ++++++++++++ capnp/lib/capnp.pyx | 8 -------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/capnp/lib/capnp.pxd b/capnp/lib/capnp.pxd index dc0ed4e..0882bb7 100644 --- a/capnp/lib/capnp.pxd +++ b/capnp/lib/capnp.pxd @@ -12,6 +12,18 @@ cdef class _StructSchemaField: cdef object _parent cdef _init(self, C_StructSchema.Field other, parent=?) +cdef class _StringArrayPtr: + cdef StringPtr * thisptr + cdef object parent + cdef size_t size + cdef ArrayPtr[StringPtr] asArrayPtr(self) except +reraise_kj_exception + +cdef class SchemaParser: + cdef C_SchemaParser * thisptr + cdef public dict modules_by_id + cdef list _all_imports + cdef _StringArrayPtr _last_import_array + cpdef _parse_disk_file(self, displayName, diskPath, imports) except +reraise_kj_exception cdef class _DynamicOrphan: cdef C_DynamicOrphan thisptr diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index 441f67a..6e62207 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -3101,10 +3101,6 @@ class _EnumModule(object): setattr(self, name, val) cdef class _StringArrayPtr: - cdef StringPtr * thisptr - cdef object parent - cdef size_t size - def __cinit__(self, size_t size, parent): self.size = size self.thisptr = malloc(sizeof(StringPtr) * size) @@ -3122,10 +3118,6 @@ cdef class SchemaParser: Do not use this class unless you're sure you know what you're doing. Use the convenience method :func:`load` instead. """ - cdef C_SchemaParser * thisptr - cdef public dict modules_by_id - cdef list _all_imports - cdef _StringArrayPtr _last_import_array def __cinit__(self): self.thisptr = new C_SchemaParser()