]> git.sesse.net Git - plocate/blob - needle.h
Remove dependency on non-POSIX header error.h.
[plocate] / needle.h
1 #ifndef _NEEDLE_H
2 #define _NEEDLE_H 1
3
4 #include <regex.h>
5 #include <string>
6
7 struct Needle {
8         enum { STRSTR,
9                REGEX,
10                GLOB } type;
11         std::string str;  // Filled in no matter what.
12         regex_t re;  // For REGEX.
13 };
14
15 bool matches(const Needle &needle, const char *haystack);
16 std::string unescape_glob_to_plain_string(const std::string &needle);
17 regex_t compile_regex(const std::string &needle);
18
19 #endif  // !defined(_NEEDLE_H)