Utils::Result Class
template <typename T = void> class Utils::ResultTyp Result<T> se používá k vrácení hodnoty označující úspěšné provedení nebo chybového řetězce z funkce. Více...
| Header: | #include <Result> |
Podrobný popis
Typedef Result je zkratkou pro expected<T, QString>, přičemž v případě úspěchu se vrací očekávaná hodnota typu T a neočekávaná hodnota představuje chybovou zprávu pro uživatele.
Použijte typ ` Result<> `, pokud nemáte konkrétní hodnotu pro úspěšné provedení, kterou byste chtěli vrátit ( nepoužívejte ` Result<bool>`). V takovém případě vraťte ` Utils::ResultOk `, abyste označili úspěšné provedení. Můžete také použít pomocnou funkci ` Utils::makeResult `, která kombinuje případy úspěšného provedení a chyby.
V případě chyby vraťte hodnotu typu ` Utils::ResultError ` jako pomocnou třídu.
Viz také Utils::ResultOk, Utils::ResultError a Utils::makeResult.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.