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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#ifndef NEWSBOAT_REGEXMANAGER_H_
#define NEWSBOAT_REGEXMANAGER_H_
#include <map>
#include <memory>
#include <regex.h>
#include <regex>
#include <string>
#include <sys/types.h>
#include <utility>
#include <vector>
#include "configactionhandler.h"
#include "matcher.h"
#include "regexowner.h"
namespace newsboat {
class RegexManager : public ConfigActionHandler {
public:
RegexManager();
void handle_action(const std::string& action,
const std::vector<std::string>& params) override;
void dump_config(std::vector<std::string>& config_output) const override;
void quote_and_highlight(std::string& str, const std::string& location);
void remove_last_regex(const std::string& location);
int article_matches(Matchable* item);
int feed_matches(Matchable* feed);
std::map<size_t, std::string> extract_style_tags(std::string& str);
void insert_style_tags(std::string& str, std::map<size_t, std::string>& tags);
void merge_style_tag(std::map<size_t, std::string>& tags,
const std::string& tag,
size_t start, size_t end);
std::string get_attrs_stfl_string(const std::string& location, bool hasFocus);
private:
typedef std::vector<std::pair<std::shared_ptr<Regex>, std::string>>
RegexStyleVector;
std::map<std::string, RegexStyleVector> locations;
std::vector<std::string> cheat_store_for_dump_config;
std::vector<std::pair<std::shared_ptr<Matcher>, int>> matchers_article;
std::vector<std::pair<std::shared_ptr<Matcher>, int>> matchers_feed;
void handle_highlight_action(const std::vector<std::string>& params);
void handle_highlight_item_action(const std::string& action,
const std::vector<std::string>& params);
};
} // namespace newsboat
#endif /* NEWSBOAT_REGEXMANAGER_H_ */
|