LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
dumper.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <variant>
12 #include <QProcess>
13 #include <QFuture>
14 #include "dbconfig.h"
15 
16 namespace LC::Util
17 {
18  class UTIL_DB_API Dumper : public QObject
19  {
20  QProcess * const Dumper_;
21  QProcess * const Restorer_;
22 
23  bool HadError_ = false;
24 
25  int FinishedCount_ = 0;
26  public:
27  struct Finished {};
28  struct Error
29  {
30  QString What_;
31 
32  explicit Error (QString str)
33  : What_ { std::move (str) }
34  {
35  }
36  };
37  using Result_t = std::variant<Finished, Error>;
38  private:
40  public:
41  Dumper (const QString& from, const QString& to, QObject* = nullptr);
42 
43  QFuture<Result_t> GetFuture ();
44  private:
45  void HandleProcessFinished (QProcess*);
46  void HandleProcessError (const QProcess*);
47  void ReportResult (const Result_t&);
48  };
49 }
LC::Util::Dumper::Finished
Definition: dumper.h:39
UTIL_DB_API
#define UTIL_DB_API
Definition: dbconfig.h:16
dbconfig.h
LC::Util
Definition: icoreproxy.h:33
LC::Util::Dumper
Definition: dumper.h:24
QFuture
Definition: idownload.h:17
QFutureInterface< Result_t >
LC::Util::Dumper::Result_t
std::variant< Finished, Error > Result_t
Definition: dumper.h:49