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
|
#include <string.h>
#include <strings.h>
#include "errors.h"
// Old URL
//#define METAR_URL "http://weather.noaa.gov/pub/data/observations/metar/decoded/%s.TXT"
// New URL
#define METAR_URL "http://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT"
class localtemp {
public:
enum ESky
{
undef_sky,
clear, // CAVOK, SKC, CLR
cloudy, // FEW, SCT
brkovc, // Broken, Overcast (BKN, OVC)
tcu // TCU (Towering CUmulus)
};
enum ERain
{
undef_rain,
rain, // Rainy (DZ, RA)
snow, // Snowy (SN, SG)
hail // Hail (GS, GR)
};
enum EFog
{
undef_fog,
fog, // (BR, FG)
dust, // (DU, DS)
other // (FC, FU, HZ, SA, SS, VA)
};
struct TMetar
{
ESky sky;
bool CB; // Cumulonimbus
ERain rain;
EFog fog;
};
std::string metar;
std::string location_name;
std::string long_location;
std::string ob; // ob: line, METAR info.
int error, celsius, fahrenheit;
int theme; // º theme to use
short humidity;
bool loaded;
string sky;
TMetar mInfo;
time_t info_time; // Time stored in file
time_t get_time; // Time when we got the file
localtemp(char* metar, char* location_name);
bool getInfo();
private:
void set_temp(std::string temp);
void set_humidity(std::string hum);
void get_ob_info();
};
|