forked from organicmaps/organicmaps-tmp
Removed unused code
This commit is contained in:
parent
6b09ff6943
commit
aedeb045ff
4 changed files with 11 additions and 65 deletions
|
@ -67,7 +67,6 @@ namespace update
|
|||
}
|
||||
|
||||
TCommonFiles commonFiles;
|
||||
TDataFiles dataFiles;
|
||||
|
||||
for (Platform::FilesList::iterator it = files.begin(); it != files.end(); ++it)
|
||||
{
|
||||
|
@ -78,7 +77,7 @@ namespace update
|
|||
commonFiles.push_back(make_pair(*it, static_cast<uint32_t>(size)));
|
||||
}
|
||||
|
||||
SaveTiles(dataDir + DATA_UPDATE_FILE, -1, dataFiles, commonFiles);
|
||||
SaveTiles(dataDir + DATA_UPDATE_FILE, commonFiles);
|
||||
|
||||
LOG_SHORT(LINFO, ("Created update file with ", commonFiles.size(), " files"));
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "country.hpp"
|
||||
|
||||
#include "../defines.hpp"
|
||||
|
||||
#include "../version/version.hpp"
|
||||
|
||||
#include "../platform/platform.hpp"
|
||||
|
@ -77,13 +79,6 @@ namespace storage
|
|||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// template <class TArchive> TArchive & operator << (TArchive & ar, storage::Country const & country)
|
||||
// {
|
||||
// ar << country.m_name;
|
||||
// ar << country.m_tiles;
|
||||
// return ar;
|
||||
// }
|
||||
|
||||
bool LoadCountries(file_t const & file, TTilesContainer const & sortedTiles,
|
||||
TCountriesContainer & countries)
|
||||
{
|
||||
|
@ -154,15 +149,13 @@ namespace storage
|
|||
return countries.SiblingsCount() > 0;
|
||||
}
|
||||
|
||||
void SaveTiles(string const & file, int32_t level, TDataFiles const & cellFiles, TCommonFiles const & commonFiles)
|
||||
void SaveTiles(string const & file, TCommonFiles const & commonFiles)
|
||||
{
|
||||
FileWriter writer(file);
|
||||
stream::SinkWriterStream<Writer> wStream(writer);
|
||||
|
||||
// save version - it's equal to current date in GMT
|
||||
wStream << my::TodayAsYYMMDD();
|
||||
wStream << level;
|
||||
wStream << cellFiles;
|
||||
wStream << commonFiles;
|
||||
}
|
||||
|
||||
|
@ -175,19 +168,13 @@ namespace storage
|
|||
ReaderSource<file_t> source(file);
|
||||
stream::SinkReaderStream<ReaderSource<file_t> > stream(source);
|
||||
|
||||
TDataFiles dataFiles;
|
||||
TCommonFiles commonFiles;
|
||||
|
||||
int32_t level = -1;
|
||||
stream >> dataVersion;
|
||||
stream >> level;
|
||||
stream >> dataFiles;
|
||||
stream >> commonFiles;
|
||||
|
||||
tiles.reserve(dataFiles.size() + commonFiles.size());
|
||||
tiles.reserve(commonFiles.size());
|
||||
|
||||
for (TDataFiles::iterator it = dataFiles.begin(); it != dataFiles.end(); ++it)
|
||||
tiles.push_back(TTile(CountryCellId::FromBitsAndLevel(it->first, level).ToString(), it->second));
|
||||
for (TCommonFiles::iterator it = commonFiles.begin(); it != commonFiles.end(); ++it)
|
||||
tiles.push_back(TTile(it->first, it->second));
|
||||
|
||||
|
@ -201,11 +188,4 @@ namespace storage
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
// void SaveCountries(TCountriesContainer const & countries, Writer & writer)
|
||||
// {
|
||||
// stream::SinkWriterStream<Writer> wStream(writer);
|
||||
// wStream << MAPS_MAJOR_VERSION_BINARY_FORMAT;
|
||||
// wStream << countries;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "simple_tree.hpp"
|
||||
|
||||
#include "../geometry/rect2d.hpp"
|
||||
#include "../geometry/cellid.hpp"
|
||||
|
||||
#include "../std/string.hpp"
|
||||
#include "../std/vector.hpp"
|
||||
|
||||
|
||||
template <class ReaderT> class ReaderPtr;
|
||||
class Reader;
|
||||
class Writer;
|
||||
|
@ -21,22 +18,14 @@ namespace storage
|
|||
typedef vector<TTile> TTilesContainer;
|
||||
typedef pair<uint64_t, uint64_t> TLocalAndRemoteSize;
|
||||
|
||||
/// @name Intermediate containers for data transfer
|
||||
//@{
|
||||
typedef vector<pair<uint16_t, uint32_t> > TDataFiles;
|
||||
/// Intermediate container for data transfer
|
||||
typedef vector<pair<string, uint32_t> > TCommonFiles;
|
||||
typedef m2::CellId<9> CountryCellId;
|
||||
//@}
|
||||
|
||||
bool IsTileDownloaded(TTile const & tile);
|
||||
|
||||
/// Serves as a proxy between GUI and downloaded files
|
||||
class Country
|
||||
{
|
||||
// template <class TArchive> friend TArchive & operator << (TArchive & ar, storage::Country const & country);
|
||||
// template <class TArchive> friend TArchive & operator >> (TArchive & ar, storage::Country & country);
|
||||
|
||||
private:
|
||||
/// Name in the coutry node tree
|
||||
string m_name;
|
||||
/// Flag to display
|
||||
|
@ -62,13 +51,6 @@ namespace storage
|
|||
TLocalAndRemoteSize Size() const;
|
||||
};
|
||||
|
||||
// template <class TArchive> TArchive & operator >> (TArchive & ar, storage::Country & country)
|
||||
// {
|
||||
// ar >> country.m_name;
|
||||
// ar >> country.m_tiles;
|
||||
// return ar;
|
||||
// }
|
||||
|
||||
typedef SimpleTree<Country> TCountriesContainer;
|
||||
|
||||
/// @param tiles contains files and their sizes
|
||||
|
@ -76,8 +58,7 @@ namespace storage
|
|||
typedef ReaderPtr<Reader> file_t;
|
||||
bool LoadCountries(file_t const & file, TTilesContainer const & sortedTiles,
|
||||
TCountriesContainer & countries);
|
||||
void SaveTiles(string const & file, int32_t level, TDataFiles const & cellFiles,
|
||||
TCommonFiles const & commonFiles);
|
||||
void SaveTiles(string const & file, TCommonFiles const & commonFiles);
|
||||
bool LoadTiles(file_t const & file, TTilesContainer & tiles, uint32_t & dataVersion);
|
||||
//void SaveCountries(TCountriesContainer const & countries, Writer & writer);
|
||||
}
|
||||
|
|
|
@ -15,22 +15,14 @@ using namespace storage;
|
|||
UNIT_TEST(TilesSerialization)
|
||||
{
|
||||
static string const FILE = "tiles_serialization_test";
|
||||
int32_t const level = 8;
|
||||
TDataFiles::value_type const v1(55000, 55000);
|
||||
TDataFiles::value_type const v2(15000, 15000);
|
||||
TDataFiles::value_type const v3(5, 5);
|
||||
TCommonFiles::value_type const vv1("str2", 456);
|
||||
TCommonFiles::value_type const vv2("str1", 123);
|
||||
{
|
||||
TDataFiles dataFiles;
|
||||
dataFiles.push_back(v1);
|
||||
dataFiles.push_back(v2);
|
||||
dataFiles.push_back(v3);
|
||||
TCommonFiles commonFiles;
|
||||
commonFiles.push_back(vv1);
|
||||
commonFiles.push_back(vv2);
|
||||
|
||||
SaveTiles(FILE, level, dataFiles, commonFiles);
|
||||
SaveTiles(FILE, commonFiles);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -39,15 +31,9 @@ UNIT_TEST(TilesSerialization)
|
|||
TTilesContainer tiles;
|
||||
TEST(LoadTiles(ReaderPtr<Reader>(new FileReader(FILE)), tiles, version), ());
|
||||
|
||||
TEST_EQUAL( tiles.size(), 5, ());
|
||||
TEST_EQUAL( tiles[0], TTilesContainer::value_type(
|
||||
CountryCellId::FromBitsAndLevel(5, level).ToString(), 5), ());
|
||||
TEST_EQUAL( tiles[1], TTilesContainer::value_type(
|
||||
CountryCellId::FromBitsAndLevel(15000, level).ToString(), 15000), ());
|
||||
TEST_EQUAL( tiles[2], TTilesContainer::value_type(
|
||||
CountryCellId::FromBitsAndLevel(55000, level).ToString(), 55000), ());
|
||||
TEST_EQUAL( tiles[3], TTilesContainer::value_type("str1", 123), ());
|
||||
TEST_EQUAL( tiles[4], TTilesContainer::value_type("str2", 456), ());
|
||||
TEST_EQUAL( tiles.size(), 2, ());
|
||||
TEST_EQUAL( tiles[0], TTilesContainer::value_type("str1", 123), ());
|
||||
TEST_EQUAL( tiles[1], TTilesContainer::value_type("str2", 456), ());
|
||||
}
|
||||
|
||||
FileWriter::DeleteFileX(FILE);
|
||||
|
|
Loading…
Add table
Reference in a new issue