DisposeWatch: Make private and constify members

This commit is contained in:
Jonas Kulla 2014-08-12 21:12:28 +02:00
parent 194f70c48c
commit d128375d62
5 changed files with 15 additions and 15 deletions

View File

@ -42,15 +42,7 @@ struct DisposeWatch
{ {
typedef void (C::*NotifyFun)(); typedef void (C::*NotifyFun)();
/* The object owning the prop (and this helper) */ DisposeWatch(C &owner, P *&propLocation, NotifyFun notify = 0)
C *owner;
/* Optional notify method */
const NotifyFun notify;
/* Location of the prop pointer inside the owner */
P *&propLocation;
sigc::connection dispCon;
DisposeWatch(C *owner, P *&propLocation, NotifyFun notify = 0)
: owner(owner), : owner(owner),
notify(notify), notify(notify),
propLocation(propLocation) propLocation(propLocation)
@ -74,13 +66,21 @@ struct DisposeWatch
} }
private: private:
/* The object owning the prop (and this helper) */
C &owner;
/* Optional notify method */
const NotifyFun notify;
/* Location of the prop pointer inside the owner */
P * &propLocation;
sigc::connection dispCon;
void onDisposed() void onDisposed()
{ {
dispCon.disconnect(); dispCon.disconnect();
propLocation = 0; propLocation = 0;
if (notify) if (notify)
(owner->*notify)(); (owner.*notify)();
} }
}; };

View File

@ -67,7 +67,7 @@ struct PlanePrivate
PlanePrivate() PlanePrivate()
: bitmap(0), : bitmap(0),
bitmapWatch(this, bitmap), bitmapWatch(*this, bitmap),
opacity(255), opacity(255),
blendType(BlendNormal), blendType(BlendNormal),
color(&tmp.color), color(&tmp.color),

View File

@ -89,7 +89,7 @@ struct SpritePrivate
SpritePrivate() SpritePrivate()
: bitmap(0), : bitmap(0),
bitmapWatch(this, bitmap), bitmapWatch(*this, bitmap),
srcRect(&tmp.rect), srcRect(&tmp.rect),
mirrored(false), mirrored(false),
bushDepth(0), bushDepth(0),

View File

@ -355,7 +355,7 @@ struct TilemapPrivate
TilemapPrivate(Viewport *viewport) TilemapPrivate(Viewport *viewport)
: viewport(viewport), : viewport(viewport),
tileset(0), tileset(0),
tilesetWatch(this, tileset), tilesetWatch(*this, tileset),
mapData(0), mapData(0),
flashData(0), flashData(0),
priorities(0), priorities(0),

View File

@ -250,9 +250,9 @@ struct WindowPrivate
WindowPrivate(Viewport *viewport = 0) WindowPrivate(Viewport *viewport = 0)
: windowskin(0), : windowskin(0),
windowskinWatch(this, windowskin), windowskinWatch(*this, windowskin),
contents(0), contents(0),
contentsWatch(this, contents, &WindowPrivate::markControlVertDirty), contentsWatch(*this, contents, &WindowPrivate::markControlVertDirty),
bgStretch(true), bgStretch(true),
cursorRect(&tmp.rect), cursorRect(&tmp.rect),
active(true), active(true),