blob: 919babca66479826cbb326c5583989450d10667a (
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
32
33
34
35
36
37
38
39
|
#ifndef LISTFORMATTER__H
#define LISTFORMATTER__H
#include <climits>
#include <vector>
#include <string>
#include <utility>
#include <regexmanager.h>
namespace newsbeuter {
class listformatter {
typedef std::pair<std::string, unsigned int> line_id_pair;
public:
listformatter();
~listformatter();
void add_line(const std::string& text, unsigned int id = UINT_MAX,
unsigned int width = 0);
void add_lines(const std::vector<std::string>& lines,
unsigned int width = 0);
void set_line(const unsigned int itempos, const std::string& text,
unsigned int id = UINT_MAX, unsigned int width = 0);
inline void clear() { lines.clear(); }
std::string format_list(regexmanager * r = nullptr,
const std::string& location = "");
inline unsigned int get_lines_count() {
return lines.size();
}
private:
std::vector<line_id_pair> lines;
std::string format_cache;
};
}
#endif
|