forked from organicmaps/organicmaps
[platform] Use unique_ptr for LocationService vector
Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
This commit is contained in:
parent
02ec5886e8
commit
c3708ac978
1 changed files with 6 additions and 12 deletions
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
class DesktopLocationService : public LocationService, public LocationObserver
|
||||
{
|
||||
std::vector<LocationService *> m_services;
|
||||
std::vector<std::unique_ptr<LocationService>> m_services;
|
||||
PositionFilter m_filter;
|
||||
bool m_reportFirstEvent;
|
||||
|
||||
|
@ -70,26 +70,20 @@ public:
|
|||
: LocationService(observer), m_reportFirstEvent(true)
|
||||
{
|
||||
#if defined(OMIM_OS_MAC)
|
||||
m_services.push_back(CreateAppleLocationService(*this));
|
||||
m_services.push_back(std::unique_ptr<LocationService>(CreateAppleLocationService(*this)));
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~DesktopLocationService()
|
||||
{
|
||||
for (size_t i = 0; i < m_services.size(); ++i)
|
||||
delete m_services[i];
|
||||
}
|
||||
|
||||
virtual void Start()
|
||||
{
|
||||
for (size_t i = 0; i < m_services.size(); ++i)
|
||||
m_services[i]->Start();
|
||||
for (auto & service : m_services)
|
||||
service->Start();
|
||||
}
|
||||
|
||||
virtual void Stop()
|
||||
{
|
||||
for (size_t i = 0; i < m_services.size(); ++i)
|
||||
m_services[i]->Stop();
|
||||
for (auto & service : m_services)
|
||||
service->Stop();
|
||||
m_reportFirstEvent = true;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue