From ffaaedc7c6c9ae6e4d2fd3a3f4b6d576742831ae Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Thu, 7 Aug 2003 16:26:07 -0400 Subject: ENH: Add remove watch --- Source/cmVariableWatch.cxx | 14 ++++++++++++++ Source/cmVariableWatch.h | 1 + 2 files changed, 15 insertions(+) diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 74548fb..2f5bd03 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -44,6 +44,20 @@ void cmVariableWatch::AddWatch(const std::string& variable, vp->push_back(p); } +void cmVariableWatch::RemoveWatch(const std::string& variable, WatchMethod method) +{ + cmVariableWatch::VectorOfPairs* vp = &m_WatchMap[variable]; + cmVariableWatch::VectorOfPairs::iterator it; + for ( it = vp->begin(); it != vp->end(); ++it ) + { + if ( it->m_Method == method ) + { + vp->erase(it); + return; + } + } +} + void cmVariableWatch::VariableAccessed(const std::string& variable, int access_type) const { cmVariableWatch::StringToVectorOfPairs::const_iterator mit = m_WatchMap.find(variable); diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 9a978bd..4b01c7a 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -36,6 +36,7 @@ public: * Add watch to the variable */ void AddWatch(const std::string& variable, WatchMethod method, void* client_data=0); + void RemoveWatch(const std::string& variable, WatchMethod method); /** * This method is called when variable is accessed -- cgit v0.12