From 36eb8d547d6a16a54a56e87ef1b2580afd8c7f39 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Fri, 4 Mar 2016 17:09:11 +0300 Subject: [PATCH] =?UTF-8?q?Renamed=20editor=E2=80=99s=20config,=20because?= =?UTF-8?q?=20on=20Android=20xml=20files=20should=20be=20compressed=20in?= =?UTF-8?q?=20apk,=20but=20our=20reader=20does=20not=20read=20it=20correct?= =?UTF-8?q?ly=20at=20the=20moment.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/assets/editor.config | 1 + android/assets/editor.xml | 1 - android/build.gradle | 5 +++-- data/{editor.xml => editor.config} | 0 editor/editor_config.cpp | 2 +- editor/editor_config.hpp | 2 +- editor/editor_tests/editor_config_test.cpp | 6 +++--- indexer/osm_editor.cpp | 2 -- indexer/osm_editor.hpp | 2 +- iphone/Maps/Maps.xcodeproj/project.pbxproj | 12 ++++++------ 10 files changed, 16 insertions(+), 17 deletions(-) create mode 120000 android/assets/editor.config delete mode 120000 android/assets/editor.xml rename data/{editor.xml => editor.config} (100%) diff --git a/android/assets/editor.config b/android/assets/editor.config new file mode 120000 index 0000000000..5771771312 --- /dev/null +++ b/android/assets/editor.config @@ -0,0 +1 @@ +../../data/editor.config \ No newline at end of file diff --git a/android/assets/editor.xml b/android/assets/editor.xml deleted file mode 120000 index 9bb5856e25..0000000000 --- a/android/assets/editor.xml +++ /dev/null @@ -1 +0,0 @@ -../../data/editor.xml \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 94e0df02b2..5044e8b517 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -253,9 +253,10 @@ android { } } - // We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk + // We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk. + // TODO: Load all minor files via separate call to ReadAsString which can correctly handle compressed files in zip containers. aaptOptions { - noCompress 'txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui' + noCompress 'txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config' ignoreAssetsPattern "!.svn:!.git:!.DS_Store:!*.scc:.*:_*:!CVS:!thumbs.db:!picasa.ini:!*~" } diff --git a/data/editor.xml b/data/editor.config similarity index 100% rename from data/editor.xml rename to data/editor.config diff --git a/editor/editor_config.cpp b/editor/editor_config.cpp index 214e5524a5..2518ad421c 100644 --- a/editor/editor_config.cpp +++ b/editor/editor_config.cpp @@ -14,7 +14,7 @@ namespace { using EType = feature::Metadata::EType; -// TODO(mgsergio): It would be nice to have this map generated from editor.xml. +// TODO(mgsergio): It would be nice to have this map generated from editor.config. static unordered_map const kNamesToFMD= { {"cuisine", feature::Metadata::FMD_CUISINE}, {"opening_hours", feature::Metadata::FMD_OPEN_HOURS}, diff --git a/editor/editor_config.hpp b/editor/editor_config.hpp index c817d7e622..8533216851 100644 --- a/editor/editor_config.hpp +++ b/editor/editor_config.hpp @@ -58,7 +58,7 @@ DECLARE_EXCEPTION(ConfigLoadError, RootException); class EditorConfig { public: - EditorConfig(string const & fileName); + EditorConfig(string const & fileName = "editor.config"); TypeAggregatedDescription GetTypeDescription(vector const & classificatorTypes) const; vector GetTypesThatCanBeAdded() const; diff --git a/editor/editor_tests/editor_config_test.cpp b/editor/editor_tests/editor_config_test.cpp index 8a059e3b90..07ebbe1dda 100644 --- a/editor/editor_tests/editor_config_test.cpp +++ b/editor/editor_tests/editor_config_test.cpp @@ -17,7 +17,7 @@ UNIT_TEST(EditorConfig_TypeDescription) feature::Metadata::FMD_EMAIL }; - EditorConfig config("editor.xml"); + EditorConfig config; { auto const desc = config.GetTypeDescription({"amenity-hunting_stand"}); @@ -42,12 +42,12 @@ UNIT_TEST(EditorConfig_TypeDescription) fields.insert(EType::FMD_OPERATOR); TEST_EQUAL(desc.GetEditableFields(), fields, ()); } - // TODO(mgsergio): Test case with priority="high" when there is one on editor.xml. + // TODO(mgsergio): Test case with priority="high" when there is one on editor.config. } UNIT_TEST(EditorConfig_GetTypesThatGenBeAdded) { - EditorConfig config("editor.xml"); + EditorConfig config; auto const types = config.GetTypesThatCanBeAdded(); TEST(find(begin(types), end(types), "amenity-cafe") != end(types), ()); diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 5b2bb5008c..03deca1eca 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -127,8 +127,6 @@ namespace osm // TODO(AlexZ): Normalize osm multivalue strings for correct merging // (e.g. insert/remove spaces after ';' delimeter); -Editor::Editor() : m_config("editor.xml") { } - Editor & Editor::Instance() { static Editor instance; diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index 4833f08933..736136fab4 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -23,7 +23,7 @@ namespace osm { class Editor final { - Editor(); + Editor() = default; public: using TFeatureTypeFn = function; // Mimics Framework::TFeatureTypeFn. diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index d8e478fdb3..235b866f49 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -578,8 +578,8 @@ 677A2DE21C0DD50900635A00 /* resources-default in Resources */ = {isa = PBXBuildFile; fileRef = A367C93A1B17334800E2B6E7 /* resources-default */; }; 6B653B941C7F2DE4007BEFC5 /* cuisine-strings in Resources */ = {isa = PBXBuildFile; fileRef = 6B653B931C7F2DE4007BEFC5 /* cuisine-strings */; }; 6B653B951C7F2DE4007BEFC5 /* cuisine-strings in Resources */ = {isa = PBXBuildFile; fileRef = 6B653B931C7F2DE4007BEFC5 /* cuisine-strings */; }; - 6B9978351C89A316003B8AA0 /* editor.xml in Resources */ = {isa = PBXBuildFile; fileRef = 6B9978341C89A316003B8AA0 /* editor.xml */; }; - 6B9978361C89A316003B8AA0 /* editor.xml in Resources */ = {isa = PBXBuildFile; fileRef = 6B9978341C89A316003B8AA0 /* editor.xml */; }; + 6B9978351C89A316003B8AA0 /* editor.config in Resources */ = {isa = PBXBuildFile; fileRef = 6B9978341C89A316003B8AA0 /* editor.config */; }; + 6B9978361C89A316003B8AA0 /* editor.config in Resources */ = {isa = PBXBuildFile; fileRef = 6B9978341C89A316003B8AA0 /* editor.config */; }; 6BA0BCD11B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6BA0BCD01B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm */; }; 845C891F1C78748000940D7F /* me.maps.enterprise.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 845C891E1C78748000940D7F /* me.maps.enterprise.entitlements */; }; 845C892C1C8981CE00940D7F /* HockeySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845C89291C8981CE00940D7F /* HockeySDK.framework */; }; @@ -1186,7 +1186,7 @@ 674A7E221C0DA55E003D48E1 /* libsdf_image.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsdf_image.a; path = "../../../omim-xcode-build/Debug/libsdf_image.a"; sourceTree = ""; }; 674A7E231C0DA55E003D48E1 /* libstb_image.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libstb_image.a; path = "../../../omim-xcode-build/Debug/libstb_image.a"; sourceTree = ""; }; 6B653B931C7F2DE4007BEFC5 /* cuisine-strings */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "cuisine-strings"; path = "../../data/cuisine-strings"; sourceTree = ""; }; - 6B9978341C89A316003B8AA0 /* editor.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = editor.xml; path = ../../data/editor.xml; sourceTree = ""; }; + 6B9978341C89A316003B8AA0 /* editor.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = editor.config; path = ../../data/editor.config; sourceTree = ""; }; 6BA0BCCF1B74DDBA00CC9969 /* MWMCustomFacebookEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMCustomFacebookEvents.h; sourceTree = ""; }; 6BA0BCD01B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMCustomFacebookEvents.mm; sourceTree = ""; }; 772923C9184E0440008C1EDC /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = ""; }; @@ -2851,7 +2851,7 @@ FA065FC61286143F00FEA989 /* External Resources */ = { isa = PBXGroup; children = ( - 6B9978341C89A316003B8AA0 /* editor.xml */, + 6B9978341C89A316003B8AA0 /* editor.config */, 671182DE1C7F0DD400CB8177 /* countries_obsolete.txt */, 671182DF1C7F0DD400CB8177 /* packed_polygons_obsolete.bin */, 671182E01C7F0DD400CB8177 /* WorldCoasts_obsolete.mwm */, @@ -3178,7 +3178,7 @@ 3401CD711C3C0C420028C6F8 /* MWMEditorNameTableViewCell.xib in Resources */, 347FD8751C60B2CE002FB65E /* MWMOpeningHoursClosedSpanTableViewCell.xib in Resources */, 34F9FB891C438ADB00F71201 /* MWMStreetEditorCommonTableViewCell.xib in Resources */, - 6B9978351C89A316003B8AA0 /* editor.xml in Resources */, + 6B9978351C89A316003B8AA0 /* editor.config in Resources */, F6588E381B15D87A00EE1E58 /* MWMBookmarkColorCell.xib in Resources */, 3401CD691C3C03A80028C6F8 /* MWMEditorTextTableViewCell.xib in Resources */, FAAEA7D1161BD26600CCD661 /* synonyms.txt in Resources */, @@ -3285,7 +3285,7 @@ 6741A9631BF340DE002C974C /* Images.xcassets in Resources */, 6741A9641BF340DE002C974C /* MWMSearchDownloadViewController.xib in Resources */, 347FD8881C60B2CE002FB65E /* MWMOpeningHoursTimeSelectorTableViewCell.xib in Resources */, - 6B9978361C89A316003B8AA0 /* editor.xml in Resources */, + 6B9978361C89A316003B8AA0 /* editor.config in Resources */, 9DA46A151C47E95700EF52BA /* resources-6plus_legacy in Resources */, 347FD8721C60B2CE002FB65E /* MWMOpeningHoursAllDayTableViewCell.xib in Resources */, 34F9FB931C43AF2400F71201 /* MWMStreetEditorEditTableViewCell.xib in Resources */,