mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-02-23 10:17:18 -05:00
* EGD-3407 gui::Text addded TextFormat class - to store format * EGD-3407 Added gray text to Icon text in sms
29 lines
862 B
C++
29 lines
862 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> blocks;
|
|
std::stringstream ss(text.c_str());
|
|
std::string line;
|
|
while (std::getline(ss, line)) {
|
|
blocks.emplace_back(TextBlock(line, font, end));
|
|
}
|
|
return blocks;
|
|
}
|
|
|
|
auto textToTextBlocks(const UTF8 &text, TextFormat format) -> std::list<TextBlock>
|
|
{
|
|
std::list<TextBlock> blocks;
|
|
std::stringstream ss(text.c_str());
|
|
std::string line;
|
|
while (std::getline(ss, line)) {
|
|
blocks.emplace_back(TextBlock(line, std::make_unique<TextFormat>(format)));
|
|
blocks.back().setEnd(TextBlock::End::Newline);
|
|
}
|
|
return blocks;
|
|
}
|
|
} // namespace gui
|