libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
textwrap.h
Go to the documentation of this file.
1
9#pragma once
10
11
12#include <promeki/config.h>
13#if PROMEKI_ENABLE_CORE
14#include <cstddef>
15#include <promeki/list.h>
16#include <promeki/namespace.h>
17#include <promeki/stringlist.h>
18
19PROMEKI_NAMESPACE_BEGIN
20
21class String;
22
116class TextWrap {
117 public:
119 enum class Policy {
120 Greedy,
121 Balanced,
122 };
123
125 struct Config {
130 int maxCols = 0;
131
138 int maxRows = 0;
139
143 Policy policy = Policy::Balanced;
144
154 bool tryExplicitBreaks = false;
155 };
156
170 static StringList reflow(const String &text, const Config &cfg);
171
205 static List<size_t> rowBreaks(const List<size_t> &wordWidths, const Config &cfg);
206};
207
208PROMEKI_NAMESPACE_END
209
210#endif // PROMEKI_ENABLE_CORE