이 페이지에서

Utils::Result Class

template <typename T = void> class Utils::Result

Result<T>는 함수에서 성공 값이나 오류 문자열을 반환하는 데 사용됩니다. 더 보기...

Header: #include <Result>

자세한 설명

Result typedef는 ` expected<T, QString>`의 약어로, 성공 시에는 ` T ` 유형의 예상 값이 반환되고, 예상치 못한 값이 발생하면 사용자에게 오류 메시지가 표시됩니다.

반환할 구체적인 성공 값이 없는 경우 Result<> 을 타입으로 사용하십시오( Result<bool> 은 사용하지 마십시오 ). 이 경우 성공을 반환하려면 Utils::ResultOk 을 반환하십시오. 또한 편의 함수 Utils::makeResult 을 사용하여 성공 및 오류 경우를 결합할 수도 있습니다.

오류 처리를 위한 편의 클래스로 ` Utils::ResultError ` 값을 반환하십시오.

Utils::ResultOk, Utils::ResultError 및 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.