diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmVariableWatch.cxx | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/cmVariableWatch.cxx')
-rw-r--r-- | Source/cmVariableWatch.cxx | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index a200718..ac2f2fa 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -13,22 +13,16 @@ #include "cmAlgorithms.h" -static const char* const cmVariableWatchAccessStrings[] = -{ - "READ_ACCESS", - "UNKNOWN_READ_ACCESS", - "UNKNOWN_DEFINED_ACCESS", - "MODIFIED_ACCESS", - "REMOVED_ACCESS", - "NO_ACCESS" +static const char* const cmVariableWatchAccessStrings[] = { + "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS", + "MODIFIED_ACCESS", "REMOVED_ACCESS", "NO_ACCESS" }; const char* cmVariableWatch::GetAccessAsString(int access_type) { - if ( access_type < 0 || access_type >= cmVariableWatch::NO_ACCESS ) - { + if (access_type < 0 || access_type >= cmVariableWatch::NO_ACCESS) { return "NO_ACCESS"; - } + } return cmVariableWatchAccessStrings[access_type]; } @@ -36,7 +30,7 @@ cmVariableWatch::cmVariableWatch() { } -template<typename C> +template <typename C> void deleteAllSecond(typename C::value_type it) { cmDeleteAll(it.second); @@ -48,8 +42,8 @@ cmVariableWatch::~cmVariableWatch() deleteAllSecond<cmVariableWatch::StringToVectorOfPairs>); } -bool cmVariableWatch::AddWatch(const std::string& variable, - WatchMethod method, void* client_data /*=0*/, +bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method, + void* client_data /*=0*/, DeleteData delete_data /*=0*/) { cmVariableWatch::Pair* p = new cmVariableWatch::Pair; @@ -58,61 +52,51 @@ bool cmVariableWatch::AddWatch(const std::string& variable, p->DeleteDataCall = delete_data; cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable]; cmVariableWatch::VectorOfPairs::size_type cc; - for ( cc = 0; cc < vp->size(); cc ++ ) - { + for (cc = 0; cc < vp->size(); cc++) { cmVariableWatch::Pair* pair = (*vp)[cc]; - if ( pair->Method == method && - client_data && client_data == pair->ClientData) - { + if (pair->Method == method && client_data && + client_data == pair->ClientData) { // Callback already exists return false; - } } + } vp->push_back(p); return true; } void cmVariableWatch::RemoveWatch(const std::string& variable, - WatchMethod method, - void* client_data /*=0*/) + WatchMethod method, void* client_data /*=0*/) { - if ( !this->WatchMap.count(variable) ) - { + if (!this->WatchMap.count(variable)) { return; - } + } cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable]; cmVariableWatch::VectorOfPairs::iterator it; - for ( it = vp->begin(); it != vp->end(); ++it ) - { - if ( (*it)->Method == method && - // If client_data is NULL, we want to disconnect all watches against - // the given method; otherwise match ClientData as well. - (!client_data || (client_data == (*it)->ClientData))) - { + for (it = vp->begin(); it != vp->end(); ++it) { + if ((*it)->Method == method && + // If client_data is NULL, we want to disconnect all watches against + // the given method; otherwise match ClientData as well. + (!client_data || (client_data == (*it)->ClientData))) { delete *it; vp->erase(it); return; - } } + } } -bool cmVariableWatch::VariableAccessed(const std::string& variable, - int access_type, - const char* newValue, - const cmMakefile* mf) const +bool cmVariableWatch::VariableAccessed(const std::string& variable, + int access_type, const char* newValue, + const cmMakefile* mf) const { cmVariableWatch::StringToVectorOfPairs::const_iterator mit = this->WatchMap.find(variable); - if ( mit != this->WatchMap.end() ) - { + if (mit != this->WatchMap.end()) { const cmVariableWatch::VectorOfPairs* vp = &mit->second; cmVariableWatch::VectorOfPairs::const_iterator it; - for ( it = vp->begin(); it != vp->end(); it ++ ) - { - (*it)->Method(variable, access_type, (*it)->ClientData, - newValue, mf); - } - return true; + for (it = vp->begin(); it != vp->end(); it++) { + (*it)->Method(variable, access_type, (*it)->ClientData, newValue, mf); } + return true; + } return false; } |