* @brief Check if a property value matches a filter pattern. * * Supports glob-style wildcards anywhere in the pattern: * - '*' matches zero or more characters (e.g., "CT*", "*Scan", "CT*2024*Scan") * - '?' matches exactly one character (e.g., "Child?", "Node_0?") * - No wildcards: exact match * * @param propertyValue The actual property value, or std::nullopt if property does
| 244 | * @return true if the value matches the pattern. |
| 245 | */ |
| 246 | bool MatchesPropertyFilter( |
| 247 | const std::optional<std::string>& propertyValue, |
| 248 | const std::string& filterValue) |
| 249 | { |
| 250 | if (!propertyValue.has_value()) |
| 251 | { |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | if (!ContainsWildcard(filterValue)) |
| 256 | { |
| 257 | return propertyValue.value() == filterValue; |
| 258 | } |
| 259 | |
| 260 | try |
| 261 | { |
| 262 | std::regex pattern(ConvertFilterToRegex(filterValue)); |
| 263 | return std::regex_match(propertyValue.value(), pattern); |
| 264 | } |
| 265 | catch (const std::regex_error&) |
| 266 | { |
| 267 | return false; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * @brief Check if a property key is internal (starts with INTERNAL_PROPERTY_PREFIX). |
no test coverage detected