"Fossies" - the Fresh Open Source Software Archive 
Member "tdesktop-2.6.1/Telegram/SourceFiles/export/output/export_output_file.h" (24 Feb 2021, 1179 Bytes) of package /linux/misc/tdesktop-2.6.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "export_output_file.h" see the
Fossies "Dox" file reference documentation.
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 "base/optional.h"
11
12 #include <QtCore/QFile>
13 #include <QtCore/QString>
14 #include <QtCore/QByteArray>
15
16 namespace Export {
17 namespace Output {
18
19 struct Result;
20 class Stats;
21
22 class File {
23 public:
24 File(const QString &path, Stats *stats);
25
26 [[nodiscard]] int size() const;
27 [[nodiscard]] bool empty() const;
28
29 [[nodiscard]] Result writeBlock(const QByteArray &block);
30
31 [[nodiscard]] static QString PrepareRelativePath(
32 const QString &folder,
33 const QString &suggested);
34
35 [[nodiscard]] static Result Copy(
36 const QString &source,
37 const QString &path,
38 Stats *stats);
39
40 private:
41 [[nodiscard]] Result reopen();
42 [[nodiscard]] Result writeBlockAttempt(const QByteArray &block);
43
44 [[nodiscard]] Result error() const;
45 [[nodiscard]] Result fatalError() const;
46
47 QString _path;
48 int _offset = 0;
49 std::optional<QFile> _file;
50
51 Stats *_stats = nullptr;
52 bool _inStats = false;
53
54 };
55
56 } // namespace Output
57 } // namespace File