-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMegaAppRequestListener.h
More file actions
34 lines (30 loc) · 965 Bytes
/
MegaAppRequestListener.h
File metadata and controls
34 lines (30 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Created by zerocool on 12/11/22.
//
#include "megaapi.h"
#include <condition_variable>
#include <mutex>
#include <cstdint>
class MegaAppRequestListener : public mega::MegaRequestListener
{
private:
std::condition_variable m_cv;
std::mutex m_mu;
bool m_notified;
mega::MegaNode *m_publicNode;
mega::MegaError *m_err;
mega::MegaApi *m_api;
private:
void onRequestStart(mega::MegaApi* api, mega::MegaRequest *request);
void onRequestUpdate(mega::MegaApi* api,mega::MegaRequest *request);
void onRequestFinish(mega::MegaApi* api, mega::MegaRequest *request, mega::MegaError* e);
void onRequestTemporaryError(mega::MegaApi* api, mega::MegaRequest *request, mega::MegaError* error);
void lockAndNotify();
public:
MegaAppRequestListener(mega::MegaApi *m_api);
mega::MegaNode* GetPublicNode();
void SetPublicNode(mega::MegaNode *node);
mega::MegaError* GetError();
void Reset();
void Wait();
};