[new downloader] git-clang-format.

This commit is contained in:
Vladimir Byko-Ianko 2016-03-10 16:10:28 +03:00 committed by Sergey Yershov
parent 3f3b8624d2
commit 5c155b8d24
6 changed files with 38 additions and 32 deletions

View file

@ -2,10 +2,7 @@
namespace my
{
void FromJSON(json_t * root, string & result)
{
result = string(json_string_value(root));
}
void FromJSON(json_t * root, string & result) { result = string(json_string_value(root)); }
void FromJSONObject(json_t * root, string const & field, string & result)
{

View file

@ -38,7 +38,9 @@ class StoreCountriesSingleMwms : public StoreSingleMwmInterface
public:
StoreCountriesSingleMwms(TCountryTree & countries, TMappingAffiliations & affiliations)
: m_countries(countries), m_affiliations(affiliations) {}
: m_countries(countries), m_affiliations(affiliations)
{
}
Country * InsertToCountryTree(TCountryId const & id, uint32_t mapSize, int depth,
TCountryId const & parent) override
@ -72,8 +74,7 @@ class StoreFile2InfoSingleMwms : public StoreSingleMwmInterface
map<string, CountryInfo> & m_file2info;
public:
StoreFile2InfoSingleMwms(map<string, CountryInfo> & file2info)
: m_file2info(file2info) {}
StoreFile2InfoSingleMwms(map<string, CountryInfo> & file2info) : m_file2info(file2info) {}
Country * InsertToCountryTree(TCountryId const & id, uint32_t /* mapSize */, int /* depth */,
TCountryId const & /* parent */) override
@ -83,8 +84,13 @@ public:
return nullptr;
}
void InsertOldMwmMapping(TCountryId const & /* newId */, TCountryId const & /* oldId */) override {}
void InsertAffiliation(TCountryId const & /* countryId */, string const & /* affilation */) override {}
void InsertOldMwmMapping(TCountryId const & /* newId */, TCountryId const & /* oldId */) override
{
}
void InsertAffiliation(TCountryId const & /* countryId */,
string const & /* affilation */) override
{
}
TMappingOldMwm GetMapping() const override
{
ASSERT(false, ());
@ -146,7 +152,7 @@ TMwmSubtreeAttrs LoadGroupSingleMwmsImpl(int depth, json_t * node, TCountryId co
}
else
{
mwmCounter = 1; // It's a leaf. Any leaf contains one mwm.
mwmCounter = 1; // It's a leaf. Any leaf contains one mwm.
mwmSize = nodeSize;
}
@ -176,8 +182,8 @@ namespace
class StoreTwoComponentMwmInterface
{
public:
virtual void Insert(string const & id, uint32_t mapSize, uint32_t /* routingSize */,
int depth, TCountryId const & parent) = 0;
virtual void Insert(string const & id, uint32_t mapSize, uint32_t /* routingSize */, int depth,
TCountryId const & parent) = 0;
};
class StoreCountriesTwoComponentMwms : public StoreTwoComponentMwmInterface
@ -185,11 +191,14 @@ class StoreCountriesTwoComponentMwms : public StoreTwoComponentMwmInterface
TCountryTree & m_countries;
public:
StoreCountriesTwoComponentMwms(TCountryTree & countries, TMappingAffiliations & /* affiliations */)
: m_countries(countries) {}
StoreCountriesTwoComponentMwms(TCountryTree & countries,
TMappingAffiliations & /* affiliations */)
: m_countries(countries)
{
}
void Insert(string const & id, uint32_t mapSize, uint32_t routingSize,
int depth, TCountryId const & parent) override
void Insert(string const & id, uint32_t mapSize, uint32_t routingSize, int depth,
TCountryId const & parent) override
{
Country country(id, parent);
if (mapSize)
@ -208,11 +217,10 @@ class StoreFile2InfoTwoComponentMwms : public StoreTwoComponentMwmInterface
map<string, CountryInfo> & m_file2info;
public:
StoreFile2InfoTwoComponentMwms(map<string, CountryInfo> & file2info)
: m_file2info(file2info) {}
StoreFile2InfoTwoComponentMwms(map<string, CountryInfo> & file2info) : m_file2info(file2info) {}
void Insert(string const & id, uint32_t mapSize, uint32_t /* routingSize */,
int /* depth */, TCountryId const & /* parent */) override
void Insert(string const & id, uint32_t mapSize, uint32_t /* routingSize */, int /* depth */,
TCountryId const & /* parent */) override
{
if (mapSize == 0)
return;
@ -240,7 +248,8 @@ void LoadGroupTwoComponentMwmsImpl(int depth, json_t * node, TCountryId const &
ASSERT_LESS_OR_EQUAL(0, mwmSize, ());
ASSERT_LESS_OR_EQUAL(0, routingSize, ());
store.Insert(file, static_cast<uint32_t>(mwmSize), static_cast<uint32_t>(routingSize), depth, parent);
store.Insert(file, static_cast<uint32_t>(mwmSize), static_cast<uint32_t>(routingSize), depth,
parent);
json_t * children = json_object_get(node, "g");
if (children)

View file

@ -168,7 +168,7 @@ public:
if (level == 0)
{
ASSERT(IsEmpty(), ());
m_countryTree = make_unique<Node>(value, nullptr); // Creating the root node.
m_countryTree = make_unique<Node>(value, nullptr); // Creating the root node.
added = m_countryTree.get();
}
else

View file

@ -122,7 +122,8 @@ Storage::Storage(string const & referenceCountriesTxtJsonForTesting,
: m_downloader(move(mapDownloaderForTesting)), m_currentSlotId(0),
m_downloadMapOnTheMap(nullptr)
{
m_currentVersion = LoadCountries(referenceCountriesTxtJsonForTesting, m_countries, m_affiliations);
m_currentVersion =
LoadCountries(referenceCountriesTxtJsonForTesting, m_countries, m_affiliations);
CHECK_LESS_OR_EQUAL(0, m_currentVersion, ("Can't load test countries file"));
}
@ -621,8 +622,8 @@ TCountryId Storage::GetCurrentDownloadingCountryId() const
return IsDownloadInProgress() ? m_queue.front().GetCountryId() : storage::TCountryId();
}
void Storage::LoadCountriesFile(string const & pathToCountriesFile,
string const & dataDir, TMappingOldMwm * mapping /* = nullptr */)
void Storage::LoadCountriesFile(string const & pathToCountriesFile, string const & dataDir,
TMappingOldMwm * mapping /* = nullptr */)
{
m_dataDir = dataDir;

View file

@ -203,8 +203,8 @@ private:
void DownloadNextCountryFromQueue();
void LoadCountriesFile(string const & pathToCountriesFile,
string const & dataDir, TMappingOldMwm * mapping = nullptr);
void LoadCountriesFile(string const & pathToCountriesFile, string const & dataDir,
TMappingOldMwm * mapping = nullptr);
void ReportProgress(TCountryId const & countryId, MapFilesDownloader::TProgress const & p);
void ReportProgressForHierarchy(TCountryId const & countryId,

View file

@ -51,8 +51,7 @@ string const kMapTestDir = "map-tests";
using TLocalFilePtr = shared_ptr<LocalCountryFile>;
string const kSingleMwmCountriesTxt =
string(R"({
string const kSingleMwmCountriesTxt = string(R"({
"id": "Countries",
"v": )" + strings::to_string(version::FOR_TESTING_SINGLE_MWM1) + R"(,
"g": [
@ -994,11 +993,11 @@ UNIT_TEST(StorageTest_GetAffiliations)
string const abkhaziaId = "Abkhazia";
TMappingAffiliations const expectedAffiliations = {{abkhaziaId.c_str(), "Georgia"},
{abkhaziaId.c_str(), "Russia"},
{abkhaziaId.c_str(), "Europe"}};
{abkhaziaId.c_str(), "Russia"},
{abkhaziaId.c_str(), "Europe"}};
auto const rangeResultAffiliations = storage.GetAffiliations().equal_range(abkhaziaId);
TMappingAffiliations const resultAffiliations(rangeResultAffiliations.first,
rangeResultAffiliations.second);
rangeResultAffiliations.second);
TEST(expectedAffiliations == resultAffiliations, ());
auto const rangeResultNoAffiliations = storage.GetAffiliations().equal_range("Algeria");