Add some useful _StructSchema, reader, and builder methods

This adds:
 - _StructSchema.fieldnames
 - _DynamicStructBuilder.as_reader
 - _DynamicStruct{Reader,Builder}.schema and __dir__

This makes the reader and builder types much easier to navigate in ipython.
This commit is contained in:
Andy Lutomirski
2013-08-28 14:34:37 -07:00
parent aa16a0de44
commit 79ae83a6cb
2 changed files with 42 additions and 8 deletions

View File

@@ -33,19 +33,15 @@ cdef extern from "capnp/schema.h" namespace " ::capnp":
Schema getDependency(uint64_t id) except +
#InterfaceSchema asInterface() const;
cdef cppclass MemberForward" ::capnp::StructSchema::Field":
pass
cdef cppclass StructSchema(Schema):
cppclass FieldList:
uint size()
MemberForward operator[](uint index)
cppclass Field:
StructNode.Member.Reader getProto()
StructSchema getContainingStruct()
uint getIndex()
FieldList getFields()
cppclass FieldList:
uint size()
Field operator[](uint index)
Node.Reader getProto()
FieldList getFields()
@@ -104,6 +100,7 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
DynamicValueForward.Builder init(char *)
StructSchema getSchema()
Maybe[StructSchema.Field] which()
DynamicStruct.Reader asReader()
cdef extern from "fixMaybe.h":
StructSchema.Field fixMaybe(Maybe[StructSchema.Field]) except+