mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Add clang-tidy. (#368)
This commit is contained in:
@@ -8,12 +8,13 @@
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
Elements Split(std::string the_text) {
|
||||
Elements Split(const std::string& the_text) {
|
||||
Elements output;
|
||||
std::stringstream ss(the_text);
|
||||
std::string word;
|
||||
while (std::getline(ss, word, ' '))
|
||||
while (std::getline(ss, word, ' ')) {
|
||||
output.push_back(text(word));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
} // namespace
|
||||
@@ -21,37 +22,37 @@ Elements Split(std::string the_text) {
|
||||
/// @brief Return an element drawing the paragraph on multiple lines.
|
||||
/// @ingroup dom
|
||||
/// @see flexbox.
|
||||
Element paragraph(std::string the_text) {
|
||||
return paragraphAlignLeft(std::move(the_text));
|
||||
Element paragraph(const std::string& the_text) {
|
||||
return paragraphAlignLeft(the_text);
|
||||
}
|
||||
|
||||
/// @brief Return an element drawing the paragraph on multiple lines, aligned on
|
||||
/// the left.
|
||||
/// @ingroup dom
|
||||
/// @see flexbox.
|
||||
Element paragraphAlignLeft(std::string the_text) {
|
||||
Element paragraphAlignLeft(const std::string& the_text) {
|
||||
static const auto config = FlexboxConfig().SetGap(1, 0);
|
||||
return flexbox(Split(std::move(the_text)), config);
|
||||
return flexbox(Split(the_text), config);
|
||||
}
|
||||
|
||||
/// @brief Return an element drawing the paragraph on multiple lines, aligned on
|
||||
/// the right.
|
||||
/// @ingroup dom
|
||||
/// @see flexbox.
|
||||
Element paragraphAlignRight(std::string the_text) {
|
||||
Element paragraphAlignRight(const std::string& the_text) {
|
||||
static const auto config =
|
||||
FlexboxConfig().SetGap(1, 0).Set(FlexboxConfig::JustifyContent::FlexEnd);
|
||||
return flexbox(Split(std::move(the_text)), config);
|
||||
return flexbox(Split(the_text), config);
|
||||
}
|
||||
|
||||
/// @brief Return an element drawing the paragraph on multiple lines, aligned on
|
||||
/// the center.
|
||||
/// @ingroup dom
|
||||
/// @see flexbox.
|
||||
Element paragraphAlignCenter(std::string the_text) {
|
||||
Element paragraphAlignCenter(const std::string& the_text) {
|
||||
static const auto config =
|
||||
FlexboxConfig().SetGap(1, 0).Set(FlexboxConfig::JustifyContent::Center);
|
||||
return flexbox(Split(std::move(the_text)), config);
|
||||
return flexbox(Split(the_text), config);
|
||||
}
|
||||
|
||||
/// @brief Return an element drawing the paragraph on multiple lines, aligned
|
||||
@@ -59,10 +60,10 @@ Element paragraphAlignCenter(std::string the_text) {
|
||||
/// the center.
|
||||
/// @ingroup dom
|
||||
/// @see flexbox.
|
||||
Element paragraphAlignJustify(std::string the_text) {
|
||||
Element paragraphAlignJustify(const std::string& the_text) {
|
||||
static const auto config = FlexboxConfig().SetGap(1, 0).Set(
|
||||
FlexboxConfig::JustifyContent::SpaceBetween);
|
||||
Elements words = Split(std::move(the_text));
|
||||
Elements words = Split(the_text);
|
||||
words.push_back(text("") | xflex);
|
||||
return flexbox(std::move(words), config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user