geostat/cache.h

73 wiersze
1.7 KiB
C
Czysty Zwykły widok Historia

2019-09-08 16:42:10 +00:00
#pragma once
#include <string>
#include <set>
#include <iostream>
// enum Service {
// gc,
// ocpl,
// ocde,
// ocna,
// ocro,
// ocuk,
// ocnl,
// gcsu
// };
2019-09-08 16:42:10 +00:00
// 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
// };
class Position {
public:
float lat = 0;
float lon = 0;
Position() = default;
Position(float y, float x) : lat(y), lon(x) {}
2019-09-08 16:42:10 +00:00
};
class Cache {
public:
std::string code;
Position pos;
std::string name;
std::string size;
float diff = 0;
float terr = 0;
2019-09-08 16:42:10 +00:00
std::string type;
2019-09-12 11:58:54 +00:00
std::string region;
std::string origin;
std::string owner;
std::string owner_uuid;
2019-09-08 16:42:10 +00:00
static Position home;
void show() const;
std::string link() const;
2019-09-08 16:42:10 +00:00
float distance() const;
};
class CacheCmp {
public:
bool operator()(const Cache& lhs, const Cache& rhs) const {
return lhs.code < rhs.code;
}
};
bool CacheCmpNS(const Cache& lhs, const Cache& rhs);
bool CacheCmpEW(const Cache& lhs, const Cache& rhs);
bool CacheCmpDist(const Cache& lhs, const Cache& rhs);
typedef std::set<Cache, CacheCmp> Caches;