Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CWeatherManager Class Reference

#include <WeatherManager.h>

Inheritance diagram for CWeatherManager:
CInfoLoader ISettingCallback IJobCallback

Public Member Functions

 CWeatherManager (void)
 
 ~CWeatherManager (void) override
 
std::string GetLocation (int iLocation)
 Retrieve the city name for the specified location from the settings.
 
const std::string & GetLastUpdateTime () const
 
const ForecastDayGetForecast (int day) const
 
bool IsFetched ()
 
void Reset ()
 
void SetArea (int iLocation)
 Saves the specified location index to the settings. Call Refresh() afterwards to update weather info for the new location.
 
int GetArea () const
 Retrieves the current location index from the settings.
 
- Public Member Functions inherited from CInfoLoader
 CInfoLoader (unsigned int timeToRefresh=5 *60 *1000)
 
 ~CInfoLoader () override
 
std::string GetInfo (int info)
 
void Refresh ()
 
- Public Member Functions inherited from IJobCallback
virtual ~IJobCallback ()=default
 Destructor for job call back objects.
 
virtual void OnJobAbort (unsigned int jobID, CJob *job)
 An optional callback function used when a job will be aborted.
 
virtual void OnJobProgress (unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job)
 An optional callback function that a job may call while processing.
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed.
 
virtual bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
 The given setting needs to be updated.
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 

Static Public Member Functions

static bool GetSearchResults (const std::string &strSearch, std::string &strResult)
 

Protected Member Functions

CJobGetJob () const override
 
std::string TranslateInfo (int info) const override
 
std::string BusyInfo (int info) const override
 
void OnJobComplete (unsigned int jobID, bool success, CJob *job) override
 The callback used when a job completes.
 
void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed.
 
void OnSettingAction (const std::shared_ptr< const CSetting > &setting) override
 The given setting has been activated.
 

Constructor & Destructor Documentation

◆ CWeatherManager()

CWeatherManager::CWeatherManager ( void )

◆ ~CWeatherManager()

CWeatherManager::~CWeatherManager ( void )
override

Member Function Documentation

◆ BusyInfo()

std::string CWeatherManager::BusyInfo ( int info) const
overrideprotectedvirtual

Reimplemented from CInfoLoader.

◆ GetArea()

int CWeatherManager::GetArea ( ) const

Retrieves the current location index from the settings.

Returns
the active location index (will be in the range [1..MAXLOCATION])

◆ GetForecast()

const ForecastDay & CWeatherManager::GetForecast ( int day) const

◆ GetJob()

CJob * CWeatherManager::GetJob ( ) const
overrideprotectedvirtual

Implements CInfoLoader.

◆ GetLastUpdateTime()

const std::string & CWeatherManager::GetLastUpdateTime ( ) const
inline

◆ GetLocation()

std::string CWeatherManager::GetLocation ( int iLocation)

Retrieve the city name for the specified location from the settings.

Parameters
iLocationthe location index (can be in the range [1..MAXLOCATION])
Returns
the city name (without the accompanying region area code)

◆ GetSearchResults()

static bool CWeatherManager::GetSearchResults ( const std::string & strSearch,
std::string & strResult )
static

◆ IsFetched()

bool CWeatherManager::IsFetched ( )

◆ OnJobComplete()

void CWeatherManager::OnJobComplete ( unsigned int jobID,
bool success,
CJob * job )
overrideprotectedvirtual

The callback used when a job completes.

OnJobComplete is called at the completion of the job's DoWork() function, and is used to return information to the caller on the result of the job. On returning form this function the CJobManager will destroy this job.

Parameters
jobIDthe unique id of the job (as retrieved from CJobManager::AddJob)
successthe result from the DoWork call
jobthe job that has been processed. The job will be destroyed after this function returns
See also
CJobManager and CJob

Reimplemented from CInfoLoader.

◆ OnSettingAction()

void CWeatherManager::OnSettingAction ( const std::shared_ptr< const CSetting > & setting)
overrideprotectedvirtual

The given setting has been activated.

This callback is triggered whenever the given setting has been activated. This callback is only fired for CSettingAction settings.

Parameters
settingThe setting which has been activated.
Todo
maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.

Reimplemented from ISettingCallback.

◆ OnSettingChanged()

void CWeatherManager::OnSettingChanged ( const std::shared_ptr< const CSetting > & setting)
overrideprotectedvirtual

The value of the given setting has changed.

This callback is triggered whenever the value of a setting has been successfully changed (i.e. none of the OnSettingChanging() handlers) has reverted the change.

Parameters
settingThe setting whose value has been changed

Reimplemented from ISettingCallback.

◆ Reset()

void CWeatherManager::Reset ( )

◆ SetArea()

void CWeatherManager::SetArea ( int iLocation)

Saves the specified location index to the settings. Call Refresh() afterwards to update weather info for the new location.

Parameters
iLocationthe new location index (can be in the range [1..MAXLOCATION])

◆ TranslateInfo()

std::string CWeatherManager::TranslateInfo ( int info) const
overrideprotectedvirtual

Reimplemented from CInfoLoader.


The documentation for this class was generated from the following files: