MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ ask_one()

std::optional< std::string > MayaFlux::detail::ask_one ( std::string title,
std::string initial,
Portal::Forma::AskValidator validator )
inline

Open a text prompt and wait for the text.

Blocks like pick_one. Only text the validator accepts is returned.

Returns
The text, or nothing when the prompt was cancelled.

Definition at line 37 of file API/Prompt.hpp.

39{
40 auto promise = std::make_shared<std::promise<std::optional<std::string>>>();
41 auto future = promise->get_future();
42
43 Portal::Forma::ask(std::move(title), std::move(initial), std::move(validator),
44 [promise](std::optional<std::string> text) { promise->set_value(std::move(text)); });
45
46 return Parallel::await_future(std::move(future));
47}
T await_future(std::future< T > future)
Definition Dispatch.hpp:153
void ask(std::string title, std::string initial, AskValidator validator, AskCallback callback)
Open a one line text prompt and report what the user typed.
Definition Prompt.cpp:94

Referenced by choose_endpoint().

Here is the caller graph for this function: