1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 #include <QtCore/QString>
11 
12 namespace Export {
13 namespace Output {
14 
15 struct Result {
16 	enum class Type : char {
17 		Success,
18 		Error,
19 		FatalError
20 	};
21 
ResultResult22 	Result(Type type, QString path) : path(path), type(type) {
23 	}
24 
SuccessResult25 	static Result Success() {
26 		return Result(Type::Success, QString());
27 	}
28 
isSuccessResult29 	bool isSuccess() const {
30 		return type == Type::Success;
31 	}
isErrorResult32 	bool isError() const {
33 		return (type == Type::Error) || (type == Type::FatalError);
34 	}
isFatalErrorResult35 	bool isFatalError() const {
36 		return (type == Type::FatalError);
37 	}
38 	explicit operator bool() const {
39 		return isSuccess();
40 	}
41 
42 	QString path;
43 	Type type;
44 
45 };
46 
47 } // namespace Output
48 } // namespace Export
49