summaryrefslogtreecommitdiffstats
path: root/kweather/stationdatabase.h
blob: 1e020a9648ae7f2fd698c191b5a863733f22d25b (plain)
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
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: ian reinhart geiser <geiseri@yahoo.com>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef STATIONDATABASE_H
#define STATIONDATABASE_H

#include <qmap.h>
#include <qstring.h>

#include <klocale.h>
#include <kstandarddirs.h>

/**
This is the main database for mapping METAR codes to Station information.

@author ian reinhart geiser
*/

class StationInfo;

class StationDatabase
{
public:
    StationDatabase(const QString path = locate("data", "kweatherservice/stations.dat"));
    ~StationDatabase();

    QString stationNameFromID(const QString& id);

    QString stationLongitudeFromID( const QString &stationID);

    QString stationLatitudeFromID(const QString &stationID);

    QString stationCountryFromID( const QString &stationID);
    
    QString stationIDfromName( const QString &name );

private:
    QMap<QString, StationInfo> theDB;

    bool loadStation( const QString & stationID );

    const QString mPath;
};

#endif