Freeciv21
Develop your civilization from humble roots to a global empire
download.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #ifndef FC__MODPACK_DOWNLOAD_H
14 #define FC__MODPACK_DOWNLOAD_H
15 
16 #include <functional>
17 
18 // Qt
19 #include <QObject>
20 
21 #include "netfile.h"
22 
23 // modinst
24 #include "modinst.h"
25 
26 #define MODPACKDL_SUFFIX ".json"
27 
28 #define MODPACK_CAPSTR "+modpack-1.0"
29 #define MODLIST_CAPSTR "+modpack-index-1.0"
30 
31 #define FCMP_CONTROLD ".control"
32 
34 using dl_pb_callback = std::function<void(int downloaded, int max)>;
35 
36 const char *download_modpack(const QUrl &url, const struct fcmp_params *fcmp,
37  const dl_msg_callback &mcb,
38  const dl_pb_callback &pbcb, int recursion = 0);
39 
40 using modpack_list_setup_cb = std::function<void(
41  const QString &name, const QUrl &url, const QString &version,
42  const QString &license, enum modpack_type type, const QString &subtype,
43  const QString &notes)>;
44 
45 const char *download_modpack_list(const struct fcmp_params *fcmp,
46  const modpack_list_setup_cb &cb,
47  const dl_msg_callback &mcb);
48 
49 #endif // FC__MODPACK_DOWNLOAD_H
std::function< void(int downloaded, int max)> dl_pb_callback
Definition: download.h:34
const char * download_modpack_list(const struct fcmp_params *fcmp, const modpack_list_setup_cb &cb, const dl_msg_callback &mcb)
Download modpack list.
Definition: download.cpp:417
nf_errmsg dl_msg_callback
Definition: download.h:33
const char * download_modpack(const QUrl &url, const struct fcmp_params *fcmp, const dl_msg_callback &mcb, const dl_pb_callback &pbcb, int recursion=0)
Download modpack from a given URL.
Definition: download.cpp:150
std::function< void(const QString &name, const QUrl &url, const QString &version, const QString &license, enum modpack_type type, const QString &subtype, const QString &notes)> modpack_list_setup_cb
Definition: download.h:43
const char * name
Definition: inputfile.cpp:118
struct fcmp_params fcmp
Definition: mpcli.cpp:35
std::function< void(const QString &message)> nf_errmsg
Definition: netfile.h:23
static int recursion[AIT_LAST]
Definition: srv_log.cpp:35