[Kde-bindings] idea: data structure for templates
Petr Vanek
petr at scribus.info
Mon Sep 21 08:36:31 UTC 2009
hi all,
this is just a proposal: what about to expand Smoke with new structure
(s) keeping informations about template types?
More detailed:
there are types stored in Type *types; array. And you can get e.g.
"QList<QVariant>" a a type.
Now I have to "parse" this string to get QVariant template value.
So if the TypeFlags will be extended with tf_template and struct Type
will have "template" anchor to "templateList" (0 separated, with
indexes to its template subtypes), it should (imho) simplify a lot of
bindings code.
QList<QVariant>
-> index in the Type *types -> { name = "QList<QVariant>",
classId=123..., flags=as for now+tf_template, template=9999 } -> 9999
is index into the templatesList with index of QVariant only.
QList<QPair<qreal, QPointF> >
-> *type { name="QList<QPair<qreal, QPointF> >", ..., flags+=
tf_template, template=88888} -> 88888 is index to templatesList with
index to QPair<qreal,QPointF> type -> it will contains next index in
the templatesList with indexes to qreal a nd QPointF.
What I expect from it?
+ less mess in the "marshalling" parts of binding language code - see
e.g. Ruby's macro/templating "hell".
+ it will allow to write really abstract code for these cases. Not
enumerated only.
What against it:
- it will make smoke lib larger, need to test generators
- all can be achieved in custom (langiage binging) code too
(unfortunately with huge amount of code)
I hope I explained that you can understand it a bit.
cheers,
Petr
More information about the Kde-bindings
mailing list