kopia lustrzana https://gitlab.com/tomaszg/geostat
62 wiersze
1.3 KiB
C++
62 wiersze
1.3 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include <unordered_map>
|
|
#include <ctime>
|
|
|
|
#include "cache.h"
|
|
|
|
typedef void CURL;
|
|
class Caches_in_Powertrails;
|
|
|
|
class Powertrail {
|
|
public:
|
|
int number;
|
|
std::string name;
|
|
std::tm date;
|
|
std::string date_str;
|
|
int treshold_perc;
|
|
std::unordered_set<std::string> caches;
|
|
|
|
int found = 0;
|
|
bool completed = 0;
|
|
};
|
|
|
|
class PowertrailDB {
|
|
public:
|
|
std::unordered_map<int, Powertrail> data;
|
|
void get_trail(int n);
|
|
|
|
CURL* curl;
|
|
mutable std::string curl_output;
|
|
|
|
PowertrailDB();
|
|
~PowertrailDB();
|
|
|
|
void read_from_json(std::string file);
|
|
void save_to_json(std::string file);
|
|
|
|
private:
|
|
inline const static std::string url = "https://opencaching.pl/powerTrail.php?ptAction=showSerie&ptrail=";
|
|
inline const static std::string url2 = "https://opencaching.pl/powerTrail/ajaxGetPowerTrailCaches.php?ptAction=showSerie&ptrail=";
|
|
|
|
static size_t write_cb(char* ptr, size_t size, size_t nmemb, void* userdata);
|
|
};
|
|
|
|
class Caches_in_Powertrails {
|
|
public:
|
|
std::unordered_map<std::string, int> data;
|
|
|
|
Caches_in_Powertrails(PowertrailDB db);
|
|
Caches_in_Powertrails() {};
|
|
|
|
void read_from_json(std::string file);
|
|
void save_to_json(std::string file);
|
|
// void update_caches(Caches& cc);
|
|
|
|
private:
|
|
};
|
|
|
|
typedef std::unordered_map<int, const Powertrail*> pPowertrails;
|