AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ACurlMulti.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12#pragma once
13
14#include "ACurl.h"
15#include <AUI/Common/AMap.h>
16#include <AUI/Util/AFunctionQueue.h>
17
44class API_AUI_CURL ACurlMulti: public AObject {
45public:
46 ACurlMulti() noexcept;
48
49 ACurlMulti(ACurlMulti&& other) noexcept: mMulti(other.mMulti) {
50 other.mMulti = nullptr;
51 }
52
53 ACurlMulti& operator<<(_<ACurl> curl);
54 ACurlMulti& operator>>(const _<ACurl>& curl);
55
56 void run() {
57 run(false);
58 }
59
60 void cancel() {
61 mCancelled = true;
62 }
63
64 void clear();
65
66 [[nodiscard]]
67 const AMap<void*, _<ACurl>>& curls() const {
68 return mEasyCurls;
69 }
70
74 static ACurlMulti& global() noexcept;
75
76private:
77 void run(bool infinite);
78
79 void processQueueAndThreadMessages();
80
81 AFunctionQueue mFunctionQueue;
82
83 void* mMulti;
84 bool mCancelled = false;
85 AMap<void*, _<ACurl>> mEasyCurls;
86
87 void removeCurl(const _<ACurl>& curl);
88};
89
90
Multi curl instance.
Definition: ACurlMulti.h:44
Thread-safe implementation of function queue.
Definition: AFunctionQueue.h:21
A std::map with AUI extensions.
Definition: AMap.h:218
A base object class.
Definition: AObject.h:49
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:177