From c1e5ecc0b597774a61c984fe87e26c5268195da1 Mon Sep 17 00:00:00 2001 From: Sergey Magidovich Date: Tue, 19 Apr 2016 13:30:49 +0300 Subject: [PATCH] Select note message with enum. --- indexer/osm_editor.cpp | 18 ++++++++++++++++-- indexer/osm_editor.hpp | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 47962ea4d7..237293d974 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -930,11 +930,25 @@ bool Editor::CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::Mwm return true; } -void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note) +void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, + NoteProblemType const type, string const & note) { auto const version = GetMwmCreationTimeByMwmId(fid.m_mwmId); auto const stringVersion = my::TimestampToString(my::SecondsSinceEpochToTimeT(version)); - ostringstream sstr(note, ios_base::ate); + ostringstream sstr; + + switch (type) + { + case NoteProblemType::PlaceDoesNotExist: + sstr << kPlaceDoesNotExistMessage; + if (!note.empty()) + sstr << " User comments: \"" << note << '\"'; + break; + case NoteProblemType::General: + sstr << note; + break; + } + sstr << " (OSM data version: " << stringVersion << ')'; m_notes->CreateNote(latLon, sstr.str()); } diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index 2499cc3a53..28c5295ea8 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -120,7 +120,14 @@ public: // Predefined messages. static const char * const kPlaceDoesNotExistMessage; - void CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note); + enum class NoteProblemType + { + General, + PlaceDoesNotExist + }; + + void CreateNote(ms::LatLon const & latLon, FeatureID const & fid, + NoteProblemType const type, string const & note); void UploadNotes(string const & key, string const & secret); struct Stats