Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2011-07-03 21:16:43 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:20:30 +0300
commitae88aa1971d63e506ba54000dc3aa53135534eb2 (patch)
treef96aa393b5385ff30707a484e88f455cbe69bf4f /storage
parentadde2107d1effebd18358b60bc190c7bd4e5d75b (diff)
[Refactoring] Use mwm-file descriptor (string name) in Index. Open FileReader only when necessary.
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp16
-rw-r--r--storage/storage.hpp5
2 files changed, 13 insertions, 8 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index c756acca1e..9ecbfd0dcd 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -53,7 +53,6 @@ namespace storage
m_removeMap = removeFunc;
m_updateRect = updateRectFunc;
- typedef vector<ModelReaderPtr> map_list_t;
map_list_t filesList;
enumMapsFunc(filesList);
@@ -170,8 +169,7 @@ namespace storage
}
void operator()(TTile const & tile)
{
- string const file = m_workingDir + tile.first;
- m_removeFn(file);
+ m_removeFn(tile.first);
}
};
@@ -353,12 +351,18 @@ namespace storage
if (size.second != 0)
m_countryProgress.m_current = size.first;
- /// @todo Get file reader from download framework.
+ // get file descriptor
+ string file = result.m_file;
+ string::size_type const i = file.find_last_of('/');
+ if (i != string::npos)
+ file = file.substr(i+1);
+
// activate downloaded map piece
- m_addMap(new FileReader(result.m_file));
+ m_addMap(file);
+ // update rect from downloaded file
feature::DataHeader header;
- header.Load(FilesContainerR(result.m_file).GetReader(HEADER_FILE_TAG));
+ header.Load(FilesContainerR(GetPlatform().GetReader(file)).GetReader(HEADER_FILE_TAG));
m_updateRect(header.GetBounds());
}
DownloadNextCountryFromQueue();
diff --git a/storage/storage.hpp b/storage/storage.hpp
index 9e8a482ebe..a691cde90b 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -88,11 +88,12 @@ namespace storage
/// @name Communicate with Framework
//@{
+ typedef vector<string> map_list_t;
public:
- typedef function<void (ModelReaderPtr const &)> TAddMapFunction;
+ typedef function<void (string const &)> TAddMapFunction;
typedef function<void (string const &)> TRemoveMapFunction;
typedef function<void (m2::RectD const & r)> TUpdateRectFunction;
- typedef function<void (vector<ModelReaderPtr> &)> TEnumMapsFunction;
+ typedef function<void (map_list_t &)> TEnumMapsFunction;
private:
TAddMapFunction m_addMap;