diff options
author | Adrian Kummerlaender | 2016-04-01 20:45:40 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2016-04-01 20:45:40 +0200 |
commit | 1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd (patch) | |
tree | 64b4645c911d9e02c984de2e762073b3ff486b25 /src/line_accumulator.h | |
parent | ce9d2ca31e07679292f0a0378792050756d6ab26 (diff) | |
download | justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar.gz justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar.bz2 justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar.lz justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar.xz justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.tar.zst justify-1d6e1df13b1b27bcf7144e03137b9a4f6acbcdcd.zip |
Store spaces alongside tokens instead of as separate nodes
Diffstat (limited to 'src/line_accumulator.h')
-rw-r--r-- | src/line_accumulator.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/line_accumulator.h b/src/line_accumulator.h index ea813a9..b3e78de 100644 --- a/src/line_accumulator.h +++ b/src/line_accumulator.h @@ -1,5 +1,6 @@ #pragma once +#include <tuple> #include <string> #include <vector> @@ -15,16 +16,12 @@ class LineAccumulator { private: const std::size_t max_length_; - utility::Random random_; - std::size_t length_; - std::vector<std::string> tokens_; - std::vector<std::size_t> spaces_; + utility::Random random_; + std::size_t length_; - void add_token(const std::string& token); - void add_space(); - - void increase_space_at(const std::size_t index); - void pop_trailing_token(); + std::vector< + std::pair<std::string, std::uint8_t> + > tokens_; void discharge(const bool full); |