[Kde-bindings] Adding an mf_attribute flag to MethodFlags in smoke.h
Tobias Rautenkranz
tobias at rautenkranz.ch
Wed Oct 21 16:03:43 UTC 2009
> If we're at it we could also add sizeof() information for classes (for
> dynamic list marshallers)
If I understand correctly, you need the sizeof to make sure the class is
stored on the heap by the container.
e.g. QList<T> stores the objects directly in the array when
sizeof(T) <= sizeof(void*) and on the heap otherwise.
template <typename T>
Q_INLINE_TEMPLATE void QList<T>::node_construct(Node *n, const T &t)
{
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
n->v = new T(t); // on the heap
else if (QTypeInfo<T>::isComplex)
new (n) T(t); // "placement new" -- in place
else
*reinterpret_cast<T*>(n) = t; // in place (no constructor)
}
A "Placement new" constructor is not supported by smoke, but one could still
implement the marshaling for large types. (neglecting the third case)
Thus one could also use a cf_large flag instead of the sizeof?
More information about the Kde-bindings
mailing list