summaryrefslogtreecommitdiffstats
path: root/Source/cmVariableWatch.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVariableWatch.h')
-rw-r--r--Source/cmVariableWatch.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 45273e5..d666815 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -26,6 +26,7 @@ class cmVariableWatch
public:
typedef void (*WatchMethod)(const std::string& variable, int access_type,
void* client_data, const char* newValue, const cmMakefile* mf);
+ typedef void (*DeleteData)(void* client_data);
cmVariableWatch();
~cmVariableWatch();
@@ -34,7 +35,7 @@ public:
* Add watch to the variable
*/
void AddWatch(const std::string& variable, WatchMethod method,
- void* client_data=0);
+ void* client_data=0, DeleteData delete_data=0);
void RemoveWatch(const std::string& variable, WatchMethod method);
/**
@@ -67,7 +68,15 @@ protected:
{
WatchMethod Method;
void* ClientData;
- Pair() : Method(0), ClientData(0) {}
+ DeleteData DeleteDataCall;
+ Pair() : Method(0), ClientData(0), DeleteDataCall(0) {}
+ ~Pair()
+ {
+ if (this->DeleteDataCall && this->ClientData)
+ {
+ this->DeleteDataCall(this->ClientData);
+ }
+ }
};
typedef std::vector< Pair* > VectorOfPairs;