#pragma once #include #include #include #include #include #include // enum Service { // gc, // ocpl, // ocde, // ocna, // ocro, // ocuk, // ocnl, // gcsu // }; // enum Type { // traditional, // multi, // quiz, // also known as "Mystery" // moving, // a geocache with changing coordinates // virt, // webcam, // other, // also dubbed "unknown type"; allows OC users to create special caches which don't fit into the scheme of well-known types // event, // a peculiar type of geocache which is NOT a geocache at all, but it is stored as a geocache in OC database. Just keep in mind, that in case of Event Caches, some fields may have a little different meaning than you would tell by their name // own, // a moving geocache which is carried by the owner // podcast //a geocache with attached MP3 file(s). The MP3 data is not accessible via OKAPI. This type is only in use at Opencaching.US // }; const int Earth_radius = 6378; const double Pi = 3.14159265358979323846264338327950288; class Position { public: float lat = 0; float lon = 0; Position() = default; Position(float y, float x) : lat(y), lon(x) {} }; class Cache { public: std::string code; Position pos; std::string name; std::string size; float diff = 0; float terr = 0; int fav = 0; int founds = 0; std::string type; std::string region; std::string origin; std::string owner; std::string owner_uuid; std::time_t date_t; std::time_t date_hidden_t; std::tm date_tm; std::tm date_hidden_tm; std::string year; std::string mon; std::string day; std::string hour; std::string day_of_week; std::string date; std::string date_hidden; void set_date(const std::tm& t); void set_date_hidden(const std::tm& t); static Position home; void show() const; std::string link() const; std::string safe_name() const; float distance() const; }; class CacheCmp { public: bool operator()(const Cache& lhs, const Cache& rhs) const { return lhs.code < rhs.code; } }; typedef std::set Caches; typedef std::multimap Date_Caches; typedef std::vector Sorted_Caches; float cache_distance(const Cache& a, const Cache& b);