Files
comaps/storage/queued_country.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

63 lines
1.8 KiB
C++

#pragma once
#include "storage/diff_scheme/diffs_data_source.hpp"
#include "storage/storage_defines.hpp"
#include "platform/country_defines.hpp"
#include "platform/country_file.hpp"
#include "platform/downloader_defines.hpp"
#include <string>
namespace storage
{
class QueuedCountry
{
public:
class Subscriber
{
public:
virtual void OnCountryInQueue(QueuedCountry const & queuedCountry) = 0;
virtual void OnStartDownloading(QueuedCountry const & queuedCountry) = 0;
virtual void OnDownloadProgress(QueuedCountry const & queuedCountry, downloader::Progress const & progress) = 0;
virtual void OnDownloadFinished(QueuedCountry const & queuedCountry, downloader::DownloadStatus status) = 0;
protected:
virtual ~Subscriber() = default;
};
QueuedCountry(platform::CountryFile const & countryFile, CountryId const & m_countryId,
MapFileType type, int64_t currentDataVersion, std::string const & dataDir,
diffs::DiffsSourcePtr const & diffs);
void Subscribe(Subscriber & subscriber);
void Unsubscribe();
void SetFileType(MapFileType type);
MapFileType GetFileType() const;
CountryId const & GetCountryId() const;
std::string GetRelativeUrl() const;
std::string GetFileDownloadPath() const;
uint64_t GetDownloadSize() const;
void OnCountryInQueue() const;
void OnStartDownloading() const;
void OnDownloadProgress(downloader::Progress const & progress) const;
void OnDownloadFinished(downloader::DownloadStatus status) const;
bool operator==(CountryId const & countryId) const;
private:
platform::CountryFile const m_countryFile;
CountryId const m_countryId;
MapFileType m_fileType;
int64_t m_currentDataVersion;
std::string m_dataDir;
diffs::DiffsSourcePtr m_diffsDataSource;
Subscriber * m_subscriber = nullptr;
};
} // namespace storage