mirror of
http://git.sesse.net/plocate
synced 2025-10-05 23:42:49 +02:00
20 lines
435 B
C++
20 lines
435 B
C++
#ifndef _NEEDLE_H
|
|
#define _NEEDLE_H 1
|
|
|
|
#include <regex.h>
|
|
#include <string>
|
|
|
|
struct Needle {
|
|
enum { STRSTR,
|
|
REGEX,
|
|
GLOB } type;
|
|
std::string str; // Filled in no matter what.
|
|
regex_t re; // For REGEX.
|
|
};
|
|
|
|
bool matches(const Needle &needle, const char *haystack);
|
|
std::string unescape_glob_to_plain_string(const std::string &needle);
|
|
regex_t compile_regex(const std::string &needle);
|
|
|
|
#endif // !defined(_NEEDLE_H)
|