summaryrefslogtreecommitdiff
path: root/include/regexowner.h
blob: 77f0a83543dcf4eb04777b6b7db7898baf1c8843 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef NEWSBOAT_REGEXOWNER_H_
#define NEWSBOAT_REGEXOWNER_H_

#include <memory>
#include <regex.h>
#include <string>
#include <sys/types.h>
#include <utility>
#include <vector>

namespace newsboat {

class Regex {
private:
	explicit Regex(const regex_t& r);

public:
	~Regex();

	static std::unique_ptr<Regex> compile(std::string reg_expression,
		int regcomp_flags, std::string& error);
	std::vector<std::pair<int, int>> matches(std::string input, int max_matches,
			int flags) const;

private:
	regex_t regex;
};

} // namespace newsboat

#endif /* NEWSBOAT_REGEXOWNER_H_ */