export_output_result.h 893 B

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