aboutsummaryrefslogtreecommitdiff
path: root/src/line_accumulator.h
blob: 69b4c740b95a3251c888f4daaee5a10ea4633a54 (plain)
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
#pragma once

#include <tuple>
#include <string>
#include <vector>
#include <random>

namespace justify {

class LineAccumulator {
	public:
		LineAccumulator(const std::uint8_t max_length, const std::uint8_t offset);
		~LineAccumulator();

		std::uint8_t getMissing() const;

		void operator()(const std::string& token);

	private:
		const std::uint8_t max_length_;
		const std::uint8_t offset_;

		std::uint8_t length_;

		std::vector<
			std::pair<std::string, std::uint8_t>
		> tokens_;

		void justify();
		void discharge(const bool full);

};

}