-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
45 lines (34 loc) · 1.38 KB
/
main.cpp
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
#include <QCoreApplication>
#include "query.hpp"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
query_service::CQuery q("46.174.53.176", 7777);
// Ping
q.fetchData(query_service::request_response_type::ping);
qDebug() << q.getPing();
// Information
q.fetchData(query_service::request_response_type::information);
qDebug() << "password: " << q.getHasPassword();
qDebug() << "player count: " << q.getPlayerCount();
qDebug() << "max players: " << q.getMaxPlayers();
qDebug() << "hostname: " << q.getHostname();
qDebug() << "gamemode: " << q.getGamemode();
qDebug() << "language: " << q.getLanguage();
// Rules
q.fetchData(query_service::request_response_type::rules);
QVector<query_service::CData::rule> rules(q.getRules());
foreach(query_service::CData::rule rl, rules)
qDebug() << rl.rule << " : " << rl.value;
// Clients
q.fetchData(query_service::request_response_type::clients);
QVector<query_service::CData::client> clients(q.getClients());
foreach(query_service::CData::client cl, clients)
qDebug() << cl.player_name << " : " << cl.score;
// Detailed clients
q.fetchData(query_service::request_response_type::detailed_clients);
QVector<query_service::CData::player> players(q.getPlayers());
foreach(query_service::CData::player pl, players)
qDebug() << pl.id << " : " << pl.player_name << " : " << pl.score << " : " << pl.ping;
return a.exec();
}