diff options
Diffstat (limited to 'PerlQt/smokeperl.cpp')
-rw-r--r-- | PerlQt/smokeperl.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/PerlQt/smokeperl.cpp b/PerlQt/smokeperl.cpp index 12b6700..1998c85 100644 --- a/PerlQt/smokeperl.cpp +++ b/PerlQt/smokeperl.cpp @@ -1,9 +1,9 @@ #include "smokeperl.h" -class SmokePerlQt : public SmokePerl { +class SmokePerlTQt : public SmokePerl { public: - SmokePerlQt(); - virtual ~SmokePerlQt(); + SmokePerlTQt(); + virtual ~SmokePerlTQt(); void registerSmoke(const char *name, Smoke *smoke); Smoke *getSmoke(const char *name); @@ -41,11 +41,11 @@ private: } HV *package(const SmokeClass &c) { - // for now, we cheat on the class names by assuming they're all Qt:: - if(!strcmp(c.className(), "Qt")) + // for now, we cheat on the class names by assuming they're all TQt:: + if(!strcmp(c.className(), "TQt")) return gv_stashpv(c.className(), TRUE); - SV *name = newSVpv("Qt::", 0); + SV *name = newSVpv("TQt::", 0); sv_catpv(name, c.className() + 1); HV *stash = gv_stashpv(SvPV_nolen(name), TRUE); SvREFCNT_dec(name); @@ -257,10 +257,10 @@ public: bool cleanup() { return true; } }; -class SmokeBindingQt : public SmokeBinding { - SmokePerlQt *_smokeperl; +class SmokeBindingTQt : public SmokeBinding { + SmokePerlTQt *_smokeperl; public: - SmokeBindingQt(Smoke *s, SmokePerlQt *smokeperl) : + SmokeBindingTQt(Smoke *s, SmokePerlTQt *smokeperl) : SmokeBinding(s), _smokeperl(smokeperl) {} void deleted(Smoke::Index classId, void *ptr) { if(do_debug) printf("%p->~%s()\n", ptr, smoke->className(classId)); @@ -305,46 +305,46 @@ public: char *className(Smoke::Index classId) { const char *className = smoke->className(classId); char *buf = new char[strlen(className) + 6]; - strcpy(buf, " Qt::"); + strcpy(buf, " TQt::"); strcat(buf, className + 1); return buf; } }; -SmokePerlQt::SmokePerlQt() { +SmokePerlTQt::SmokePerlTQt() { _registered_smoke = newHV(); _registered_handlers = newHV(); _remembered_pointers = newHV(); } -SmokePerlQt::~SmokePerlQt() { +SmokePerlTQt::~SmokePerlTQt() { SvREFCNT_dec((SV*)_registered_smoke); SvREFCNT_dec((SV*)_registered_handlers); SvREFCNT_dec((SV*)_remembered_pointers); } -void SmokePerlQt::registerSmoke(const char *name, Smoke *smoke) { +void SmokePerlTQt::registerSmoke(const char *name, Smoke *smoke) { hv_store(_registered_smoke, name, strlen(name), newSViv((IV)smoke), 0); // This will also need to handle the per-class initialization - smoke->binding = new SmokeBindingQt(smoke, this); + smoke->binding = new SmokeBindingTQt(smoke, this); } -Smoke *SmokePerlQt::getSmoke(const char *name) { +Smoke *SmokePerlTQt::getSmoke(const char *name) { SV **svp = hv_fetch(_registered_smoke, name, strlen(name), 0); if(svp && SvOK(*svp)) return (Smoke*)SvIV(*svp); return 0; } -void SmokePerlQt::registerHandlers(TypeHandler *h) { +void SmokePerlTQt::registerHandlers(TypeHandler *h) { while(h->name) { hv_store(_registered_handlers, h->name, strlen(h->name), newSViv((IV)h->fn), 0); h++; } } -SmokeObject SmokePerlQt::createObject(void *p, const SmokeClass &c) { +SmokeObject SmokePerlTQt::createObject(void *p, const SmokeClass &c) { HV *hv = newHV(); SV *obj = newRV_noinc((SV*)hv); @@ -364,7 +364,7 @@ SmokeObject SmokePerlQt::createObject(void *p, const SmokeClass &c) { return o; } -SmokeObject SmokePerlQt::newObject(void *p, const SmokeClass &c) { +SmokeObject SmokePerlTQt::newObject(void *p, const SmokeClass &c) { SmokeObject o = createObject(p, c); if(c.isVirtual()) @@ -374,12 +374,12 @@ SmokeObject SmokePerlQt::newObject(void *p, const SmokeClass &c) { return o; } -SmokeObject SmokePerlQt::wrapObject(void *p, const SmokeClass &c) { +SmokeObject SmokePerlTQt::wrapObject(void *p, const SmokeClass &c) { SmokeObject o = createObject(p, c); return o; } -void SmokePerlQt::rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr) { +void SmokePerlTQt::rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr) { void *ptr = o.cast(c); if(ptr != lastptr) { SV *keysv = newSViv((IV)o.ptr()); @@ -400,21 +400,21 @@ void SmokePerlQt::rememberPointer(SmokeObject &o, const SmokeClass &c, bool reme rememberPointer(o, SmokeClass(c.smoke(), *i), remember, ptr); } -void SmokePerlQt::rememberPointer(SmokeObject &o) { +void SmokePerlTQt::rememberPointer(SmokeObject &o) { rememberPointer(o, o.c(), true); } -void SmokePerlQt::forgetPointer(SmokeObject &o) { +void SmokePerlTQt::forgetPointer(SmokeObject &o) { rememberPointer(o, o.c(), false); } -SmokeObject SmokePerlQt::getObject(SV *sv) { +SmokeObject SmokePerlTQt::getObject(SV *sv) { MAGIC *mg = mg_find(SvRV(sv), '~'); Smoke_MAGIC *m = (Smoke_MAGIC*)mg->mg_ptr; return SmokeObject(sv, m); } -SmokeObject SmokePerlQt::getObject(void *p) { +SmokeObject SmokePerlTQt::getObject(void *p) { SV *keysv = newSViv((IV)p); STRLEN klen; char *key = SvPV(keysv, klen); |