| 154 | } |
| 155 | |
| 156 | bool |
| 157 | ConfigElements::toBeAdded(const String &element) const |
| 158 | { |
| 159 | /* Exclude the element if it is in the exclusion list. If the list is empty don't exclude anything. */ |
| 160 | bool exclude = (!_exclude.empty() && _exclude.find(element) != _exclude.end()) || |
| 161 | (!_excludePatterns.empty() && _excludePatterns.match(element)); |
| 162 | CacheKeyDebug("%s '%s' %s the 'exclude' rule", name().c_str(), element.c_str(), exclude ? "matches" : "does not match"); |
| 163 | |
| 164 | /* Include the element only if it is in the inclusion list. If the list is empty include everything. */ |
| 165 | bool include = |
| 166 | ((_include.empty() && _includePatterns.empty()) || _include.find(element) != _include.end()) || _includePatterns.match(element); |
| 167 | CacheKeyDebug("%s '%s' %s the 'include' rule", name().c_str(), element.c_str(), include ? "matches" : "do not match"); |
| 168 | |
| 169 | if (include && !exclude) { |
| 170 | CacheKeyDebug("%s '%s' should be added to cache key", name().c_str(), element.c_str()); |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | CacheKeyDebug("%s '%s' should not be added to cache key", name().c_str(), element.c_str()); |
| 175 | return false; |
| 176 | } |
| 177 | |
| 178 | inline bool |
| 179 | ConfigElements::noIncludeExcludeRules() const |
no test coverage detected