aboutsummaryrefslogtreecommitdiff
path: root/src/line_accumulator.h
blob: 373cb1bef02301a3ab449eba5f3420a972195cf8 (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
#pragma once

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

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

		std::uint8_t getMissing() const;

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

	private:
		const std::uint8_t max_length_;

		std::random_device device_;
		std::mt19937       random_;
		std::uint8_t       length_;

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

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

};