]> git.mxchange.org Git - simgear.git/blob - simgear/timing/timezone.h
2efdafffb40b7f75ac44a98cc9d651cc24786dce
[simgear.git] / simgear / timing / timezone.h
1 /* -*- Mode: C++ -*- *****************************************************
2  * timezone.h
3  * Written by Durk Talsma. Started July 1999.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  *
19  **************************************************************************/
20
21 /** \file timezone.h
22  *
23  * Provides SGTimeZone and SGTimeZoneContainer
24  *
25  */
26
27 #ifndef _TIMEZONE_H_
28 #define _TIMEZONE_H_
29
30 #include <stdio.h>
31
32 #include <simgear/timing/geocoord.h>
33
34 /**
35  * SGTimeZone is derived from geocoord, and stores the timezone centerpoint,
36  * as well as the countrycode and the timezone descriptor. The latter is 
37  * used in order to get the local time. 
38  *
39  */
40
41 class SGTimeZone : public SGGeoCoord
42 {
43
44 private:
45
46   string countryCode;
47   string descriptor;
48
49 public:
50
51     /**
52      * Default constructor.
53      */
54     SGTimeZone() : SGGeoCoord()
55     {
56         countryCode.erase(); 
57         descriptor.erase();
58     };
59
60     /**
61      * Build a timezone object with a specifed latitude, longitude, country
62      * code, and descriptor
63      * @param la latitude
64      * @param lo longitude
65      * @param cc country code
66      * @param desc descriptor
67      */
68     SGTimeZone(float la, float lo, char* cc, char* desc);
69
70     /**
71      * Build a timezone object from a textline in zone.tab
72      * @param infoString the textline from zone.tab
73      */
74     SGTimeZone(const char *infoString);
75
76     /**
77      * The copy constructor
78      * @param other the source object
79      */
80     SGTimeZone(const SGTimeZone &other);
81
82     /**
83      * Virutal destructor 
84      */
85     virtual ~SGTimeZone() { };
86   
87     /**
88      * Print the descriptor string
89      */
90     virtual void print() { printf("%s", descriptor.c_str()); }
91
92     /**
93      * Return the descriptor string
94      * @return descriptor string (char array)
95      */
96     virtual const char * getDescription() { return descriptor.c_str(); };
97 };
98
99 /**
100  * SGTimeZoneContainer is derived from SGGeoCoordContainer, and has some 
101  * added functionality.
102  */
103
104 class SGTimeZoneContainer : public SGGeoCoordContainer
105 {
106  public:
107   SGTimeZoneContainer(const char *filename);
108   virtual ~SGTimeZoneContainer();
109 };
110
111
112
113 #endif // _TIMEZONE_H_