New textbox::getline returning an optional<string>

This commit is contained in:
rbrugo
2018-07-08 12:35:14 +02:00
parent 56a9647d56
commit e08bb0bfe1
2 changed files with 30 additions and 0 deletions

View File

@@ -377,6 +377,27 @@ namespace drawerbase {
return false;
}
std::optional<std::string> textbox::getline(std::size_t pos) const
{
auto result = std::string{};
if ( getline(pos, result) )
{
return { std::move(result) };
}
return {};
}
std::optional<std::string> textbox::getline(std::size_t line_index, std::size_t offset) const
{
auto result = std::string{};
if ( getline(line_index, offset, result) )
{
return { std::move(result) };
}
return {};
}
/// Gets the caret position
bool textbox::caret_pos(point& pos, bool text_coordinate) const
{