How do I extend IntegralType properly?

Milian Wolff mail at milianw.de
Fri Apr 10 21:52:36 UTC 2009


Hey guys!

PHP has a "resource" type, which resembles for example file resources, mysql-
result resources etc. To support that, I want to extend IntegralType. I 
thought all I had to do was what I've done in IntegralTypeExtended (attached) 
and adapt my typebuilder, but I'm stuck - it simply doesn't work. In my 
unittest I see that the type is correctly set, yet it seems to be a normal 
IntegralType, i.e. toString() returns "<unknown>" instead of "resource"...

The type-builder is correct, I think (look at the current typebuilder, the 
TODO for resource):

    } else if (type == "resource") {
        AbstractType::Ptr ret(new 
IntegralTypeExtended(IntegralTypeExtended::TypeResource));
        injectType(ret);
        return ret;
    }

I'm lost... Do I have to adapt more methods? E.g. hash() or something?

Or what exactly could be the issue here? I'm not very confident with casting, 
could that be the issue? I mean stuff like IntegralType::dynamicCast(...);
Would that "strip" the IntegralTypeExtended and make it a simple IntegralType?


-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integraltypeextended.cpp
Type: text/x-c++src
Size: 1837 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090410/cdd9a2ea/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integraltypeextended.h
Type: text/x-chdr
Size: 3020 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090410/cdd9a2ea/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: integraltypeextended.patch
Type: text/x-patch
Size: 4414 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090410/cdd9a2ea/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090410/cdd9a2ea/attachment.sig>


More information about the KDevelop-devel mailing list