mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 07:10:02 +01:00
Reworks the window rule syntax completely --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
17 lines
No EOL
470 B
C++
17 lines
No EOL
470 B
C++
#include "RegexMatchEngine.hpp"
|
|
#include <re2/re2.h>
|
|
|
|
using namespace Desktop::Rule;
|
|
|
|
CRegexMatchEngine::CRegexMatchEngine(const std::string& regex) {
|
|
if (regex.starts_with("negative:")) {
|
|
m_negative = true;
|
|
m_regex = makeUnique<re2::RE2>(regex.substr(9));
|
|
return;
|
|
}
|
|
m_regex = makeUnique<re2::RE2>(regex);
|
|
}
|
|
|
|
bool CRegexMatchEngine::match(const std::string& other) {
|
|
return re2::RE2::FullMatch(other, *m_regex) != m_negative;
|
|
} |