LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
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
16namespace 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}
std::variant< Finished, Error > Result_t
Definition: dumper.h:37
#define UTIL_DB_API
Definition: dbconfig.h:16
STL namespace.
Error(QString str)
Definition: dumper.h:32