diff options
author | vng <viktor.govako@gmail.com> | 2013-08-16 18:59:44 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:59:45 +0300 |
commit | e2dd416da70ceb04f756cba5a33b3acfb103ef45 (patch) | |
tree | b459123174b61ab29f52fa36dde905469dc6e580 /map/bookmark.cpp | |
parent | 1269e13617f552b6404efca5bbf3c4b2107349f8 (diff) |
Save last category and color for bookmarks.
Diffstat (limited to 'map/bookmark.cpp')
-rw-r--r-- | map/bookmark.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/map/bookmark.cpp b/map/bookmark.cpp index da23f9ee3f..efdb28780f 100644 --- a/map/bookmark.cpp +++ b/map/bookmark.cpp @@ -105,27 +105,28 @@ namespace } } -namespace bookmark_impl +namespace { + static char const * s_arrSupportedColors[] = + { + "placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow", + "placemark-pink", "placemark-brown", "placemark-green", "placemark-orange" + }; + class KMLParser { // Fixes icons which are not supported by MapsWithMe string GetSupportedBMType(string const & s) const { - static char const * icons[] = { - "placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow", - "placemark-pink", "placemark-brown", "placemark-green", "placemark-orange" - }; - // Remove leading '#' symbol string const result = s.substr(1); - for (size_t i = 0; i < ARRAY_SIZE(icons); ++i) - if (result == icons[i]) + for (size_t i = 0; i < ARRAY_SIZE(s_arrSupportedColors); ++i) + if (result == s_arrSupportedColors[i]) return result; // Not recognized symbols are replaced with default one LOG(LWARNING, ("Icon", result, "for bookmark", m_name, "is not supported")); - return icons[0]; + return s_arrSupportedColors[0]; } BookmarkCategory & m_category; @@ -273,10 +274,15 @@ namespace bookmark_impl }; } +string BookmarkCategory::GetDefaultType() +{ + return s_arrSupportedColors[0]; +} + bool BookmarkCategory::LoadFromKML(ReaderPtr<Reader> const & reader) { ReaderSource<ReaderPtr<Reader> > src(reader); - bookmark_impl::KMLParser parser(*this); + KMLParser parser(*this); if (ParseXML(src, parser, true)) return true; else |