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

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

namespace justify {

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

		std::uint8_t getMissing() const;

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

	private:
		const std::uint8_t max_length_;

		std::uint8_t length_;

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

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

};

}