Editor::GetStats

This commit is contained in:
Alex Zolotarev 2016-01-22 17:02:50 +03:00 committed by Sergey Yershov
parent b9468995cc
commit 48b285b28b
2 changed files with 26 additions and 0 deletions

View file

@ -726,4 +726,22 @@ void Editor::Invalidate()
if (m_invalidateFn)
m_invalidateFn();
}
Editor::Stats Editor::GetStats() const
{
Stats stats;
for (auto const & id : m_features)
{
for (auto const & index : id.second)
{
Editor::FeatureTypeInfo const & fti = index.second;
stats.m_edits.push_back(make_pair(FeatureID(id.first, index.first),
fti.m_uploadStatus + " " + fti.m_uploadError));
if (fti.m_uploadStatus == kUploaded)
++stats.m_uploadedCount;
}
}
return stats;
}
} // namespace osm

View file

@ -101,6 +101,14 @@ public:
void UploadChanges(string const & key, string const & secret, TChangesetTags tags,
TFinishUploadCallback callBack = TFinishUploadCallback());
struct Stats
{
/// <id, feature status string>
vector<pair<FeatureID, string>> m_edits;
size_t m_uploadedCount = 0;
};
Stats GetStats() const;
private:
// TODO(AlexZ): Synchronize Save call/make it on a separate thread.
void Save(string const & fullFilePath) const;