diff options
Diffstat (limited to 'libforecastio')
-rw-r--r-- | libforecastio/forecast.h | 1 | ||||
-rw-r--r-- | libforecastio/forecasts.c | 20 | ||||
-rw-r--r-- | libforecastio/forecasts.h | 2 |
3 files changed, 23 insertions, 0 deletions
diff --git a/libforecastio/forecast.h b/libforecastio/forecast.h index ccb250d..32a485a 100644 --- a/libforecastio/forecast.h +++ b/libforecastio/forecast.h @@ -67,6 +67,7 @@ public: float GetApparentTemperature(void) { return apparentTemperature; }; float GetHumidity(void) { return humidity; }; float GetWindSpeed(void) { return windSpeed; }; + int GetWindSpeedKnots(void) { return (windSpeed+10)/6; }; int GetWindBearing(void) { return windBearing; }; float GetVisibility(void) { return visibility; }; float GetCloudCover(void) { return cloudCover; }; diff --git a/libforecastio/forecasts.c b/libforecastio/forecasts.c index d7cb908..623a2d6 100644 --- a/libforecastio/forecasts.c +++ b/libforecastio/forecasts.c @@ -48,6 +48,26 @@ void cForecasts::SetForecast(json_t *forecast) { } } +int cForecasts::NumHourly(void) { + int num = 0; + cForecast *f = GetFirstHourly(); + while (f) { + num++; + f = GetNext(); + } + return num; +} + +int cForecasts::NumDaily(void) { + int num = 0; + cForecast *f = GetFirstDaily(); + while (f) { + num++; + f = GetNext(); + } + return num; +} + cForecast *cForecasts::GetForecast(int dataPoint) { if (!dataPoints) return NULL; diff --git a/libforecastio/forecasts.h b/libforecastio/forecasts.h index 9730823..a31a51d 100644 --- a/libforecastio/forecasts.h +++ b/libforecastio/forecasts.h @@ -22,6 +22,8 @@ public: void SetForecastType(eForecastType type) { this->type = type; }; string GetSummary(void) { return summary; }; string GetIcon(void) { return icon; }; + int NumHourly(void); + int NumDaily(void); cForecast *GetForecast(int dataPoint); cForecast *GetCurrent(void); cForecast *GetFirstHourly(void); |