add text() function to class textbox

This commit is contained in:
PearlWang 2019-05-15 09:25:37 +08:00
parent ffa170b5f5
commit 037ef43594

View File

@ -1,4 +1,4 @@
/** /**
* A Textbox Implementation * A Textbox Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
@ -177,6 +177,10 @@ namespace nana
/// Read the text from a specified line with a set offset. It returns true for success. /// Read the text from a specified line with a set offset. It returns true for success.
bool getline(std::size_t line_index,std::size_t offset,std::string& text) const; bool getline(std::size_t line_index,std::size_t offset,std::string& text) const;
// Get all text from textbox.
// It returns a empty string if failed or the textbox is empty.
std::string text() const { return caption(); }
/// Read the text from a specified line; returns an empty optional on failure /// Read the text from a specified line; returns an empty optional on failure
std::optional<std::string> getline(std::size_t pos) const; std::optional<std::string> getline(std::size_t pos) const;