#pragma once #include #include #include #include "cypher/cypher.h" #include "cypher/tokenizer/cypher_lexer.hpp" #include "utils/variadic/variadic.hpp" template class QueryStripper { public: QueryStripper(Ts&&... strip_types) : strip_types(std::make_tuple(std::forward(strip_types)...)) {} std::string strip(const std::string& query) { auto tokenizer = lexer.tokenize(query); std::string stripped = ""; int counter = 0; constexpr auto size = std::tuple_size::value; while (auto token = tokenizer.lookup()) { if (_or(token.id, strip_types, std::make_index_sequence{})) { stripped += "@" + std::to_string(counter++); } else { stripped += token.value; } } return stripped; } private: std::tuple strip_types; CypherLexer lexer; template bool _or(Value&& value, Tuple&& tuple, std::index_sequence) { return or_vargs(std::forward(value), std::get(std::forward(tuple))...); } };