Utils::Result Class
template <typename T = void> class Utils::ResultResult<T> se uporablja za vračanje vrednosti uspeha ali niza z napako iz funkcije. Več...
| Header: | #include <Result> |
Podroben opis
Tip Result je skrajšana oblika za expected<T, QString>, pri čemer se v primeru uspeha vrne pričakovana vrednost tipa T, nepričakovana vrednost pa je sporočilo o napaki za uporabnika.
Uporabite tip ` Result<> `, kadar nimate konkretne vrednosti za uspeh, ki bi jo želeli vrniti ( ne uporabljajte ` Result<bool>`). V tem primeru vrnite ` Utils::ResultOk `, da označite uspeh. Uporabite lahko tudi priročno funkcijo ` Utils::makeResult `, da združite primere uspeha in napake.
Vrnite vrednost ` Utils::ResultError ` kot priročen razred za primer napake.
Glejte tudi Utils::ResultOk, Utils::ResultError in 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.