diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2012-09-03 00:17:46 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:42:58 +0300 |
commit | 3d8dd56e9d2827f85286473b753f1f2d10334e67 (patch) | |
tree | 2825ff72f59e8ad34b76a671051d33e29862863d /map/bookmark.hpp | |
parent | 113d7e655c7bc32f610410c1f393e60c619230e4 (diff) |
[bookmarks] Added file save/load methods
Diffstat (limited to 'map/bookmark.hpp')
-rw-r--r-- | map/bookmark.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/map/bookmark.hpp b/map/bookmark.hpp index 9e23d69e9e..b529bd0797 100644 --- a/map/bookmark.hpp +++ b/map/bookmark.hpp @@ -36,6 +36,8 @@ class BookmarkCategory : private noncopyable string m_name; vector<Bookmark *> m_bookmarks; bool m_visible; + /// Stores file name from which category was loaded + string m_file; public: BookmarkCategory(string const & name) : m_name(name), m_visible(true) {} @@ -49,6 +51,7 @@ public: bool IsVisible() const { return m_visible; } void SetName(string const & name) { m_name = name; } string GetName() const { return m_name; } + string GetFileName() const { return m_file; } inline size_t GetBookmarksCount() const { return m_bookmarks.size(); } Bookmark const * GetBookmark(size_t index) const; @@ -56,6 +59,12 @@ public: void LoadFromKML(ReaderPtr<Reader> const & reader); void SaveToKML(ostream & s); + /// @return 0 in the case of error + static BookmarkCategory * CreateFromKMLFile(string const & file); + /// Uses the same file name from which was loaded, or + /// creates unique file name on first save and uses it every time + /// @param[in] path directory name where to save + bool SaveToKMLFileAtPath(string const & path); }; /// Non-const category is needed to "edit" bookmark (actually, re-add it) |