/** * @file url_search_params.h * @brief Declaration for the URL Search Params */ #ifndef ADA_URL_PATTERN_REGEX_H #define ADA_URL_PATTERN_REGEX_H #include #include #ifdef ADA_USE_UNSAFE_STD_REGEX_PROVIDER #include #endif // ADA_USE_UNSAFE_STD_REGEX_PROVIDER #if ADA_INCLUDE_URL_PATTERN namespace ada::url_pattern_regex { template concept regex_concept = requires(T t, std::string_view pattern, bool ignore_case, std::string_view input) { // Ensure the class has a type alias 'regex_type' typename T::regex_type; // Function to create a regex instance { T::create_instance(pattern, ignore_case) } -> std::same_as>; // Function to perform regex search { T::regex_search(input, std::declval()) } -> std::same_as>>>; // Function to match regex pattern { T::regex_match(input, std::declval()) } -> std::same_as; // Copy constructor { T(std::declval()) } -> std::same_as; // Move constructor { T(std::declval()) } -> std::same_as; }; #ifdef ADA_USE_UNSAFE_STD_REGEX_PROVIDER class std_regex_provider final { public: std_regex_provider() = default; using regex_type = std::regex; static std::optional create_instance(std::string_view pattern, bool ignore_case); static std::optional>> regex_search( std::string_view input, const regex_type& pattern); static bool regex_match(std::string_view input, const regex_type& pattern); }; #endif // ADA_USE_UNSAFE_STD_REGEX_PROVIDER } // namespace ada::url_pattern_regex #endif // ADA_INCLUDE_URL_PATTERN #endif // ADA_URL_PATTERN_REGEX_H