Files
MuditaOS/module-gui/gui/widgets/TextParse.cpp
T
pholat fb586cb4e9 EGD-3229 (#497)
* EGD-3229 text helper classes added with tests - used in tests, plus misc utils needed

No major actual functionality changed - TextClasses added with this PR
are used in tests only in this commit.
* classes needed to rewrite gui::Text added
* some utilities needed to rewrite gui::Text added
* tests added
2020-07-06 16:19:41 +02:00

17 lines
431 B
C++

#include "TextParse.hpp"
#include <sstream>
namespace gui
{
auto textToTextBlocks(const UTF8 &text, Font *font, TextBlock::End end) -> std::list<TextBlock>
{
std::list<TextBlock> lines;
std::stringstream ss(text.c_str());
std::string line;
while (std::getline(ss, line)) {
lines.emplace_back(TextBlock(line, font, end));
}
return lines;
}
} // namespace gui