summaryrefslogtreecommitdiff
path: root/include/listformatter.h
blob: f140fdc9628f757a8878b8bfef89282ca675633c (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
#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);
		std::string format_list(regexmanager * r = NULL, const std::string& location = "");
		inline unsigned int get_lines_count() { return lines.size(); }
	private:
		std::vector<line_id_pair> lines;
		std::string format_cache;
		bool refresh_cache;
};

}

#endif