diff options
Diffstat (limited to 'Source/cmVariableWatch.h')
-rw-r--r-- | Source/cmVariableWatch.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 2f082af..be8f72f 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -25,7 +25,8 @@ class cmVariableWatch { public: typedef void (*WatchMethod)(const std::string& variable, int access_type, - void* client_data, const char* newValue, const cmMakefile* mf); + void* client_data, const char* newValue, + const cmMakefile* mf); typedef void (*DeleteData)(void* client_data); cmVariableWatch(); @@ -35,28 +36,28 @@ public: * Add watch to the variable */ bool AddWatch(const std::string& variable, WatchMethod method, - void* client_data=0, DeleteData delete_data=0); + void* client_data = 0, DeleteData delete_data = 0); void RemoveWatch(const std::string& variable, WatchMethod method, - void* client_data=0); + void* client_data = 0); /** * This method is called when variable is accessed */ bool VariableAccessed(const std::string& variable, int access_type, - const char* newValue, const cmMakefile* mf) const; + const char* newValue, const cmMakefile* mf) const; /** * Different access types. */ enum - { + { VARIABLE_READ_ACCESS = 0, UNKNOWN_VARIABLE_READ_ACCESS, UNKNOWN_VARIABLE_DEFINED_ACCESS, VARIABLE_MODIFIED_ACCESS, VARIABLE_REMOVED_ACCESS, NO_ACCESS - }; + }; /** * Return the access as string @@ -67,23 +68,26 @@ protected: struct Pair { WatchMethod Method; - void* ClientData; - DeleteData DeleteDataCall; - Pair() : Method(0), ClientData(0), DeleteDataCall(0) {} + void* ClientData; + DeleteData DeleteDataCall; + Pair() + : Method(0) + , ClientData(0) + , DeleteDataCall(0) + { + } ~Pair() - { - if (this->DeleteDataCall && this->ClientData) - { + { + if (this->DeleteDataCall && this->ClientData) { this->DeleteDataCall(this->ClientData); - } } + } }; - typedef std::vector< Pair* > VectorOfPairs; - typedef std::map<std::string, VectorOfPairs > StringToVectorOfPairs; + typedef std::vector<Pair*> VectorOfPairs; + typedef std::map<std::string, VectorOfPairs> StringToVectorOfPairs; StringToVectorOfPairs WatchMap; }; - #endif |