-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUrlHandler.h
85 lines (67 loc) · 1.65 KB
/
UrlHandler.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef __URLHANDLER_H__
#define __URLHANDLER_H__
#include <iostream>
#include "bzfsAPI.h"
/***
* class BaseUrlHandler
***/
class BaseUrlHandler : public bz_BaseURLHandler
{
public:
BaseUrlHandler()
{
_playerIds.clear();
// max data size in bytes (1MB)
_max_data_size = 1048576;
noNOKNotify = false;
dataList = bz_newStringList();
};
~BaseUrlHandler() { bz_deleteStringList(dataList); };
virtual void URLDone(const char * /*URL*/, const void *data, unsigned int size, bool complete);
virtual void URLError(const char * /*URL*/, int /*errorCode*/, const char * /*errorString*/);
virtual void showDataOK(int playerId);
virtual void showDataNOK(int playerId);
virtual void showData(int playerId);
void setPlayerId(int playerId);
bool is_valid_status(const std::string &data);
void setNoNoKNotify(bool notify);
private:
bool noNOKNotify;
protected:
unsigned int _max_data_size;
std::vector<int> _playerIds;
bz_APIStringList *dataList;
};
/***
* Class PlayerInfo
*The PlayerInfo class handles player info queries
***/
class PlayerInfo : public BaseUrlHandler
{
public:
virtual void showDataOK(int playerId);
};
/***
* Class TopScore
* The TopScore class handles the topscore info queries
***/
class TopScore : public BaseUrlHandler
{
public:
virtual void showDataOK(int playerId);
};
/***
* Class TopZelo
* The TopZelo class handles the topzelo info queries
***/
class TopZelo : public BaseUrlHandler
{
public:
virtual void showDataOK(int playerId);
};
class InfoMessage : public BaseUrlHandler
{
public:
virtual void done(const char * /*URL*/, void *data, unsigned int size, bool complete);
};
#endif