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:
-rw-r--r--3party/bsdiff-courgette/bsdiff/bsdiff.h4
-rw-r--r--3party/jansson/jansson_handle.cpp9
-rw-r--r--3party/jansson/jansson_handle.hpp7
-rw-r--r--3party/jansson/myjansson.cpp20
-rw-r--r--3party/jansson/myjansson.hpp46
-rw-r--r--3party/osrm/osrm-backend/mapsme/converter.cpp2
-rw-r--r--3party/sdf_image/sdf_image.cpp4
-rw-r--r--android/UnitTests/jni/mock.cpp2
-rw-r--r--android/jni/com/mapswithme/core/jni_helper.cpp4
-rw-r--r--android/jni/com/mapswithme/core/jni_helper.hpp2
-rw-r--r--android/jni/com/mapswithme/core/logging.cpp2
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp2
-rw-r--r--android/jni/com/mapswithme/maps/MapManager.cpp2
-rw-r--r--android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp2
-rw-r--r--android/jni/com/mapswithme/opengl/android_gl_utils.cpp2
-rw-r--r--android/jni/com/mapswithme/opengl/android_gl_utils.hpp4
-rw-r--r--base/assert.hpp71
-rw-r--r--base/base.cpp30
-rw-r--r--base/base_tests/cache_test.cpp29
-rw-r--r--base/base_tests/collection_cast_test.cpp2
-rw-r--r--base/base_tests/containers_test.cpp3
-rw-r--r--base/base_tests/logging_test.cpp12
-rw-r--r--base/base_tests/math_test.cpp112
-rw-r--r--base/base_tests/newtype_test.cpp3
-rw-r--r--base/base_tests/range_iterator_test.cpp2
-rw-r--r--base/base_tests/ref_counted_tests.cpp2
-rw-r--r--base/base_tests/string_utils_test.cpp5
-rw-r--r--base/base_tests/timer_test.cpp10
-rw-r--r--base/buffer_vector.hpp2
-rw-r--r--base/cache.hpp5
-rw-r--r--base/collection_cast.hpp4
-rw-r--r--base/deferred_task.cpp8
-rw-r--r--base/deferred_task.hpp28
-rw-r--r--base/exception.hpp4
-rw-r--r--base/gmtime.cpp4
-rw-r--r--base/gmtime.hpp4
-rw-r--r--base/internal/message.hpp80
-rw-r--r--base/limited_priority_queue.hpp6
-rw-r--r--base/logging.cpp6
-rw-r--r--base/logging.hpp40
-rw-r--r--base/macros.hpp37
-rw-r--r--base/math.hpp5
-rw-r--r--base/matrix.hpp2
-rw-r--r--base/newtype.hpp15
-rw-r--r--base/observer_list.hpp2
-rw-r--r--base/range_iterator.hpp10
-rw-r--r--base/ref_counted.hpp4
-rw-r--r--base/rolling_hash.hpp2
-rw-r--r--base/scope_guard.hpp8
-rw-r--r--base/src_point.cpp4
-rw-r--r--base/src_point.hpp20
-rw-r--r--base/stats.hpp20
-rw-r--r--base/sunrise_sunset.cpp12
-rw-r--r--base/threaded_container.hpp2
-rw-r--r--base/timegm.cpp2
-rw-r--r--base/timer.cpp5
-rw-r--r--base/timer.hpp11
-rw-r--r--coding/bwt_coder.hpp3
-rw-r--r--coding/coding_tests/file_data_test.cpp90
-rw-r--r--coding/coding_tests/file_utils_test.cpp75
-rw-r--r--coding/coding_tests/traffic_test.cpp4
-rw-r--r--coding/coding_tests/writer_test.cpp2
-rw-r--r--coding/coding_tests/zip_creator_test.cpp8
-rw-r--r--coding/compressed_bit_vector.hpp2
-rw-r--r--coding/file_container.cpp2
-rw-r--r--coding/file_name_utils.cpp10
-rw-r--r--coding/file_name_utils.hpp62
-rw-r--r--coding/file_reader.cpp4
-rw-r--r--coding/file_writer.cpp4
-rw-r--r--coding/file_writer.hpp16
-rw-r--r--coding/geometry_coding.cpp8
-rw-r--r--coding/internal/file_data.cpp13
-rw-r--r--coding/internal/file_data.hpp7
-rw-r--r--coding/pointd_to_pointu.cpp6
-rw-r--r--coding/reader_cache.hpp47
-rw-r--r--coding/serdes_json.hpp27
-rw-r--r--coding/sha1.cpp2
-rw-r--r--coding/zip_creator.cpp6
-rw-r--r--drape/batcher_helpers.cpp2
-rw-r--r--drape/color.hpp6
-rw-r--r--drape/cpu_buffer.cpp2
-rw-r--r--drape/drape_tests/bidi_tests.cpp5
-rw-r--r--drape/drape_tests/failure_reporter.cpp4
-rw-r--r--drape/drape_tests/glfunctions.cpp2
-rw-r--r--drape/drape_tests/pointers_tests.cpp6
-rw-r--r--drape/drape_tests/stipple_pen_tests.cpp8
-rw-r--r--drape/drape_tests/testingmain.cpp2
-rw-r--r--drape/glfunctions.cpp2
-rw-r--r--drape/glfunctions.hpp2
-rw-r--r--drape/glyph_manager.cpp4
-rw-r--r--drape/overlay_handle.cpp2
-rw-r--r--drape/stipple_pen_resource.cpp2
-rw-r--r--drape/texture_manager.cpp4
-rw-r--r--drape/texture_manager.hpp2
-rw-r--r--drape/texture_of_colors.cpp2
-rw-r--r--drape_frontend/animation/interpolators.cpp2
-rw-r--r--drape_frontend/color_constants.cpp4
-rw-r--r--drape_frontend/drape_engine.cpp4
-rw-r--r--drape_frontend/drape_frontend_tests/navigator_test.cpp4
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp2
-rw-r--r--drape_frontend/gps_track_renderer.cpp4
-rw-r--r--drape_frontend/gui/compass.cpp4
-rw-r--r--drape_frontend/gui/ruler_helper.cpp4
-rw-r--r--drape_frontend/gui/scale_fps_helper.hpp2
-rw-r--r--drape_frontend/line_shape_helper.cpp2
-rw-r--r--drape_frontend/my_position_controller.cpp4
-rw-r--r--drape_frontend/my_position_controller.hpp10
-rw-r--r--drape_frontend/traffic_renderer.cpp2
-rw-r--r--drape_frontend/user_event_stream.hpp6
-rw-r--r--drape_frontend/visual_params.cpp14
-rw-r--r--editor/config_loader.cpp4
-rw-r--r--editor/editor_notes.cpp2
-rw-r--r--editor/editor_storage.cpp4
-rw-r--r--editor/editor_tests/editor_notes_test.cpp2
-rw-r--r--editor/editor_tests/osm_editor_test.cpp6
-rw-r--r--editor/editor_tests/xml_feature_test.cpp6
-rw-r--r--editor/feature_matcher.cpp2
-rw-r--r--editor/osm_editor.cpp14
-rw-r--r--editor/osm_editor.hpp8
-rw-r--r--editor/server_api.cpp4
-rw-r--r--editor/user_stats.cpp8
-rw-r--r--editor/xml_feature.cpp8
-rw-r--r--editor/xml_feature.hpp2
-rw-r--r--feature_list/feature_list.cpp4
-rw-r--r--generator/booking_quality_check/booking_addr_match.cpp2
-rw-r--r--generator/booking_quality_check/booking_quality_check.cpp2
-rw-r--r--generator/borders_loader.cpp8
-rw-r--r--generator/extract_addr/extract_addr.cpp10
-rw-r--r--generator/feature_builder.cpp2
-rw-r--r--generator/feature_helpers.hpp8
-rw-r--r--generator/feature_segments_checker/feature_segments_checker.cpp2
-rw-r--r--generator/generate_info.hpp6
-rw-r--r--generator/generator_tests/altitude_test.cpp4
-rw-r--r--generator/generator_tests/city_roads_tests.cpp6
-rw-r--r--generator/generator_tests/intermediate_data_test.cpp4
-rw-r--r--generator/generator_tests/osm_o5m_source_test.cpp4
-rw-r--r--generator/generator_tests/region_info_collector_tests.cpp2
-rw-r--r--generator/generator_tests/restriction_collector_test.cpp10
-rw-r--r--generator/generator_tests/restriction_test.cpp10
-rw-r--r--generator/generator_tests/road_access_test.cpp12
-rw-r--r--generator/generator_tests/speed_cameras_test.cpp16
-rw-r--r--generator/generator_tests/sponsored_storage_tests.cpp2
-rw-r--r--generator/generator_tests/ugc_test.cpp2
-rw-r--r--generator/generator_tests_support/test_mwm_builder.cpp4
-rw-r--r--generator/generator_tool/generator_tool.cpp16
-rw-r--r--generator/locality_sorter.cpp6
-rw-r--r--generator/mwm_diff/mwm_diff_tests/diff_test.cpp10
-rw-r--r--generator/osm2type.cpp2
-rw-r--r--generator/osm_element.hpp4
-rw-r--r--generator/region_info_collector.cpp2
-rw-r--r--generator/region_meta.cpp12
-rw-r--r--generator/regions.cpp16
-rw-r--r--generator/relation_tags.hpp2
-rw-r--r--generator/restaurants_info/restaurants_info.cpp2
-rw-r--r--generator/routing_index_generator.cpp6
-rw-r--r--generator/search_index_builder.cpp2
-rw-r--r--generator/sponsored_object_storage.hpp2
-rw-r--r--generator/sponsored_scoring.cpp2
-rw-r--r--generator/tesselator.cpp8
-rw-r--r--generator/tesselator.hpp2
-rw-r--r--generator/transit_generator.cpp10
-rw-r--r--generator/ugc_translator.cpp2
-rw-r--r--geocoder/geocoder.cpp2
-rw-r--r--geocoder/geocoder_tests/geocoder_tests.cpp2
-rw-r--r--geocoder/hierarchy.cpp10
-rw-r--r--geometry/angles.cpp2
-rw-r--r--geometry/distance_on_sphere.cpp8
-rw-r--r--geometry/geometry_tests/angle_test.cpp24
-rw-r--r--geometry/geometry_tests/screen_test.cpp8
-rw-r--r--geometry/geometry_tests/vector_test.cpp14
-rw-r--r--geometry/latlon.cpp2
-rw-r--r--geometry/latlon.hpp2
-rw-r--r--geometry/mercator.cpp4
-rw-r--r--geometry/mercator.hpp18
-rw-r--r--geometry/point2d.hpp12
-rw-r--r--geometry/polygon.hpp8
-rw-r--r--geometry/rect2d.hpp4
-rw-r--r--geometry/region2d.hpp6
-rw-r--r--geometry/screenbase.cpp4
-rw-r--r--indexer/cell_id.hpp8
-rw-r--r--indexer/displacement_manager.hpp2
-rw-r--r--indexer/feature_impl.cpp2
-rw-r--r--indexer/features_offsets_table.cpp2
-rw-r--r--indexer/ftypes_matcher.cpp2
-rw-r--r--indexer/indexer_tests/centers_table_test.cpp2
-rw-r--r--indexer/indexer_tests/rank_table_test.cpp6
-rw-r--r--indexer/map_style_reader.cpp8
-rw-r--r--indexer/rank_table.cpp4
-rw-r--r--indexer/scales.cpp4
-rw-r--r--indexer/string_set.hpp2
-rw-r--r--iphone/Maps/Classes/CustomViews/MapViewControls/SideButtons/MWMSideButtonsView.mm2
-rw-r--r--iphone/Maps/Common/Statistics/fabric_logging.hpp4
-rw-r--r--iphone/Maps/Common/Statistics/fabric_logging_ios.mm10
-rw-r--r--iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm2
-rw-r--r--iphone/Maps/Core/Location/MWMLocationHelpers.h2
-rw-r--r--iphone/Maps/Core/Location/MWMLocationManager.mm4
-rw-r--r--iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm2
-rw-r--r--iphone/Maps/main.mm6
-rw-r--r--kml/kml_tests/serdes_tests.cpp8
-rw-r--r--kml/serdes.cpp10
-rw-r--r--local_ads/event.cpp4
-rw-r--r--local_ads/local_ads_tests/statistics_tests.cpp2
-rw-r--r--local_ads/statistics.cpp8
-rw-r--r--map/address_finder.cpp4
-rw-r--r--map/benchmark_tool/features_loading.cpp8
-rw-r--r--map/benchmark_tools.cpp4
-rw-r--r--map/bookmark_catalog.cpp2
-rw-r--r--map/bookmark_helpers.cpp2
-rw-r--r--map/bookmark_manager.cpp82
-rw-r--r--map/chart_generator.cpp2
-rw-r--r--map/cloud.cpp52
-rw-r--r--map/extrapolation/extrapolator.cpp4
-rw-r--r--map/framework.cpp6
-rw-r--r--map/gps_track_storage.cpp4
-rw-r--r--map/gps_tracker.cpp2
-rw-r--r--map/local_ads_manager.cpp2
-rw-r--r--map/map_tests/bookmarks_test.cpp26
-rw-r--r--map/map_tests/chart_generator_tests.cpp2
-rw-r--r--map/map_tests/extrapolator_tests.cpp14
-rw-r--r--map/map_tests/gps_track_storage_test.cpp2
-rw-r--r--map/map_tests/gps_track_test.cpp2
-rw-r--r--map/map_tests/mwm_set_test.cpp3
-rw-r--r--map/map_tests/mwm_url_tests.cpp2
-rw-r--r--map/map_tests/tips_tests.cpp4
-rw-r--r--map/osm_opening_hours.hpp14
-rw-r--r--map/routing_manager.cpp8
-rw-r--r--map/search_api.cpp2
-rw-r--r--map/search_mark.cpp4
-rw-r--r--map/tips_api.cpp2
-rw-r--r--map/user.cpp6
-rw-r--r--metrics/eye_serdes.cpp2
-rw-r--r--metrics/eye_storage.cpp2
-rw-r--r--metrics/metrics_tests_support/eye_for_testing.cpp4
-rw-r--r--openlr/candidate_paths_getter.cpp4
-rw-r--r--openlr/openlr_decoder.cpp8
-rw-r--r--openlr/openlr_model_xml.cpp4
-rw-r--r--openlr/openlr_stat/openlr_stat.cpp4
-rw-r--r--openlr/openlr_tests/decoded_path_test.cpp4
-rw-r--r--openlr/router.cpp12
-rw-r--r--partners_api/booking_api.cpp24
-rw-r--r--partners_api/locals_api.cpp12
-rw-r--r--partners_api/maxim_api.cpp4
-rw-r--r--partners_api/partners_api_tests/rutaxi_tests.cpp4
-rw-r--r--partners_api/partners_api_tests/uber_tests.cpp8
-rw-r--r--partners_api/rutaxi_api.cpp12
-rw-r--r--partners_api/taxi_places_loader.cpp2
-rw-r--r--partners_api/uber_api.cpp6
-rw-r--r--partners_api/viator_api.cpp6
-rw-r--r--partners_api/yandex_api.cpp4
-rw-r--r--platform/file_logging.cpp2
-rw-r--r--platform/file_logging.hpp2
-rw-r--r--platform/get_text_by_id.cpp4
-rw-r--r--platform/http_request.cpp12
-rw-r--r--platform/local_country_file.cpp10
-rw-r--r--platform/local_country_file_utils.cpp36
-rw-r--r--platform/measurement_utils.cpp4
-rw-r--r--platform/mwm_version.cpp8
-rw-r--r--platform/platform.cpp16
-rw-r--r--platform/platform_android.cpp2
-rw-r--r--platform/platform_linux.cpp22
-rw-r--r--platform/platform_mac.mm4
-rw-r--r--platform/platform_tests/apk_test.cpp2
-rw-r--r--platform/platform_tests/downloader_tests/downloader_test.cpp18
-rw-r--r--platform/platform_tests/jansson_test.cpp6
-rw-r--r--platform/platform_tests/language_test.cpp12
-rw-r--r--platform/platform_tests/local_country_file_tests.cpp12
-rw-r--r--platform/platform_tests/platform_test.cpp20
-rw-r--r--platform/platform_tests_support/scoped_dir.cpp4
-rw-r--r--platform/platform_tests_support/scoped_file.cpp8
-rw-r--r--platform/platform_tests_support/scoped_mwm.cpp2
-rw-r--r--platform/servers_list.cpp4
-rw-r--r--platform/wifi_location_service.cpp4
-rw-r--r--qt/main.cpp16
-rw-r--r--qt/qt_common/qtoglcontext.cpp2
-rw-r--r--qt/qt_common/scale_slider.cpp2
-rw-r--r--routing/async_router.cpp2
-rw-r--r--routing/base/astar_progress.hpp2
-rw-r--r--routing/bicycle_directions.cpp2
-rw-r--r--routing/cross_mwm_graph.cpp2
-rw-r--r--routing/edge_estimator.cpp2
-rw-r--r--routing/fake_ending.cpp2
-rw-r--r--routing/features_road_graph.cpp2
-rw-r--r--routing/features_road_graph.hpp2
-rw-r--r--routing/index_graph_loader.cpp4
-rw-r--r--routing/index_router.cpp2
-rw-r--r--routing/online_cross_fetcher.cpp4
-rw-r--r--routing/road_graph.hpp4
-rw-r--r--routing/route.cpp4
-rw-r--r--routing/route.hpp2
-rw-r--r--routing/route_weight.hpp4
-rw-r--r--routing/router_delegate.hpp2
-rw-r--r--routing/routing_benchmarks/helpers.cpp8
-rw-r--r--routing/routing_consistency_tests/routing_consistency_tests.cpp7
-rw-r--r--routing/routing_integration_tests/bicycle_route_test.cpp2
-rw-r--r--routing/routing_integration_tests/get_altitude_test.cpp2
-rw-r--r--routing/routing_integration_tests/routing_test_tools.cpp17
-rw-r--r--routing/routing_session.cpp4
-rw-r--r--routing/routing_tests/astar_router_test.cpp6
-rw-r--r--routing/routing_tests/checkpoint_predictor_test.cpp2
-rw-r--r--routing/routing_tests/index_graph_test.cpp2
-rw-r--r--routing/routing_tests/index_graph_tools.cpp2
-rw-r--r--routing/routing_tests/route_tests.cpp28
-rw-r--r--routing/routing_tests/routing_session_test.cpp8
-rw-r--r--routing/routing_tests/speed_cameras_tests.cpp6
-rw-r--r--routing/routing_tests/turns_sound_test.cpp12
-rw-r--r--routing/transit_graph_loader.cpp2
-rw-r--r--routing/turn_candidate.hpp2
-rw-r--r--routing/turns_generator.cpp8
-rw-r--r--routing/turns_sound_settings.cpp8
-rw-r--r--routing_common/vehicle_model.cpp4
-rw-r--r--search/bookmarks/processor.hpp2
-rw-r--r--search/cbv.cpp6
-rw-r--r--search/cbv.hpp17
-rw-r--r--search/features_layer_path_finder.hpp2
-rw-r--r--search/geocoder.cpp2
-rw-r--r--search/house_detector.cpp10
-rw-r--r--search/intermediate_result.cpp2
-rw-r--r--search/interval_set.hpp55
-rw-r--r--search/pre_ranker.cpp4
-rw-r--r--search/pysearch/bindings.cpp2
-rw-r--r--search/result.cpp2
-rw-r--r--search/search_integration_tests/pre_ranker_test.cpp2
-rw-r--r--search/search_quality/features_collector_tool/features_collector_tool.cpp2
-rw-r--r--search/search_quality/helpers.cpp12
-rw-r--r--search/search_quality/sample.cpp14
-rw-r--r--search/search_quality/sample.hpp4
-rw-r--r--search/search_quality/search_quality_tool/search_quality_tool.cpp10
-rw-r--r--search/search_tests/interval_set_test.cpp114
-rw-r--r--search/search_tests/keyword_matcher_test.cpp13
-rw-r--r--search/search_tests/latlon_match_test.cpp2
-rw-r--r--search/search_tests_support/helpers.hpp2
-rw-r--r--search/search_tests_support/test_search_request.hpp2
-rw-r--r--search/street_vicinity_loader.cpp2
-rw-r--r--search/token_range.hpp8
-rw-r--r--shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp6
-rw-r--r--skin_generator/generator.cpp2
-rw-r--r--software_renderer/circle_info.hpp4
-rw-r--r--software_renderer/cpu_drawer.cpp4
-rw-r--r--software_renderer/feature_styler.cpp2
-rw-r--r--software_renderer/geometry_processors.cpp2
-rw-r--r--storage/country.cpp16
-rw-r--r--storage/country_info_getter.hpp2
-rw-r--r--storage/diff_scheme/diff_manager.cpp4
-rw-r--r--storage/diff_scheme/diff_scheme_checker.cpp8
-rw-r--r--storage/downloading_policy.hpp2
-rw-r--r--storage/storage.cpp8
-rw-r--r--storage/storage_integration_tests/storage_3levels_tests.cpp2
-rw-r--r--storage/storage_integration_tests/storage_group_download_tests.cpp12
-rw-r--r--storage/storage_integration_tests/storage_http_tests.cpp12
-rw-r--r--storage/storage_integration_tests/storage_update_tests.cpp8
-rw-r--r--storage/storage_tests/helpers.cpp8
-rw-r--r--storage/storage_tests/storage_tests.cpp10
-rw-r--r--testing/benchmark.hpp29
-rw-r--r--testing/testing.hpp324
-rw-r--r--testing/testingmain.cpp6
-rw-r--r--testing/testregister.hpp1
-rw-r--r--tizen/MapsWithMe/src/BookMarkSplitPanel.cpp2
-rw-r--r--track_analyzing/log_parser.cpp6
-rw-r--r--track_analyzing/track_analyzer/cmd_gpx.cpp2
-rw-r--r--track_analyzing/track_analyzer/cmd_match.cpp2
-rw-r--r--track_analyzing/track_analyzer/cmd_table.cpp2
-rw-r--r--track_analyzing/track_analyzer/cmd_track.cpp2
-rw-r--r--track_analyzing/track_analyzer/cmd_tracks.cpp4
-rw-r--r--track_analyzing/utils.cpp4
-rw-r--r--track_generator/utils.cpp4
-rw-r--r--tracking/reporter.cpp4
-rw-r--r--tracking/tracking_tests/protocol_test.cpp4
-rw-r--r--tracking/tracking_tests/reporter_test.cpp4
-rw-r--r--traffic/pytraffic/bindings.cpp8
-rw-r--r--traffic/speed_groups.cpp2
-rw-r--r--transit/transit_graph_data.cpp4
-rw-r--r--transit/transit_graph_data.hpp10
-rw-r--r--transit/transit_tests/transit_graph_test.cpp2
-rw-r--r--transit/transit_tests/transit_json_parsing_test.cpp2
-rw-r--r--transit/transit_types.cpp8
-rw-r--r--ugc/index_migration/utility.cpp2
-rw-r--r--ugc/serdes_json.hpp18
-rw-r--r--ugc/storage.cpp38
-rw-r--r--ugc/types.hpp2
-rw-r--r--ugc/ugc_tests/migration/generate_migration_files.cpp12
-rw-r--r--ugc/ugc_tests/storage_tests.cpp30
381 files changed, 1783 insertions, 1757 deletions
diff --git a/3party/bsdiff-courgette/bsdiff/bsdiff.h b/3party/bsdiff-courgette/bsdiff/bsdiff.h
index 9a0c0a255a..ca74a2b63d 100644
--- a/3party/bsdiff-courgette/bsdiff/bsdiff.h
+++ b/3party/bsdiff-courgette/bsdiff/bsdiff.h
@@ -125,7 +125,7 @@ BSDiffStatus CreateBinaryPatch(OldReader & old_reader,
auto initial_patch_sink_pos = patch_sink.Pos();
- my::Timer bsdiff_timer;
+ base::Timer bsdiff_timer;
CHECK_GREATER_OR_EQUAL(kNumStreams, 6, ());
std::array<MemStream, kNumStreams> mem_streams;
@@ -148,7 +148,7 @@ BSDiffStatus CreateBinaryPatch(OldReader & old_reader,
return MEM_ERROR;
}
- my::Timer suf_sort_timer;
+ base::Timer suf_sort_timer;
divsuf::saint_t result = divsuf::divsufsort_include_empty(
old, I.begin(), old_size);
LOG(LINFO, ("Done divsufsort", suf_sort_timer.ElapsedSeconds()));
diff --git a/3party/jansson/jansson_handle.cpp b/3party/jansson/jansson_handle.cpp
index 3c1c0dc021..afe0c6733c 100644
--- a/3party/jansson/jansson_handle.cpp
+++ b/3party/jansson/jansson_handle.cpp
@@ -1,11 +1,9 @@
-#include "jansson_handle.hpp"
+#include "3party/jansson/jansson_handle.hpp"
#include <jansson.h>
-
-namespace my
+namespace base
{
-
void JsonHandle::IncRef()
{
if (m_pJson)
@@ -17,5 +15,4 @@ void JsonHandle::DecRef()
if (m_pJson)
json_decref(m_pJson);
}
-
-}
+} // namespace base
diff --git a/3party/jansson/jansson_handle.hpp b/3party/jansson/jansson_handle.hpp
index efdeccb168..565c5323d3 100644
--- a/3party/jansson/jansson_handle.hpp
+++ b/3party/jansson/jansson_handle.hpp
@@ -2,12 +2,10 @@
#include "std/algorithm.hpp"
-
struct json_struct_t;
-namespace my
+namespace base
{
-
class JsonHandle
{
void IncRef();
@@ -67,5 +65,4 @@ public:
private:
json_struct_t * m_pJson;
};
-
-}
+} // namespace base
diff --git a/3party/jansson/myjansson.cpp b/3party/jansson/myjansson.cpp
index 4b7ff97ca5..10b36457df 100644
--- a/3party/jansson/myjansson.cpp
+++ b/3party/jansson/myjansson.cpp
@@ -15,37 +15,37 @@ string FromJSONToString(json_t * root)
}
} // namespace
-namespace my
+namespace base
{
json_t * GetJSONObligatoryField(json_t * root, std::string const & field)
{
- auto * value = my::GetJSONOptionalField(root, field);
+ auto * value = base::GetJSONOptionalField(root, field);
if (!value)
- MYTHROW(my::Json::Exception, ("Obligatory field", field, "is absent."));
+ MYTHROW(base::Json::Exception, ("Obligatory field", field, "is absent."));
return value;
}
json_t * GetJSONOptionalField(json_t * root, std::string const & field)
{
if (!json_is_object(root))
- MYTHROW(my::Json::Exception, ("Bad json object while parsing", field));
+ MYTHROW(base::Json::Exception, ("Bad json object while parsing", field));
return json_object_get(root, field.c_str());
}
bool JSONIsNull(json_t * root) { return json_is_null(root); }
-} // namespace my
+} // namespace base
void FromJSON(json_t * root, double & result)
{
if (!json_is_number(root))
- MYTHROW(my::Json::Exception, ("Object must contain a json number."));
+ MYTHROW(base::Json::Exception, ("Object must contain a json number."));
result = json_number_value(root);
}
void FromJSON(json_t * root, bool & result)
{
if (!json_is_true(root) && !json_is_false(root) )
- MYTHROW(my::Json::Exception, ("Object must contain a boolean value."));
+ MYTHROW(base::Json::Exception, ("Object must contain a boolean value."));
result = json_is_true(root);
}
@@ -63,7 +63,7 @@ string FromJSONToString(json_t * root)
if (json_is_boolean(root))
return FromJSONToString<bool>(root);
- MYTHROW(my::Json::Exception, ("Unexpected json type"));
+ MYTHROW(base::Json::Exception, ("Unexpected json type"));
}
namespace std
@@ -71,7 +71,7 @@ namespace std
void FromJSON(json_t * root, string & result)
{
if (!json_is_string(root))
- MYTHROW(my::Json::Exception, ("The field must contain a json string."));
+ MYTHROW(base::Json::Exception, ("The field must contain a json string."));
result = json_string_value(root);
}
} // namespace std
@@ -85,5 +85,5 @@ void FromJSON(json_t * root, UniString & result)
result = MakeUniString(s);
}
-my::JSONPtr ToJSON(UniString const & s) { return ToJSON(ToUtf8(s)); }
+base::JSONPtr ToJSON(UniString const & s) { return ToJSON(ToUtf8(s)); }
} // namespace strings
diff --git a/3party/jansson/myjansson.hpp b/3party/jansson/myjansson.hpp
index 24f7b9a8d4..76f7054396 100644
--- a/3party/jansson/myjansson.hpp
+++ b/3party/jansson/myjansson.hpp
@@ -12,7 +12,7 @@
#include "3party/jansson/src/jansson.h"
-namespace my
+namespace base
{
struct JSONDecRef
{
@@ -57,7 +57,7 @@ private:
json_t * GetJSONObligatoryField(json_t * root, std::string const & field);
json_t * GetJSONOptionalField(json_t * root, std::string const & field);
bool JSONIsNull(json_t * root);
-} // namespace my
+} // namespace base
inline void FromJSON(json_t * root, json_t *& value) { value = root; }
@@ -69,7 +69,7 @@ template <typename T,
void FromJSON(json_t * root, T & result)
{
if (!json_is_number(root))
- MYTHROW(my::Json::Exception, ("Object must contain a json number."));
+ MYTHROW(base::Json::Exception, ("Object must contain a json number."));
result = static_cast<T>(json_integer_value(root));
}
@@ -78,21 +78,21 @@ std::string FromJSONToString(json_t * root);
template <typename T>
void FromJSONObject(json_t * root, std::string const & field, T & result)
{
- auto * json = my::GetJSONObligatoryField(root, field);
+ auto * json = base::GetJSONObligatoryField(root, field);
try
{
FromJSON(json, result);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
- MYTHROW(my::Json::Exception, ("An error occured while parsing field", field, e.Msg()));
+ MYTHROW(base::Json::Exception, ("An error occured while parsing field", field, e.Msg()));
}
}
template <typename T>
void FromJSONObjectOptionalField(json_t * root, std::string const & field, T & result)
{
- auto * json = my::GetJSONOptionalField(root, field);
+ auto * json = base::GetJSONOptionalField(root, field);
if (!json)
{
result = T{};
@@ -103,10 +103,10 @@ void FromJSONObjectOptionalField(json_t * root, std::string const & field, T & r
template <typename T,
typename std::enable_if<std::is_integral<T>::value, void>::type* = nullptr>
-inline my::JSONPtr ToJSON(T value) { return my::NewJSONInt(value); }
-inline my::JSONPtr ToJSON(double value) { return my::NewJSONReal(value); }
-inline my::JSONPtr ToJSON(bool value) { return my::NewJSONBool(value); }
-inline my::JSONPtr ToJSON(char const * s) { return my::NewJSONString(s); }
+inline base::JSONPtr ToJSON(T value) { return base::NewJSONInt(value); }
+inline base::JSONPtr ToJSON(double value) { return base::NewJSONReal(value); }
+inline base::JSONPtr ToJSON(bool value) { return base::NewJSONBool(value); }
+inline base::JSONPtr ToJSON(char const * s) { return base::NewJSONString(s); }
template <typename T>
void ToJSONArray(json_t & root, T const & value)
@@ -114,7 +114,7 @@ void ToJSONArray(json_t & root, T const & value)
json_array_append_new(&root, ToJSON(value).release());
}
-inline void ToJSONArray(json_t & parent, my::JSONPtr & child)
+inline void ToJSONArray(json_t & parent, base::JSONPtr & child)
{
json_array_append_new(&parent, child.release());
}
@@ -130,7 +130,7 @@ void ToJSONObject(json_t & root, std::string const & field, T const & value)
json_object_set_new(&root, field.c_str(), ToJSON(value).release());
}
-inline void ToJSONObject(json_t & parent, std::string const & field, my::JSONPtr & child)
+inline void ToJSONObject(json_t & parent, std::string const & field, base::JSONPtr & child)
{
json_object_set_new(&parent, field.c_str(), child.release());
}
@@ -143,9 +143,9 @@ inline void ToJSONObject(json_t & parent, std::string const & field, json_t & ch
template <typename T>
void FromJSONObject(json_t * root, std::string const & field, std::vector<T> & result)
{
- auto * arr = my::GetJSONObligatoryField(root, field);
+ auto * arr = base::GetJSONObligatoryField(root, field);
if (!json_is_array(arr))
- MYTHROW(my::Json::Exception, ("The field", field, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", field, "must contain a json array."));
size_t sz = json_array_size(arr);
result.resize(sz);
for (size_t i = 0; i < sz; ++i)
@@ -161,14 +161,14 @@ void FromJSONObject(json_t * root, std::string const & field, std::vector<T> & r
template <typename T>
bool FromJSONObjectOptional(json_t * root, std::string const & field, std::vector<T> & result)
{
- auto * arr = my::GetJSONOptionalField(root, field);
- if (!arr || my::JSONIsNull(arr))
+ auto * arr = base::GetJSONOptionalField(root, field);
+ if (!arr || base::JSONIsNull(arr))
{
result.clear();
return false;
}
if (!json_is_array(arr))
- MYTHROW(my::Json::Exception, ("The field", field, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", field, "must contain a json array."));
size_t const sz = json_array_size(arr);
result.resize(sz);
for (size_t i = 0; i < sz; ++i)
@@ -179,7 +179,7 @@ bool FromJSONObjectOptional(json_t * root, std::string const & field, std::vecto
template <typename T>
void ToJSONObject(json_t & root, std::string const & field, std::vector<T> const & values)
{
- auto arr = my::NewJSONArray();
+ auto arr = base::NewJSONArray();
for (auto const & value : values)
json_array_append_new(arr.get(), ToJSON(value).release());
json_object_set_new(&root, field.c_str(), arr.release());
@@ -188,14 +188,14 @@ void ToJSONObject(json_t & root, std::string const & field, std::vector<T> const
template <typename T>
void FromJSONObjectOptionalField(json_t * root, std::string const & field, std::vector<T> & result)
{
- json_t * arr = my::GetJSONOptionalField(root, field);
+ json_t * arr = base::GetJSONOptionalField(root, field);
if (!arr)
{
result.clear();
return;
}
if (!json_is_array(arr))
- MYTHROW(my::Json::Exception, ("The field", field, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", field, "must contain a json array."));
size_t sz = json_array_size(arr);
result.resize(sz);
for (size_t i = 0; i < sz; ++i)
@@ -210,11 +210,11 @@ struct JSONFreeDeleter
namespace std
{
void FromJSON(json_t * root, std::string & result);
-inline my::JSONPtr ToJSON(std::string const & s) { return my::NewJSONString(s); }
+inline base::JSONPtr ToJSON(std::string const & s) { return base::NewJSONString(s); }
} // namespace std
namespace strings
{
void FromJSON(json_t * root, UniString & result);
-my::JSONPtr ToJSON(UniString const & s);
+base::JSONPtr ToJSON(UniString const & s);
} // namespace strings
diff --git a/3party/osrm/osrm-backend/mapsme/converter.cpp b/3party/osrm/osrm-backend/mapsme/converter.cpp
index ef90ad348d..b442bb0994 100644
--- a/3party/osrm/osrm-backend/mapsme/converter.cpp
+++ b/3party/osrm/osrm-backend/mapsme/converter.cpp
@@ -260,7 +260,7 @@ void GenerateRoutingIndex(const std::string & fPath)
routingCont.Finish();
}
- MY_SCOPE_GUARD(testFileGuard, bind(&my::DeleteFileX, cref(path)));
+ MY_SCOPE_GUARD(testFileGuard, bind(&base::DeleteFileX, cref(path)));
FilesMappingContainer container;
container.Open(path);
diff --git a/3party/sdf_image/sdf_image.cpp b/3party/sdf_image/sdf_image.cpp
index f0192b08ed..edbea6e0b6 100644
--- a/3party/sdf_image/sdf_image.cpp
+++ b/3party/sdf_image/sdf_image.cpp
@@ -142,7 +142,7 @@ void SdfImage::Distquant()
{
for_each(m_data.begin(), m_data.end(), [](float & node)
{
- node = my::clamp(0.5f + node * 0.0325f, 0.0f, 1.0f);
+ node = base::clamp(0.5f + node * 0.0325f, 0.0f, 1.0f);
});
}
@@ -266,7 +266,7 @@ float SdfImage::DistaA3(int c, int xc, int yc, int xi, int yi) const
ASSERT_GREATER_OR_EQUAL(closest, 0, ());
ASSERT_LESS(closest, m_data.size(), ());
- float a = my::clamp(m_data[closest], 0.0f, 1.0f); // Grayscale value at the edge pixel
+ float a = base::clamp(m_data[closest], 0.0f, 1.0f); // Grayscale value at the edge pixel
if(a == 0.0)
return 1000000.0; // Not an object pixel, return "very far" ("don't know yet")
diff --git a/android/UnitTests/jni/mock.cpp b/android/UnitTests/jni/mock.cpp
index a9b61ad8db..2b48f0102e 100644
--- a/android/UnitTests/jni/mock.cpp
+++ b/android/UnitTests/jni/mock.cpp
@@ -12,7 +12,7 @@
#include <string>
-using namespace my;
+using namespace base;
// @todo(vbykoianko) Probably it's worth thinking about output of the function to make the result of
// the tests more readable.
diff --git a/android/jni/com/mapswithme/core/jni_helper.cpp b/android/jni/com/mapswithme/core/jni_helper.cpp
index d862623a5c..71306d1622 100644
--- a/android/jni/com/mapswithme/core/jni_helper.cpp
+++ b/android/jni/com/mapswithme/core/jni_helper.cpp
@@ -222,14 +222,14 @@ bool HandleJavaException(JNIEnv * env)
jni::ScopedLocalRef<jthrowable> const e(env, env->ExceptionOccurred());
env->ExceptionDescribe();
env->ExceptionClear();
- my::LogLevel level = GetLogLevelForException(env, e.get());
+ base::LogLevel level = GetLogLevelForException(env, e.get());
LOG(level, (ToNativeString(env, e.get())));
return true;
}
return false;
}
-my::LogLevel GetLogLevelForException(JNIEnv * env, const jthrowable & e)
+base::LogLevel GetLogLevelForException(JNIEnv * env, const jthrowable & e)
{
static jclass const errorClass = jni::GetGlobalClassRef(env, "java/lang/Error");
ASSERT(errorClass, (jni::DescribeException()));
diff --git a/android/jni/com/mapswithme/core/jni_helper.hpp b/android/jni/com/mapswithme/core/jni_helper.hpp
index c52878a482..d5d4118fe6 100644
--- a/android/jni/com/mapswithme/core/jni_helper.hpp
+++ b/android/jni/com/mapswithme/core/jni_helper.hpp
@@ -57,7 +57,7 @@ char const * GetStringClassName();
std::string DescribeException();
bool HandleJavaException(JNIEnv * env);
-my::LogLevel GetLogLevelForException(JNIEnv * env, const jthrowable & e);
+base::LogLevel GetLogLevelForException(JNIEnv * env, const jthrowable & e);
std::shared_ptr<jobject> make_global_ref(jobject obj);
using TScopedLocalRef = ScopedLocalRef<jobject>;
diff --git a/android/jni/com/mapswithme/core/logging.cpp b/android/jni/com/mapswithme/core/logging.cpp
index 32ec3a5aba..257afe87ec 100644
--- a/android/jni/com/mapswithme/core/logging.cpp
+++ b/android/jni/com/mapswithme/core/logging.cpp
@@ -18,7 +18,7 @@ extern crashlytics_context_t * g_crashlytics;
namespace jni
{
-using namespace my;
+using namespace base;
void AndroidMessage(LogLevel level, SrcPoint const & src, std::string const & s)
{
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index 3a01683ec0..aa608bb909 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -114,7 +114,7 @@ void Framework::OnLocationUpdated(location::GpsInfo const & info)
void Framework::OnCompassUpdated(location::CompassInfo const & info, bool forceRedraw)
{
- static double const COMPASS_THRESHOLD = my::DegToRad(1.0);
+ static double const COMPASS_THRESHOLD = base::DegToRad(1.0);
/// @todo Do not emit compass bearing too often.
/// Need to make more experiments in future.
diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp
index 99091db254..5dc3a9808e 100644
--- a/android/jni/com/mapswithme/maps/MapManager.cpp
+++ b/android/jni/com/mapswithme/maps/MapManager.cpp
@@ -92,7 +92,7 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeGetRoot(JNIEnv * env, jclas
JNIEXPORT jboolean JNICALL
Java_com_mapswithme_maps_downloader_MapManager_nativeMoveFile(JNIEnv * env, jclass clazz, jstring oldFile, jstring newFile)
{
- return my::RenameFileX(jni::ToNativeString(env, oldFile), jni::ToNativeString(env, newFile));
+ return base::RenameFileX(jni::ToNativeString(env, oldFile), jni::ToNativeString(env, newFile));
}
// static boolean nativeHasSpaceForMigration();
diff --git a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
index 452a624bb1..cb7113fa99 100644
--- a/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
+++ b/android/jni/com/mapswithme/maps/editor/OsmOAuth.cpp
@@ -145,7 +145,7 @@ Java_com_mapswithme_maps_editor_OsmOAuth_nativeUpdateOsmUserStats(JNIEnv * env,
JNIEnv * env = jni::GetEnv();
env->CallStaticVoidMethod(osmAuthClazz, listenerId,
env->NewObject(statsClazz, statsCtor, count, rank, jni::ToJavaString(env, levelUp),
- my::TimeTToSecondsSinceEpoch(userStats.GetLastUpdate())));
+ base::TimeTToSecondsSinceEpoch(userStats.GetLastUpdate())));
});
}
} // extern "C"
diff --git a/android/jni/com/mapswithme/opengl/android_gl_utils.cpp b/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
index 13fed787bc..b26cc51e1f 100644
--- a/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
+++ b/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
@@ -73,7 +73,7 @@ std::string GetEglError(EGLint error)
} // namespace
-void CheckEGL(my::SrcPoint const & src)
+void CheckEGL(base::SrcPoint const & src)
{
EGLint error = eglGetError();
while (error != EGL_SUCCESS)
diff --git a/android/jni/com/mapswithme/opengl/android_gl_utils.hpp b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
index e79067800e..1e06facd18 100644
--- a/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
+++ b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
@@ -2,7 +2,7 @@
#include "drape/glIncludes.hpp"
-namespace my
+namespace base
{
class SrcPoint;
}
@@ -23,7 +23,7 @@ private:
EGLDisplay m_display;
};
-void CheckEGL(my::SrcPoint const & src);
+void CheckEGL(base::SrcPoint const & src);
} // namespace android
diff --git a/base/assert.hpp b/base/assert.hpp
index 653c9d8777..1ab2939bc9 100644
--- a/base/assert.hpp
+++ b/base/assert.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include "base/base.hpp"
#include "base/internal/message.hpp"
#include "base/src_point.hpp"
@@ -7,17 +8,16 @@
#include <cstdlib>
#include <string>
-
-namespace my
+namespace base
{
- // Called when ASSERT, CHECK or VERIFY failed.
- // If returns true then crash application.
- typedef bool (*AssertFailedFn)(SrcPoint const &, std::string const &);
- extern AssertFailedFn OnAssertFailed;
+// Called when ASSERT, CHECK or VERIFY failed.
+// If returns true then crash application.
+using AssertFailedFn = bool (*)(SrcPoint const &, std::string const &);
+extern AssertFailedFn OnAssertFailed;
- /// @return Pointer to previous message function.
- AssertFailedFn SetAssertFunction(AssertFailedFn fn);
-}
+/// @return Pointer to previous message function.
+AssertFailedFn SetAssertFunction(AssertFailedFn fn);
+} // namespace base
#ifdef DEBUG
#define ASSERT_CRASH() assert(false)
@@ -25,41 +25,48 @@ namespace my
#define ASSERT_CRASH() std::abort()
#endif
-#define ASSERT_FAIL(msg) \
- if (::my::OnAssertFailed(SRC(), msg)) \
+#define ASSERT_FAIL(msg) \
+ if (::base::OnAssertFailed(SRC(), msg)) \
ASSERT_CRASH();
// TODO: Evaluate X only once in CHECK().
#define CHECK(X, msg) do { if (X) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X")", ::my::impl::Message msg));} } while(false)
+ ASSERT_FAIL(::base::Message("CHECK("#X")", ::base::Message msg));} } while(false)
+
#define CHECK_EQUAL(X, Y, msg) do { if ((X) == (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" == "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" == "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_NOT_EQUAL(X, Y, msg) do { if ((X) != (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" != "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" != "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_LESS(X, Y, msg) do { if ((X) < (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" < "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" < "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_LESS_OR_EQUAL(X, Y, msg) do { if ((X) <= (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" <= "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" <= "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_GREATER(X, Y, msg) do { if ((X) > (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" > "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" > "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_GREATER_OR_EQUAL(X, Y, msg) do { if ((X) >= (Y)) {} else { \
- ASSERT_FAIL(::my::impl::Message("CHECK("#X" >= "#Y")", \
- ::my::impl::Message(X, Y), \
- ::my::impl::Message msg));} } while (false)
+ ASSERT_FAIL(::base::Message("CHECK("#X" >= "#Y")", \
+ ::base::Message(X, Y), \
+ ::base::Message msg));} } while (false)
+
#define CHECK_OR_CALL(fail, call, X, msg) do { if (X) {} else { \
if (fail) {\
- ASSERT_FAIL(::my::impl::Message(::my::impl::Message("CHECK("#X")"), \
- ::my::impl::Message msg)); \
+ ASSERT_FAIL(::base::Message(::base::Message("CHECK("#X")"), \
+ ::base::Message msg)); \
} else { \
call(); \
} } } while (false)
diff --git a/base/base.cpp b/base/base.cpp
index 82a9b016b1..00b7b024db 100644
--- a/base/base.cpp
+++ b/base/base.cpp
@@ -1,26 +1,28 @@
#include "base/base.hpp"
+
#include "base/assert.hpp"
#include "base/exception.hpp"
+#include "base/src_point.hpp"
#include "std/target_os.hpp"
#include <iostream>
-namespace my
+namespace base
+{
+bool OnAssertFailedDefault(SrcPoint const & srcPoint, std::string const & msg)
{
- bool OnAssertFailedDefault(SrcPoint const & srcPoint, std::string const & msg)
- {
- std::cerr << "ASSERT FAILED" << std::endl
- << srcPoint.FileName() << ":" << srcPoint.Line() << std::endl
- << msg << std::endl;
- return true;
- }
+ std::cerr << "ASSERT FAILED" << std::endl
+ << srcPoint.FileName() << ":" << srcPoint.Line() << std::endl
+ << msg << std::endl;
+ return true;
+}
- AssertFailedFn OnAssertFailed = &OnAssertFailedDefault;
+AssertFailedFn OnAssertFailed = &OnAssertFailedDefault;
- AssertFailedFn SetAssertFunction(AssertFailedFn fn)
- {
- std::swap(OnAssertFailed, fn);
- return fn;
- }
+AssertFailedFn SetAssertFunction(AssertFailedFn fn)
+{
+ std::swap(OnAssertFailed, fn);
+ return fn;
}
+} // namespace base
diff --git a/base/base_tests/cache_test.cpp b/base/base_tests/cache_test.cpp
index 5c1322b33d..584015cc5b 100644
--- a/base/base_tests/cache_test.cpp
+++ b/base/base_tests/cache_test.cpp
@@ -2,6 +2,7 @@
#include "base/cache.hpp"
#include "base/macros.hpp"
+#include "base/math.hpp"
#include "base/stl_helpers.hpp"
#include <functional>
@@ -59,7 +60,7 @@ UNIT_TEST(CacheSmoke)
size_t const n = ARRAY_SIZE(s) - 1;
for (int logCacheSize = 2; logCacheSize < 6; ++logCacheSize)
{
- my::Cache<uint32_t, char> cache(logCacheSize);
+ base::Cache<uint32_t, char> cache(logCacheSize);
for (size_t i = 0; i < n; ++i)
{
bool found = false;
@@ -82,7 +83,7 @@ UNIT_TEST(CacheSmoke)
UNIT_TEST(CacheSmoke_0)
{
- my::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
bool found = true;
cache.Find(0, found);
TEST(!found, ());
@@ -93,7 +94,7 @@ UNIT_TEST(CacheSmoke_0)
UNIT_TEST(CacheSmoke_1)
{
- my::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
SimpleFunctor f;
cache.ForEachValue(f); // f passed by reference
TEST_EQUAL(f.m_v, std::vector<char>(8, 0), ());
@@ -101,7 +102,7 @@ UNIT_TEST(CacheSmoke_1)
UNIT_TEST(CacheSmoke_2)
{
- my::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::Cache<uint32_t, char> cache(3); // it contains 2^3=8 elements
SimpleFunctor f;
cache.ForEachValue(std::ref(f)); // f passed by reference
TEST_EQUAL(f.m_v, std::vector<char>(8, 0), ());
@@ -109,38 +110,38 @@ UNIT_TEST(CacheSmoke_2)
UNIT_TEST(CacheSmoke_3)
{
- my::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
// 0 access, cache miss is 0
- TEST(my::AlmostEqualAbs(0.0, cache.GetCacheMiss(), kEpsilon), ());
+ TEST(base::AlmostEqualAbs(0.0, cache.GetCacheMiss(), kEpsilon), ());
bool found = true;
cache.Find(1, found);
TEST(!found, ());
// 1 access, 1 miss, cache miss = 1/1 = 1
- TEST(my::AlmostEqualAbs(1.0, cache.GetCacheMiss(), kEpsilon), ());
+ TEST(base::AlmostEqualAbs(1.0, cache.GetCacheMiss(), kEpsilon), ());
found = false;
cache.Find(1, found);
TEST(found, ());
// 2 access, 1 miss, cache miss = 1/2 = 0.5
- TEST(my::AlmostEqualAbs(0.5, cache.GetCacheMiss(), kEpsilon), ());
+ TEST(base::AlmostEqualAbs(0.5, cache.GetCacheMiss(), kEpsilon), ());
found = false;
cache.Find(2, found);
TEST(!found, ());
// 3 access, 2 miss, cache miss = 2/3 = 0.6(6)
- TEST(my::AlmostEqualAbs(2.0/3.0, cache.GetCacheMiss(), kEpsilon), ());
+ TEST(base::AlmostEqualAbs(2.0/3.0, cache.GetCacheMiss(), kEpsilon), ());
cache.Reset();
// 0 access, cache miss is 0
- TEST(my::AlmostEqualAbs(0.0, cache.GetCacheMiss(), kEpsilon), ());
+ TEST(base::AlmostEqualAbs(0.0, cache.GetCacheMiss(), kEpsilon), ());
}
UNIT_TEST(CacheSmoke_4)
{
- my::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
SimpleFunctor f;
cache.ForEachValue(f); // f passed by reference
TEST_EQUAL(f.m_v, std::vector<char>(8, 0), ());
@@ -148,7 +149,7 @@ UNIT_TEST(CacheSmoke_4)
UNIT_TEST(CacheSmoke_5)
{
- my::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
SimpleFunctor f;
cache.ForEachValue(std::ref(f)); // f passed by reference
TEST_EQUAL(f.m_v, std::vector<char>(8, 0), ());
@@ -156,7 +157,7 @@ UNIT_TEST(CacheSmoke_5)
UNIT_TEST(CacheSmoke_6)
{
- my::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
+ base::CacheWithStat<uint32_t, char> cache(3); // it contains 2^3=8 elements
std::vector<char> v;
cache.ForEachValue(SimpleMovableFunctor(&v));
TEST_EQUAL(v, std::vector<char>(8, 0), ());
@@ -164,7 +165,7 @@ UNIT_TEST(CacheSmoke_6)
UNIT_TEST(Cache_Init)
{
- my::Cache<uint32_t, char> cache;
+ base::Cache<uint32_t, char> cache;
cache.Init(3 /* logCacheSize */);
bool found = true;
diff --git a/base/base_tests/collection_cast_test.cpp b/base/base_tests/collection_cast_test.cpp
index a322a0ef5c..6646d627a0 100644
--- a/base/base_tests/collection_cast_test.cpp
+++ b/base/base_tests/collection_cast_test.cpp
@@ -7,5 +7,5 @@
UNIT_TEST(collection_cast)
{
- TEST_EQUAL((std::list<int>{1, 2, 3, 4, }), my::collection_cast<std::list>(std::vector<int> {1, 2, 3, 4}), ());
+ TEST_EQUAL((std::list<int>{1, 2, 3, 4, }), base::collection_cast<std::list>(std::vector<int> {1, 2, 3, 4}), ());
}
diff --git a/base/base_tests/containers_test.cpp b/base/base_tests/containers_test.cpp
index 577cdfd24b..35b8671956 100644
--- a/base/base_tests/containers_test.cpp
+++ b/base/base_tests/containers_test.cpp
@@ -2,8 +2,7 @@
#include "base/limited_priority_queue.hpp"
-
-using namespace my;
+using namespace base;
UNIT_TEST(LPQueue_Smoke)
{
diff --git a/base/base_tests/logging_test.cpp b/base/base_tests/logging_test.cpp
index b7b39c994b..463e8f5ad2 100644
--- a/base/base_tests/logging_test.cpp
+++ b/base/base_tests/logging_test.cpp
@@ -8,7 +8,7 @@
namespace
{
- void TestLogMessage(my::LogLevel, my::SrcPoint const &, std::string const &)
+ void TestLogMessage(base::LogLevel, base::SrcPoint const &, std::string const &)
{
}
@@ -28,11 +28,11 @@ namespace
UNIT_TEST(Logging_Level)
{
- my::LogLevel const logLevelSaved = my::g_LogLevel;
- my::g_LogLevel = LWARNING;
+ base::LogLevel const logLevelSaved = base::g_LogLevel;
+ base::g_LogLevel = LWARNING;
g_SomeFunctionCalled = false;
- my::LogMessageFn logMessageSaved = my::SetLogMessageFn(&TestLogMessage);
+ base::LogMessageFn logMessageSaved = base::SetLogMessageFn(&TestLogMessage);
LOG(LINFO, ("This should not pass", SomeFunction()));
TEST(!g_SomeFunctionCalled, ());
@@ -40,8 +40,8 @@ UNIT_TEST(Logging_Level)
LOG(LWARNING, ("This should pass", SomeFunction()));
TEST(g_SomeFunctionCalled, ());
- my::SetLogMessageFn(logMessageSaved);
- my::g_LogLevel = logLevelSaved;
+ base::SetLogMessageFn(logMessageSaved);
+ base::g_LogLevel = logLevelSaved;
}
UNIT_TEST(NullMessage)
diff --git a/base/base_tests/math_test.cpp b/base/base_tests/math_test.cpp
index c4fcd38273..31b0722c12 100644
--- a/base/base_tests/math_test.cpp
+++ b/base/base_tests/math_test.cpp
@@ -8,32 +8,32 @@
UNIT_TEST(id)
{
- TEST_EQUAL(my::id(true), true, ());
- TEST_EQUAL(my::id(1), 1.0, ());
- TEST_EQUAL(my::id(1.0), 1, ());
+ TEST_EQUAL(base::id(true), true, ());
+ TEST_EQUAL(base::id(1), 1.0, ());
+ TEST_EQUAL(base::id(1.0), 1, ());
}
UNIT_TEST(SizeAligned)
{
- TEST_EQUAL(my::SizeAligned(0, 1), size_t(0), ());
- TEST_EQUAL(my::SizeAligned(1, 1), size_t(1), ());
- TEST_EQUAL(my::SizeAligned(2, 1), size_t(2), ());
- TEST_EQUAL(my::SizeAligned(3, 1), size_t(3), ());
-
- TEST_EQUAL(my::SizeAligned(0, 8), size_t(0), ());
- TEST_EQUAL(my::SizeAligned(1, 8), size_t(8), ());
- TEST_EQUAL(my::SizeAligned(2, 8), size_t(8), ());
- TEST_EQUAL(my::SizeAligned(7, 8), size_t(8), ());
- TEST_EQUAL(my::SizeAligned(8, 8), size_t(8), ());
- TEST_EQUAL(my::SizeAligned(9, 8), size_t(16), ());
- TEST_EQUAL(my::SizeAligned(15, 8), size_t(16), ());
- TEST_EQUAL(my::SizeAligned(16, 8), size_t(16), ());
- TEST_EQUAL(my::SizeAligned(17, 8), size_t(24), ());
+ TEST_EQUAL(base::SizeAligned(0, 1), size_t(0), ());
+ TEST_EQUAL(base::SizeAligned(1, 1), size_t(1), ());
+ TEST_EQUAL(base::SizeAligned(2, 1), size_t(2), ());
+ TEST_EQUAL(base::SizeAligned(3, 1), size_t(3), ());
+
+ TEST_EQUAL(base::SizeAligned(0, 8), size_t(0), ());
+ TEST_EQUAL(base::SizeAligned(1, 8), size_t(8), ());
+ TEST_EQUAL(base::SizeAligned(2, 8), size_t(8), ());
+ TEST_EQUAL(base::SizeAligned(7, 8), size_t(8), ());
+ TEST_EQUAL(base::SizeAligned(8, 8), size_t(8), ());
+ TEST_EQUAL(base::SizeAligned(9, 8), size_t(16), ());
+ TEST_EQUAL(base::SizeAligned(15, 8), size_t(16), ());
+ TEST_EQUAL(base::SizeAligned(16, 8), size_t(16), ());
+ TEST_EQUAL(base::SizeAligned(17, 8), size_t(24), ());
}
UNIT_TEST(PowUInt)
{
- TEST_EQUAL(my::PowUint(3, 10), 59049, ());
+ TEST_EQUAL(base::PowUint(3, 10), 59049, ());
}
UNIT_TEST(AlmostEqualULPs_Smoke)
@@ -54,10 +54,10 @@ UNIT_TEST(AlmostEqualULPs_Smoke)
TEST_ALMOST_EQUAL_ULPS(1.0/dmax, 1.0/dmax, ());
TEST_ALMOST_EQUAL_ULPS(-1.0/dmax, -1.0/dmax, ());
- TEST(!my::AlmostEqualULPs(1.0, -1.0), ());
- TEST(!my::AlmostEqualULPs(2.0, -2.0), ());
- TEST(!my::AlmostEqualULPs(dmax, -dmax), ());
- TEST(!my::AlmostEqualULPs(0.0, eps), ());
+ TEST(!base::AlmostEqualULPs(1.0, -1.0), ());
+ TEST(!base::AlmostEqualULPs(2.0, -2.0), ());
+ TEST(!base::AlmostEqualULPs(dmax, -dmax), ());
+ TEST(!base::AlmostEqualULPs(0.0, eps), ());
}
UNIT_TEST(AlmostEqual_Smoke)
@@ -65,15 +65,15 @@ UNIT_TEST(AlmostEqual_Smoke)
double const small = 1e-18;
double const eps = 1e-10;
- TEST(my::AlmostEqualAbs(0.0, 0.0 + small, eps), ());
- TEST(!my::AlmostEqualRel(0.0, 0.0 + small, eps), ());
- TEST(!my::AlmostEqualULPs(0.0, 0.0 + small), ());
+ TEST(base::AlmostEqualAbs(0.0, 0.0 + small, eps), ());
+ TEST(!base::AlmostEqualRel(0.0, 0.0 + small, eps), ());
+ TEST(!base::AlmostEqualULPs(0.0, 0.0 + small), ());
- TEST(my::AlmostEqualAbs(1.0, 1.0 + small, eps), ());
- TEST(my::AlmostEqualRel(1.0, 1.0 + small, eps), ());
- TEST(my::AlmostEqualULPs(1.0, 1.0 + small), ());
+ TEST(base::AlmostEqualAbs(1.0, 1.0 + small, eps), ());
+ TEST(base::AlmostEqualRel(1.0, 1.0 + small, eps), ());
+ TEST(base::AlmostEqualULPs(1.0, 1.0 + small), ());
- TEST(my::AlmostEqualRel(123456789.0, 123456780.0, 1e-7), ());
+ TEST(base::AlmostEqualRel(123456789.0, 123456780.0, 1e-7), ());
}
namespace
@@ -98,12 +98,12 @@ template <typename FloatT> void TestMaxULPs()
FloatT y = x;
for (unsigned int i = 0; i <= maxULPs; ++i)
{
- TEST(my::AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y, dir));
+ TEST(base::AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y, dir));
FloatT const nextY = NextFloat(y, dir);
TEST_NOT_EQUAL(y, nextY, (i, base, dir));
y = nextY;
}
- TEST(!my::AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y));
+ TEST(!base::AlmostEqualULPs(x, y, maxULPs), (x, y, maxULPs, x - y));
}
}
}
@@ -136,43 +136,43 @@ UNIT_TEST(TEST_FLOAT_DOUBLE_EQUAL_macros)
UNIT_TEST(IsIntersect_Intervals)
{
- TEST(my::IsIntersect(0, 100, 100, 200), ());
- TEST(!my::IsIntersect(0, 100, 150, 200), ());
- TEST(my::IsIntersect(0, 100, 50, 150), ());
- TEST(my::IsIntersect(0, 100, 50, 80), ());
- TEST(my::IsIntersect(0, 100, -50, 50), ());
- TEST(my::IsIntersect(0, 100, -50, 0), ());
- TEST(!my::IsIntersect(0, 100, -50, -20), ());
+ TEST(base::IsIntersect(0, 100, 100, 200), ());
+ TEST(!base::IsIntersect(0, 100, 150, 200), ());
+ TEST(base::IsIntersect(0, 100, 50, 150), ());
+ TEST(base::IsIntersect(0, 100, 50, 80), ());
+ TEST(base::IsIntersect(0, 100, -50, 50), ());
+ TEST(base::IsIntersect(0, 100, -50, 0), ());
+ TEST(!base::IsIntersect(0, 100, -50, -20), ());
}
UNIT_TEST(GCD_Test)
{
- TEST_EQUAL(my::GCD(6, 3), 3, ());
- TEST_EQUAL(my::GCD(14, 7), 7, ());
- TEST_EQUAL(my::GCD(100, 100), 100, ());
- TEST_EQUAL(my::GCD(7, 3), 1, ());
- TEST_EQUAL(my::GCD(8, 3), 1, ());
- TEST_EQUAL(my::GCD(9, 3), 3, ());
+ TEST_EQUAL(base::GCD(6, 3), 3, ());
+ TEST_EQUAL(base::GCD(14, 7), 7, ());
+ TEST_EQUAL(base::GCD(100, 100), 100, ());
+ TEST_EQUAL(base::GCD(7, 3), 1, ());
+ TEST_EQUAL(base::GCD(8, 3), 1, ());
+ TEST_EQUAL(base::GCD(9, 3), 3, ());
}
UNIT_TEST(LCM_Test)
{
- TEST_EQUAL(my::LCM(6, 3), 6, ());
- TEST_EQUAL(my::LCM(14, 7), 14, ());
- TEST_EQUAL(my::LCM(100, 100), 100, ());
- TEST_EQUAL(my::LCM(7, 3), 21, ());
- TEST_EQUAL(my::LCM(8, 3), 24, ());
- TEST_EQUAL(my::LCM(9, 3), 9, ());
+ TEST_EQUAL(base::LCM(6, 3), 6, ());
+ TEST_EQUAL(base::LCM(14, 7), 14, ());
+ TEST_EQUAL(base::LCM(100, 100), 100, ());
+ TEST_EQUAL(base::LCM(7, 3), 21, ());
+ TEST_EQUAL(base::LCM(8, 3), 24, ());
+ TEST_EQUAL(base::LCM(9, 3), 9, ());
}
UNIT_TEST(Sign_test)
{
- TEST_EQUAL(1, my::Sign(1), ());
- TEST_EQUAL(1, my::Sign(10.4), ());
+ TEST_EQUAL(1, base::Sign(1), ());
+ TEST_EQUAL(1, base::Sign(10.4), ());
- TEST_EQUAL(0, my::Sign(0), ());
- TEST_EQUAL(0, my::Sign(0.0), ());
+ TEST_EQUAL(0, base::Sign(0), ());
+ TEST_EQUAL(0, base::Sign(0.0), ());
- TEST_EQUAL(-1, my::Sign(-11), ());
- TEST_EQUAL(-1, my::Sign(-10.4), ());
+ TEST_EQUAL(-1, base::Sign(-11), ());
+ TEST_EQUAL(-1, base::Sign(-10.4), ());
}
diff --git a/base/base_tests/newtype_test.cpp b/base/base_tests/newtype_test.cpp
index c0908fac9c..317e6067b3 100644
--- a/base/base_tests/newtype_test.cpp
+++ b/base/base_tests/newtype_test.cpp
@@ -3,13 +3,14 @@
#include "base/newtype.hpp"
#include <sstream>
+#include <string>
#include <type_traits>
namespace
{
NEWTYPE(int, Int);
-string DebugPrint(Int const & i)
+std::string DebugPrint(Int const & i)
{
std::stringstream sstr;
sstr << "Int(" << i.Get() << ')';
diff --git a/base/base_tests/range_iterator_test.cpp b/base/base_tests/range_iterator_test.cpp
index 50ff634e1e..db3bd04698 100644
--- a/base/base_tests/range_iterator_test.cpp
+++ b/base/base_tests/range_iterator_test.cpp
@@ -6,7 +6,7 @@
UNIT_TEST(RangeIterator)
{
- using namespace my;
+ using namespace base;
{
std::vector<int> result;
diff --git a/base/base_tests/ref_counted_tests.cpp b/base/base_tests/ref_counted_tests.cpp
index f7f690fa80..7fa7c7cc5f 100644
--- a/base/base_tests/ref_counted_tests.cpp
+++ b/base/base_tests/ref_counted_tests.cpp
@@ -2,7 +2,7 @@
#include "base/ref_counted.hpp"
-using namespace my;
+using namespace base;
namespace
{
diff --git a/base/base_tests/string_utils_test.cpp b/base/base_tests/string_utils_test.cpp
index aad6b7a2dd..8e3bc04977 100644
--- a/base/base_tests/string_utils_test.cpp
+++ b/base/base_tests/string_utils_test.cpp
@@ -3,10 +3,11 @@
#include "base/string_utils.hpp"
#include "base/logging.hpp"
-#include <functional>
#include <fstream>
+#include <functional>
#include <iomanip>
#include <map>
+#include <string>
#include <unordered_map>
#include <vector>
@@ -39,7 +40,7 @@ UNIT_TEST(LowerUniChar)
std::getline(file, line);
// strip comments
size_t const sharp = line.find('#');
- if (sharp != string::npos)
+ if (sharp != std::string::npos)
line.erase(sharp);
strings::SimpleTokenizer semicolon(line, ";");
if (!semicolon)
diff --git a/base/base_tests/timer_test.cpp b/base/base_tests/timer_test.cpp
index fa8a492613..5b0ea045a4 100644
--- a/base/base_tests/timer_test.cpp
+++ b/base/base_tests/timer_test.cpp
@@ -6,7 +6,7 @@
UNIT_TEST(Timer_Seconds)
{
- my::Timer timer;
+ base::Timer timer;
double t1 = timer.ElapsedSeconds();
double s = 0.0;
@@ -20,12 +20,12 @@ UNIT_TEST(Timer_Seconds)
UNIT_TEST(Timer_CurrentStringTime)
{
- LOG(LINFO, (my::FormatCurrentTime()));
+ LOG(LINFO, (base::FormatCurrentTime()));
}
UNIT_TEST(Timer_TimestampConversion)
{
- using namespace my;
+ using namespace base;
TEST_EQUAL(TimestampToString(0), "1970-01-01T00:00:00Z", ());
TEST_EQUAL(TimestampToString(1354482514), "2012-12-02T21:08:34Z", ());
@@ -62,11 +62,11 @@ UNIT_TEST(Timer_TimestampConversion)
UNIT_TEST(Timer_GenerateYYMMDD)
{
- TEST_EQUAL(my::GenerateYYMMDD(116, 0, 26), 160126, ());
+ TEST_EQUAL(base::GenerateYYMMDD(116, 0, 26), 160126, ());
}
UNIT_TEST(Timer_TimeTConversion)
{
auto const now = ::time(nullptr);
- TEST_EQUAL(my::SecondsSinceEpochToTimeT(my::TimeTToSecondsSinceEpoch(now)), now, ());
+ TEST_EQUAL(base::SecondsSinceEpochToTimeT(base::TimeTToSecondsSinceEpoch(now)), now, ());
}
diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp
index 1680d0aba5..ffad520376 100644
--- a/base/buffer_vector.hpp
+++ b/base/buffer_vector.hpp
@@ -434,7 +434,7 @@ void swap(buffer_vector<T, N> & r1, buffer_vector<T, N> & r2)
template <typename T, size_t N>
inline std::string DebugPrint(buffer_vector<T, N> const & v)
{
- return ::my::impl::DebugPrintSequence(v.data(), v.data() + v.size());
+ return DebugPrintSequence(v.data(), v.data() + v.size());
}
template <typename T, size_t N1, size_t N2>
diff --git a/base/cache.hpp b/base/cache.hpp
index cf40ba8131..95177ee877 100644
--- a/base/cache.hpp
+++ b/base/cache.hpp
@@ -8,8 +8,7 @@
#include <type_traits>
#include <utility>
-
-namespace my
+namespace base
{
// Simple cache that stores list of values.
template <typename KeyT, typename ValueT> class Cache
@@ -167,4 +166,4 @@ namespace my
uint64_t m_miss;
uint64_t m_access;
};
-}
+} // namespace base
diff --git a/base/collection_cast.hpp b/base/collection_cast.hpp
index 28caa0e34d..62a53cca22 100644
--- a/base/collection_cast.hpp
+++ b/base/collection_cast.hpp
@@ -2,7 +2,7 @@
#include <type_traits>
-namespace my
+namespace base
{
namespace details
{
@@ -26,4 +26,4 @@ auto collection_cast(TFrom && from) -> TTo<details::TValueType<TFrom>>
{
return TTo<details::TValueType<TFrom>>(begin(from), end(from));
}
-} // namespace my
+} // namespace base
diff --git a/base/deferred_task.cpp b/base/deferred_task.cpp
index c3cc50e6ff..42cd788d69 100644
--- a/base/deferred_task.cpp
+++ b/base/deferred_task.cpp
@@ -1,8 +1,8 @@
-#include "deferred_task.hpp"
+#include "base/deferred_task.hpp"
-namespace my
+namespace base
{
-DeferredTask::DeferredTask(TDuration const & duration) : m_duration(duration)
+DeferredTask::DeferredTask(Duration const & duration) : m_duration(duration)
{
m_thread = threads::SimpleThread([this]
{
@@ -46,4 +46,4 @@ void DeferredTask::Drop()
}
m_cv.notify_one();
}
-} // namespace my
+} // namespace base
diff --git a/base/deferred_task.hpp b/base/deferred_task.hpp
index 246b99d554..18dc962a70 100644
--- a/base/deferred_task.hpp
+++ b/base/deferred_task.hpp
@@ -7,26 +7,20 @@
#include <functional>
#include <mutex>
-namespace my
+namespace base
{
class DeferredTask
{
- using TDuration = std::chrono::duration<double>;
- threads::SimpleThread m_thread;
- std::mutex m_mutex;
- std::condition_variable m_cv;
- std::function<void()> m_fn;
- TDuration m_duration;
- bool m_terminate = false;
-
public:
- DeferredTask(TDuration const & duration);
+ using Duration = std::chrono::duration<double>;
+
+ DeferredTask(Duration const & duration);
~DeferredTask();
void Drop();
- template <typename TFn>
- void RestartWith(TFn const && fn)
+ template <typename Fn>
+ void RestartWith(Fn const && fn)
{
{
std::unique_lock<std::mutex> l(m_mutex);
@@ -34,5 +28,13 @@ public:
}
m_cv.notify_one();
}
+
+private:
+ threads::SimpleThread m_thread;
+ std::mutex m_mutex;
+ std::condition_variable m_cv;
+ std::function<void()> m_fn;
+ Duration m_duration;
+ bool m_terminate = false;
};
-} // namespace my
+} // namespace base
diff --git a/base/exception.hpp b/base/exception.hpp
index d716073197..f062a0564d 100644
--- a/base/exception.hpp
+++ b/base/exception.hpp
@@ -32,7 +32,7 @@ private:
// TODO: Use SRC_LOGGING macro.
#define MYTHROW(exception_name, msg) throw exception_name( \
- #exception_name " " __FILE__ ":" TO_STRING(__LINE__), ::my::impl::Message msg)
+ #exception_name " " __FILE__ ":" TO_STRING(__LINE__), ::base::Message msg)
#define MYTHROW1(exception_name, param1, msg) throw exception_name(param1, \
- #exception_name " " __FILE__ ":" TO_STRING(__LINE__), ::my::impl::Message msg)
+ #exception_name " " __FILE__ ":" TO_STRING(__LINE__), ::base::Message msg)
diff --git a/base/gmtime.cpp b/base/gmtime.cpp
index 2dc63ab571..61e49d607f 100644
--- a/base/gmtime.cpp
+++ b/base/gmtime.cpp
@@ -2,7 +2,7 @@
#include "std/target_os.hpp"
-namespace my
+namespace base
{
std::tm GmTime(time_t const time)
{
@@ -14,4 +14,4 @@ std::tm GmTime(time_t const time)
#endif
return result;
}
-} // namespace my
+} // namespace base
diff --git a/base/gmtime.hpp b/base/gmtime.hpp
index a9552836b8..9c6c41d1e9 100644
--- a/base/gmtime.hpp
+++ b/base/gmtime.hpp
@@ -2,8 +2,8 @@
#include <ctime>
-namespace my
+namespace base
{
/// A cross-platform replacenemt of gmtime_r
std::tm GmTime(time_t const time);
-} // namespace my
+} // namespace base
diff --git a/base/internal/message.hpp b/base/internal/message.hpp
index 0810045ad0..c668ca54b8 100644
--- a/base/internal/message.hpp
+++ b/base/internal/message.hpp
@@ -84,84 +84,80 @@ inline std::string DebugPrint(std::chrono::time_point<std::chrono::system_clock>
return str;
}
-template <typename U, typename V> inline std::string DebugPrint(std::pair<U,V> const & p)
+template <typename U, typename V>
+std::string DebugPrint(std::pair<U, V> const & p)
{
std::ostringstream out;
out << "(" << DebugPrint(p.first) << ", " << DebugPrint(p.second) << ")";
return out.str();
}
-namespace my
+template <typename IterT>
+std::string DebugPrintSequence(IterT beg, IterT end)
{
- namespace impl
- {
- template <typename IterT> inline std::string DebugPrintSequence(IterT beg, IterT end)
- {
- std::ostringstream out;
- out << "[" << std::distance(beg, end) << ":";
- for (; beg != end; ++beg)
- out << " " << DebugPrint(*beg);
- out << " ]";
- return out.str();
- }
- }
+ std::ostringstream out;
+ out << "[" << std::distance(beg, end) << ":";
+ for (; beg != end; ++beg)
+ out << " " << DebugPrint(*beg);
+ out << " ]";
+ return out.str();
}
template <typename T, size_t N> inline std::string DebugPrint(T (&arr) [N])
{
- return ::my::impl::DebugPrintSequence(arr, arr + N);
+ return DebugPrintSequence(arr, arr + N);
}
template <typename T, size_t N> inline std::string DebugPrint(std::array<T, N> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T> inline std::string DebugPrint(std::vector<T> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T> inline std::string DebugPrint(std::deque<T> const & d)
{
- return ::my::impl::DebugPrintSequence(d.begin(), d.end());
+ return DebugPrintSequence(d.begin(), d.end());
}
template <typename T> inline std::string DebugPrint(std::list<T> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T, typename C> inline std::string DebugPrint(std::set<T, C> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T, typename C> inline std::string DebugPrint(std::multiset<T, C> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename U, typename V, typename C> inline std::string DebugPrint(std::map<U, V, C> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T> inline std::string DebugPrint(std::initializer_list<T> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <class Key, class Hash, class Pred>
inline std::string DebugPrint(std::unordered_set<Key, Hash, Pred> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <class Key, class T, class Hash, class Pred>
inline std::string DebugPrint(std::unordered_map<Key, T, Hash, Pred> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
}
template <typename T> inline std::string DebugPrint(std::unique_ptr<T> const & v)
@@ -176,24 +172,24 @@ template <typename T> inline std::string DebugPrint(std::unique_ptr<T> const & v
template <typename T> inline std::string DebugPrint(boost::circular_buffer<T> const & v)
{
- return ::my::impl::DebugPrintSequence(v.begin(), v.end());
+ return DebugPrintSequence(v.begin(), v.end());
+}
+
+namespace base
+{
+inline std::string Message() { return std::string(); }
+
+template <typename T>
+std::string Message(T const & t)
+{
+ using ::DebugPrint;
+ return DebugPrint(t);
}
-namespace my
+template <typename T, typename... Args>
+std::string Message(T const & t, Args const &... others)
{
- namespace impl
- {
- inline std::string Message()
- {
- return std::string();
- }
- template <typename T> std::string Message(T const & t)
- {
- return DebugPrint(t);
- }
- template <typename T, typename... ARGS> std::string Message(T const & t, ARGS const & ... others)
- {
- return DebugPrint(t) + " " + Message(others...);
- }
- }
+ using ::DebugPrint;
+ return DebugPrint(t) + " " + Message(others...);
}
+} // namespace base
diff --git a/base/limited_priority_queue.hpp b/base/limited_priority_queue.hpp
index 16a5ce6fd8..1a647410ba 100644
--- a/base/limited_priority_queue.hpp
+++ b/base/limited_priority_queue.hpp
@@ -7,9 +7,8 @@
#include <functional>
#include <vector>
-namespace my
+namespace base
{
-
// Priority queue that stores only N smallest elements.
template <typename T, typename CompareT = std::less<T>>
class limited_priority_queue
@@ -89,5 +88,4 @@ void swap(limited_priority_queue<T, CompareT> & q1, limited_priority_queue<T, Co
{
q1.swap(q2);
}
-
-} // namespace my
+} // namespace base
diff --git a/base/logging.cpp b/base/logging.cpp
index d71ed783f7..50be16e450 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -24,7 +24,7 @@ namespace
mutex g_logMutex;
} // namespace
-namespace my
+namespace base
{
string ToString(LogLevel level)
{
@@ -65,7 +65,7 @@ class LogHelper
return id;
}
- my::Timer m_timer;
+ base::Timer m_timer;
array<char const *, NUM_LOG_LEVELS> m_names;
array<size_t, NUM_LOG_LEVELS> m_lens;
@@ -147,4 +147,4 @@ LogLevel GetDefaultLogAbortLevel()
AtomicLogLevel g_LogLevel = {GetDefaultLogLevel()};
AtomicLogLevel g_LogAbortLevel = {GetDefaultLogAbortLevel()};
-} // namespace my
+} // namespace base
diff --git a/base/logging.hpp b/base/logging.hpp
index 10fdf9502c..c33dd7d299 100644
--- a/base/logging.hpp
+++ b/base/logging.hpp
@@ -8,7 +8,7 @@
#include <atomic>
#include <string>
-namespace my
+namespace base
{
enum LogLevel
{
@@ -63,36 +63,36 @@ struct ScopedLogAbortLevelChanger
}
~ScopedLogAbortLevelChanger() { g_LogAbortLevel = m_old; }
};
-} // namespace my
+} // namespace base
-using ::my::LDEBUG;
-using ::my::LINFO;
-using ::my::LWARNING;
-using ::my::LERROR;
-using ::my::LCRITICAL;
-using ::my::NUM_LOG_LEVELS;
+using ::base::LDEBUG;
+using ::base::LINFO;
+using ::base::LWARNING;
+using ::base::LERROR;
+using ::base::LCRITICAL;
+using ::base::NUM_LOG_LEVELS;
// Logging macro.
// Example usage: LOG(LINFO, (Calc(), m_Var, "Some string constant"));
-#define LOG(level, msg) \
- do \
- { \
- if ((level) >= ::my::g_LogLevel) \
- ::my::LogMessage(level, SRC(), ::my::impl::Message msg); \
+#define LOG(level, msg) \
+ do \
+ { \
+ if ((level) >= ::base::g_LogLevel) \
+ ::base::LogMessage(level, SRC(), ::base::Message msg); \
} while (false)
// Logging macro with short info (without entry point)
#define LOG_SHORT(level, msg) \
do \
{ \
- if ((level) >= ::my::g_LogLevel) \
- ::my::LogMessage(level, my::SrcPoint(), ::my::impl::Message msg); \
+ if ((level) >= ::base::g_LogLevel) \
+ ::base::LogMessage(level, base::SrcPoint(), ::base::Message msg); \
} while (false)
// Conditional log. Logs @msg with level @level in case when @X returns false.
-#define CLOG(level, X, msg) \
- do \
- { \
- if (!(X)) \
- LOG(level, (SRC(), "CLOG(" #X ")", ::my::impl::Message msg)); \
+#define CLOG(level, X, msg) \
+ do \
+ { \
+ if (!(X)) \
+ LOG(level, (SRC(), "CLOG(" #X ")", ::base::Message msg)); \
} while (false)
diff --git a/base/macros.hpp b/base/macros.hpp
index 59cda11012..a5d704f485 100644
--- a/base/macros.hpp
+++ b/base/macros.hpp
@@ -3,17 +3,17 @@
#include "base/assert.hpp"
#include "base/base.hpp"
-namespace my
+namespace base
{
- namespace impl
- {
- // http://rsdn.ru/Forum/?mid=1025325
- template <typename T, unsigned int N> char(&ArraySize(T(&)[N]))[N];
- }
-}
+namespace impl
+{
+// http://rsdn.ru/Forum/?mid=1025325
+template <typename T, unsigned int N> char(&ArraySize(T(&)[N]))[N];
+} // namespace impl
+} // namespace base
// Number of elements in array. Compilation error if the type passed is not an array.
-#define ARRAY_SIZE(X) sizeof(::my::impl::ArraySize(X))
+#define ARRAY_SIZE(X) sizeof(::base::impl::ArraySize(X))
#define DISALLOW_COPY(className) \
className(className const &) = delete; \
@@ -35,20 +35,21 @@ namespace my
#define UNUSED_VALUE(x) static_cast<void>(x)
-namespace my
+namespace base
+{
+namespace impl
+{
+template <typename T>
+inline void ForceUseValue(T const & t)
{
- namespace impl
- {
- template <typename T> inline void ForceUseValue(T const & t)
- {
- volatile T dummy = t;
- UNUSED_VALUE(dummy);
- }
- }
+ volatile T dummy = t;
+ UNUSED_VALUE(dummy);
}
+} // namespace impl
+} // namespace base
// Prevent compiler optimization.
-#define FORCE_USE_VALUE(x) ::my::impl::ForceUseValue(x)
+#define FORCE_USE_VALUE(x) ::base::impl::ForceUseValue(x)
#ifdef __GNUC__
#define PREDICT(x, prediction) __builtin_expect(x, prediction)
diff --git a/base/math.hpp b/base/math.hpp
index 28de88d266..d853f87749 100644
--- a/base/math.hpp
+++ b/base/math.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include "base/assert.hpp"
#include <algorithm>
@@ -18,7 +19,7 @@ namespace math
double constexpr twicePi = 2. * pi;
} // namespace math
-namespace my
+namespace base
{
template <typename T> inline T Abs(T x)
{
@@ -208,4 +209,4 @@ int constexpr Sign(Number const number) noexcept
{
return number == 0 ? 0 : number > 0 ? 1 : -1;
}
-} // namespace my
+} // namespace base
diff --git a/base/matrix.hpp b/base/matrix.hpp
index c33963b890..4d5e65639e 100644
--- a/base/matrix.hpp
+++ b/base/matrix.hpp
@@ -68,7 +68,7 @@ namespace math
{
for (size_t i = 0; i < Rows; ++i)
for (size_t j = 0; j < Cols; ++j)
- if (my::Abs(m_data[i * Cols + j] - m(i, j)) > eps)
+ if (base::Abs(m_data[i * Cols + j] - m(i, j)) > eps)
return false;
return true;
diff --git a/base/newtype.hpp b/base/newtype.hpp
index 50a65c8c3b..a6423dd818 100644
--- a/base/newtype.hpp
+++ b/base/newtype.hpp
@@ -5,7 +5,7 @@
#include <string>
#include <type_traits>
-namespace my
+namespace base
{
namespace impl
{
@@ -160,19 +160,18 @@ std::string SimpleDebugPrint(NewType<Type, Tag> const & nt)
return ::DebugPrint(nt.Get());
}
} // namespace newtype_default_output
-} // namespace my
-
-#define NEWTYPE(REPR, NAME) \
- struct NAME ## _tag; \
- using NAME = my::NewType<REPR, NAME ## _tag>
+} // namespace base
+#define NEWTYPE(REPR, NAME) \
+ struct NAME##_tag; \
+ using NAME = base::NewType<REPR, NAME##_tag>
#define NEWTYPE_SIMPLE_OUTPUT(NAME) \
inline std::string DebugPrint(NAME const & nt) \
{ \
- return my::newtype_default_output::SimpleDebugPrint(nt); \
+ return base::newtype_default_output::SimpleDebugPrint(nt); \
} \
inline std::ostream & operator<<(std::ostream & ost, NAME const & nt) \
{ \
- return ost << my::newtype_default_output::SimpleDebugPrint(nt); \
+ return ost << base::newtype_default_output::SimpleDebugPrint(nt); \
}
diff --git a/base/observer_list.hpp b/base/observer_list.hpp
index 2cd632538f..711da1c1e2 100644
--- a/base/observer_list.hpp
+++ b/base/observer_list.hpp
@@ -69,4 +69,4 @@ private:
Mutex m_observersLock;
std::vector<Observer *> m_observers;
};
-} // namespace my
+} // namespace base
diff --git a/base/range_iterator.hpp b/base/range_iterator.hpp
index d16fee4581..3a1290ac2e 100644
--- a/base/range_iterator.hpp
+++ b/base/range_iterator.hpp
@@ -3,7 +3,7 @@
#include <iterator>
#include <type_traits>
-namespace my
+namespace base
{
// RagneItrator allows to write for loops as follows:
// for (auto const i : range(N))
@@ -27,12 +27,12 @@ struct RangeIterator
TCounter m_current;
};
-} // namespace my
+} // namespace base
namespace std
{
template <typename T>
-struct iterator_traits<my::RangeIterator<T>>
+struct iterator_traits<base::RangeIterator<T>>
{
using difference_type = T;
using value_type = T;
@@ -42,7 +42,7 @@ struct iterator_traits<my::RangeIterator<T>>
};
} // namespace std
-namespace my
+namespace base
{
template <typename TCounter, bool forward>
struct RangeWrapper
@@ -97,4 +97,4 @@ RangeIterator<TCounter> MakeRangeIterator(TCounter const counter)
{
return RangeIterator<TCounter>(counter);
}
-} // namespace my
+} // namespace base
diff --git a/base/ref_counted.hpp b/base/ref_counted.hpp
index c63d388568..af698c78c0 100644
--- a/base/ref_counted.hpp
+++ b/base/ref_counted.hpp
@@ -5,7 +5,7 @@
#include <cstdint>
#include <memory>
-namespace my
+namespace base
{
class RefCounted
{
@@ -104,4 +104,4 @@ public:
private:
T * m_p = nullptr;
};
-} // namespace my
+} // namespace base
diff --git a/base/rolling_hash.hpp b/base/rolling_hash.hpp
index 20f3fc1e39..c69a48565f 100644
--- a/base/rolling_hash.hpp
+++ b/base/rolling_hash.hpp
@@ -21,7 +21,7 @@ public:
template <typename IterT> hash_type Init(IterT it, uint64_t windowSize)
{
m_WindowSize = windowSize;
- m_RemoveMultiplier = my::PowUint(m_Multiplier, m_WindowSize - 1);
+ m_RemoveMultiplier = base::PowUint(m_Multiplier, m_WindowSize - 1);
#ifdef DEBUG
while (!m_Queue.empty()) m_Queue.pop();
#endif
diff --git a/base/scope_guard.hpp b/base/scope_guard.hpp
index 7954949acf..84382e08c2 100644
--- a/base/scope_guard.hpp
+++ b/base/scope_guard.hpp
@@ -3,9 +3,10 @@
/// @brief See http://gzip.rsdn.ru/forum/Message.aspx?mid=389127&only=1.
#pragma once
+
#include "base/base.hpp"
-namespace my
+namespace base
{
namespace impl
{
@@ -56,9 +57,8 @@ impl::GuardImpl<TFunctor> make_scope_guard(TFunctor const & F)
{
return impl::GuardImpl<TFunctor>(F);
}
-
-} // namespace my
+} // namespace base
#define MY_SCOPE_GUARD(name, func) \
- ::my::scope_guard name = my::make_scope_guard(func); static_cast<void>(name);
+ ::base::scope_guard name = base::make_scope_guard(func); static_cast<void>(name);
diff --git a/base/src_point.cpp b/base/src_point.cpp
index 4230eed080..0f1cd33ff7 100644
--- a/base/src_point.cpp
+++ b/base/src_point.cpp
@@ -3,7 +3,7 @@
#include <algorithm>
#include <sstream>
-namespace my
+namespace base
{
void SrcPoint::TruncateFileName()
{
@@ -28,4 +28,4 @@ std::string DebugPrint(SrcPoint const & srcPoint)
<< srcPoint.Postfix() << " ";
return out.str();
}
-} // namespace my
+} // namespace base
diff --git a/base/src_point.hpp b/base/src_point.hpp
index 4e990cfd73..9552f75728 100644
--- a/base/src_point.hpp
+++ b/base/src_point.hpp
@@ -8,30 +8,32 @@
#if SRC_LOGGING
#ifndef __OBJC__
-#define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__, "()")
+#define SRC() base::SrcPoint(__FILE__, __LINE__, __FUNCTION__, "()")
#else
-#define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__)
+#define SRC() base::SrcPoint(__FILE__, __LINE__, __FUNCTION__)
#endif
#else
-#define SRC() my::SrcPoint()
+#define SRC() base::SrcPoint()
#endif
-namespace my
+namespace base
{
class SrcPoint
{
public:
SrcPoint() : m_fileName(""), m_line(-1), m_function(""), m_postfix("") { TruncateFileName(); }
+
SrcPoint(char const * fileName, int line, char const * function, char const * postfix = "")
: m_fileName(fileName), m_line(line), m_function(function), m_postfix(postfix)
{
TruncateFileName();
}
- inline char const * FileName() const { return m_fileName; }
- inline int Line() const { return m_line; }
- inline char const * Function() const { return m_function; }
- inline char const * Postfix() const { return m_postfix; }
+ char const * FileName() const { return m_fileName; }
+ int Line() const { return m_line; }
+ char const * Function() const { return m_function; }
+ char const * Postfix() const { return m_postfix; }
+
private:
void TruncateFileName();
@@ -42,4 +44,4 @@ private:
};
std::string DebugPrint(SrcPoint const & srcPoint);
-}
+} // namespace base
diff --git a/base/stats.hpp b/base/stats.hpp
index 590c296ed4..974c5f7703 100644
--- a/base/stats.hpp
+++ b/base/stats.hpp
@@ -1,22 +1,23 @@
#pragma once
+
#include "base/base.hpp"
#include <sstream>
#include <string>
-
-namespace my
+namespace base
{
-
-template <typename T> class NoopStats
+template <typename T>
+class NoopStats
{
public:
NoopStats() {}
- inline void operator() (T const &) {}
- inline std::string GetStatsStr() const { return ""; }
+ void operator() (T const &) {}
+ std::string GetStatsStr() const { return ""; }
};
-template <typename T> class AverageStats
+template <typename T>
+class AverageStats
{
public:
AverageStats() : m_Count(0), m_Sum(0) {}
@@ -27,7 +28,7 @@ public:
m_Sum += x;
}
- string GetStatsStr() const
+ std::string GetStatsStr() const
{
std::ostringstream out;
out << "N: " << m_Count;
@@ -50,5 +51,4 @@ private:
uint32_t m_Count;
double m_Sum;
};
-
-}
+} // namespace base
diff --git a/base/sunrise_sunset.cpp b/base/sunrise_sunset.cpp
index 3d8356caae..19b8647d4b 100644
--- a/base/sunrise_sunset.cpp
+++ b/base/sunrise_sunset.cpp
@@ -118,13 +118,13 @@ std::pair<DayEventType, time_t> CalculateDayEventTime(time_t timeUtc,
// 4. calculate the Sun's true longitude
- double L = M + (1.916 * sin(my::DegToRad(M))) + (0.020 * sin(2 * my::DegToRad(M))) + 282.634;
+ double L = M + (1.916 * sin(base::DegToRad(M))) + (0.020 * sin(2 * base::DegToRad(M))) + 282.634;
// NOTE: L potentially needs to be adjusted into the range [0,360) by adding/subtracting 360
L = NormalizeAngle(L);
// 5a. calculate the Sun's right ascension
- double RA = my::RadToDeg( atan(0.91764 * tan(my::DegToRad(L))) );
+ double RA = base::RadToDeg( atan(0.91764 * tan(base::DegToRad(L))) );
// NOTE: RA potentially needs to be adjusted into the range [0,360) by adding/subtracting 360
RA = NormalizeAngle(RA);
@@ -140,12 +140,12 @@ std::pair<DayEventType, time_t> CalculateDayEventTime(time_t timeUtc,
// 6. calculate the Sun's declination
- double sinDec = 0.39782 * sin(my::DegToRad(L));
+ double sinDec = 0.39782 * sin(base::DegToRad(L));
double cosDec = cos(asin(sinDec));
// 7a. calculate the Sun's local hour angle
- double cosH = (cos(my::DegToRad(kZenith)) - (sinDec * sin(my::DegToRad(latitude)))) / (cosDec * cos(my::DegToRad(latitude)));
+ double cosH = (cos(base::DegToRad(kZenith)) - (sinDec * sin(base::DegToRad(latitude)))) / (cosDec * cos(base::DegToRad(latitude)));
// if cosH > 1 then sun is never rises on this location on specified date (polar night)
// if cosH < -1 then sun is never sets on this location on specified date (polar day)
@@ -163,9 +163,9 @@ std::pair<DayEventType, time_t> CalculateDayEventTime(time_t timeUtc,
double H = 0;
if (sunrise)
- H = 360 - my::RadToDeg(acos(cosH));
+ H = 360 - base::RadToDeg(acos(cosH));
else
- H = my::RadToDeg(acos(cosH));
+ H = base::RadToDeg(acos(cosH));
H = H / 15;
diff --git a/base/threaded_container.hpp b/base/threaded_container.hpp
index d5d2c004d8..292a8742ef 100644
--- a/base/threaded_container.hpp
+++ b/base/threaded_container.hpp
@@ -8,7 +8,7 @@ struct ThreadedContainer : public base::Cancellable
{
protected:
- my::Timer m_Timer;
+ base::Timer m_Timer;
mutable threads::Condition m_Cond;
diff --git a/base/timegm.cpp b/base/timegm.cpp
index 02461d6095..202327ffd2 100644
--- a/base/timegm.cpp
+++ b/base/timegm.cpp
@@ -69,7 +69,7 @@ time_t TimeGM(std::tm const & tm)
minutes = hours * 60 + tm.tm_min;
seconds = minutes * 60 + tm.tm_sec;
- return my::SecondsSinceEpochToTimeT(seconds);
+ return base::SecondsSinceEpochToTimeT(seconds);
}
time_t TimeGM(int year, int month, int day, int hour, int min, int sec)
diff --git a/base/timer.cpp b/base/timer.cpp
index f4dcc1a28a..d695eb4e2c 100644
--- a/base/timer.cpp
+++ b/base/timer.cpp
@@ -14,9 +14,8 @@
#include <sys/time.h>
-namespace my
+namespace base
{
-
Timer::Timer(bool start/* = true*/)
{
if (start)
@@ -175,4 +174,4 @@ uint64_t TimeTToSecondsSinceEpoch(time_t time)
auto const tpoint = std::chrono::system_clock::from_time_t(time);
return std::chrono::duration_cast<std::chrono::seconds>(tpoint.time_since_epoch()).count();
}
-}
+} // namespace base
diff --git a/base/timer.hpp b/base/timer.hpp
index 36d2599f07..86fbd2a804 100644
--- a/base/timer.hpp
+++ b/base/timer.hpp
@@ -5,9 +5,8 @@
#include <ctime>
#include <string>
-namespace my
+namespace base
{
-
/// Cross platform timer
class Timer
{
@@ -22,10 +21,10 @@ public:
/// @return Elapsed time from start (@see Reset).
inline std::chrono::steady_clock::duration TimeElapsed() const { return std::chrono::steady_clock::now() - m_startTime; }
- template <typename TDuration>
- inline TDuration TimeElapsedAs() const
+ template <typename Duration>
+ inline Duration TimeElapsedAs() const
{
- return std::chrono::duration_cast<TDuration>(TimeElapsed());
+ return std::chrono::duration_cast<Duration>(TimeElapsed());
}
inline double ElapsedSeconds() const { return TimeElapsedAs<std::chrono::duration<double>>().count(); }
@@ -75,4 +74,4 @@ public:
time_t SecondsSinceEpochToTimeT(uint64_t secondsSinceEpoch);
uint64_t TimeTToSecondsSinceEpoch(time_t time);
-} // namespace my
+} // namespace base
diff --git a/coding/bwt_coder.hpp b/coding/bwt_coder.hpp
index ca51e526b9..790300308f 100644
--- a/coding/bwt_coder.hpp
+++ b/coding/bwt_coder.hpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <cstdint>
#include <iterator>
+#include <string>
#include <vector>
namespace coding
@@ -48,7 +49,7 @@ public:
}
template <typename Sink>
- static void EncodeAndWriteBlock(Sink & sink, string const & s)
+ static void EncodeAndWriteBlock(Sink & sink, std::string const & s)
{
EncodeAndWriteBlock(sink, s.size(), reinterpret_cast<uint8_t const *>(s.data()));
}
diff --git a/coding/coding_tests/file_data_test.cpp b/coding/coding_tests/file_data_test.cpp
index f610c3f072..c4399ff7ed 100644
--- a/coding/coding_tests/file_data_test.cpp
+++ b/coding/coding_tests/file_data_test.cpp
@@ -13,20 +13,20 @@ namespace
void MakeFile(string const & name)
{
- my::FileData f(name, my::FileData::OP_WRITE_TRUNCATE);
+ base::FileData f(name, base::FileData::OP_WRITE_TRUNCATE);
f.Write(name.c_str(), name.size());
}
void MakeFile(string const & name, size_t const size, const char c)
{
- my::FileData f(name, my::FileData::OP_WRITE_TRUNCATE);
+ base::FileData f(name, base::FileData::OP_WRITE_TRUNCATE);
f.Write(string(size, c).c_str(), size);
}
#ifdef OMIM_OS_WINDOWS
void CheckFileOK(string const & name)
{
- my::FileData f(name, my::FileData::OP_READ);
+ base::FileData f(name, base::FileData::OP_READ);
uint64_t const size = f.Size();
TEST_EQUAL ( size, name.size(), () );
@@ -44,18 +44,18 @@ UNIT_TEST(FileData_ApiSmoke)
uint64_t const size = name1.size();
uint64_t sz;
- TEST(my::GetFileSize(name1, sz), ());
+ TEST(base::GetFileSize(name1, sz), ());
TEST_EQUAL(sz, size, ());
- TEST(my::RenameFileX(name1, name2), ());
+ TEST(base::RenameFileX(name1, name2), ());
- TEST(!my::GetFileSize(name1, sz), ());
- TEST(my::GetFileSize(name2, sz), ());
+ TEST(!base::GetFileSize(name1, sz), ());
+ TEST(base::GetFileSize(name2, sz), ());
TEST_EQUAL(sz, size, ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::DeleteFileX(name2), ());
- TEST(!my::GetFileSize(name2, sz), ());
+ TEST(!base::GetFileSize(name2, sz), ());
}
/*
@@ -66,7 +66,7 @@ UNIT_TEST(FileData_NoDiskSpace)
try
{
- my::FileData f(name, my::FileData::OP_WRITE_TRUNCATE);
+ base::FileData f(name, base::FileData::OP_WRITE_TRUNCATE);
for (size_t i = 0; i < 100; ++i)
f.Write(&bytes[0], bytes.size());
@@ -76,7 +76,7 @@ UNIT_TEST(FileData_NoDiskSpace)
LOG(LINFO, ("Writer exception catched"));
}
- (void)my::DeleteFileX(name);
+ (void)base::DeleteFileX(name);
}
*/
@@ -88,31 +88,31 @@ UNIT_TEST(FileData_SharingAV_Windows)
MakeFile(name1);
// lock file, will check sharing access
- my::FileData f1(name1, my::FileData::OP_READ);
+ base::FileData f1(name1, base::FileData::OP_READ);
// try rename or delete locked file
- TEST(!my::RenameFileX(name1, name2), ());
- TEST(!my::DeleteFileX(name1), ());
+ TEST(!base::RenameFileX(name1, name2), ());
+ TEST(!base::DeleteFileX(name1), ());
MakeFile(name2);
// try rename or copy to locked file
- TEST(!my::RenameFileX(name2, name1), ());
- TEST(!my::CopyFileX(name2, name1), ());
+ TEST(!base::RenameFileX(name2, name1), ());
+ TEST(!base::CopyFileX(name2, name1), ());
// files should be unchanged
CheckFileOK(name1);
CheckFileOK(name2);
- //TEST(my::CopyFile(name1, name2), ());
+ //TEST(base::CopyFile(name1, name2), ());
}
// renaming to existing file is not allowed
- TEST(!my::RenameFileX(name1, name2), ());
- TEST(!my::RenameFileX(name2, name1), ());
+ TEST(!base::RenameFileX(name1, name2), ());
+ TEST(!base::RenameFileX(name2, name1), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
#endif
*/
@@ -121,12 +121,12 @@ UNIT_TEST(Equal_Function_Test)
{
MakeFile(name1);
MakeFile(name2);
- TEST(my::IsEqualFiles(name1, name1), ());
- TEST(my::IsEqualFiles(name2, name2), ());
- TEST(!my::IsEqualFiles(name1, name2), ());
+ TEST(base::IsEqualFiles(name1, name1), ());
+ TEST(base::IsEqualFiles(name2, name2), ());
+ TEST(!base::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
UNIT_TEST(Equal_Function_Test_For_Big_Files)
@@ -134,40 +134,40 @@ UNIT_TEST(Equal_Function_Test_For_Big_Files)
{
MakeFile(name1, 1024 * 1024, 'a');
MakeFile(name2, 1024 * 1024, 'a');
- TEST(my::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::IsEqualFiles(name1, name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
{
MakeFile(name1, 1024 * 1024 + 512, 'a');
MakeFile(name2, 1024 * 1024 + 512, 'a');
- TEST(my::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::IsEqualFiles(name1, name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
{
MakeFile(name1, 1024 * 1024 + 1, 'a');
MakeFile(name2, 1024 * 1024 + 1, 'b');
- TEST(my::IsEqualFiles(name1, name1), ());
- TEST(my::IsEqualFiles(name2, name2), ());
- TEST(!my::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::IsEqualFiles(name1, name1), ());
+ TEST(base::IsEqualFiles(name2, name2), ());
+ TEST(!base::IsEqualFiles(name1, name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
{
MakeFile(name1, 1024 * 1024, 'a');
MakeFile(name2, 1024 * 1024, 'b');
- TEST(my::IsEqualFiles(name1, name1), ());
- TEST(my::IsEqualFiles(name2, name2), ());
- TEST(!my::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(base::IsEqualFiles(name1, name1), ());
+ TEST(base::IsEqualFiles(name2, name2), ());
+ TEST(!base::IsEqualFiles(name1, name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
{
MakeFile(name1, 1024 * 1024, 'a');
MakeFile(name2, 1024 * 1024 + 1, 'b');
- TEST(!my::IsEqualFiles(name1, name2), ());
- TEST(my::DeleteFileX(name1), ());
- TEST(my::DeleteFileX(name2), ());
+ TEST(!base::IsEqualFiles(name1, name2), ());
+ TEST(base::DeleteFileX(name1), ());
+ TEST(base::DeleteFileX(name2), ());
}
}
diff --git a/coding/coding_tests/file_utils_test.cpp b/coding/coding_tests/file_utils_test.cpp
index 4f28330246..5293d3608f 100644
--- a/coding/coding_tests/file_utils_test.cpp
+++ b/coding/coding_tests/file_utils_test.cpp
@@ -2,40 +2,41 @@
#include "coding/file_name_utils.hpp"
+#include <string>
UNIT_TEST(FileName_Smoke)
{
- string name = "/Users/xxx/Documents/test.test";
- TEST_EQUAL(my::GetFileExtension(name), ".test", ());
- my::GetNameFromFullPath(name);
+ std::string name = "/Users/xxx/Documents/test.test";
+ TEST_EQUAL(base::GetFileExtension(name), ".test", ());
+ base::GetNameFromFullPath(name);
TEST_EQUAL(name, "test.test", ());
- my::GetNameFromFullPath(name);
+ base::GetNameFromFullPath(name);
TEST_EQUAL(name, "test.test", ());
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
TEST_EQUAL(name, "test", ());
name = "C:\\My Documents\\test.test";
- TEST_EQUAL(my::GetFileExtension(name), ".test", ());
- my::GetNameFromFullPath(name);
+ TEST_EQUAL(base::GetFileExtension(name), ".test", ());
+ base::GetNameFromFullPath(name);
TEST_EQUAL(name, "test.test", ());
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
TEST_EQUAL(name, "test", ());
name = "/";
- TEST_EQUAL(my::GetFileExtension(name), string(), ());
- my::GetNameFromFullPath(name);
+ TEST_EQUAL(base::GetFileExtension(name), std::string(), ());
+ base::GetNameFromFullPath(name);
TEST(name.empty(), ());
name = "C:\\";
- TEST_EQUAL(my::GetFileExtension(name), string(), ());
- my::GetNameFromFullPath(name);
+ TEST_EQUAL(base::GetFileExtension(name), std::string(), ());
+ base::GetNameFromFullPath(name);
TEST(name.empty(), ());
name = "../test";
- TEST_EQUAL(my::GetFileExtension(name), string(), ());
- my::GetNameFromFullPath(name);
+ TEST_EQUAL(base::GetFileExtension(name), std::string(), ());
+ base::GetNameFromFullPath(name);
TEST_EQUAL(name, "test", ());
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
TEST_EQUAL(name, "test", ());
}
@@ -45,40 +46,40 @@ UNIT_TEST(FileName_Smoke)
UNIT_TEST(FileName_GetDirectory)
{
- TEST_EQUAL("/tmp", my::GetDirectory("/tmp/evil\\file"), ());
- TEST_EQUAL(".", my::GetDirectory("evil\\file"), ());
+ TEST_EQUAL("/tmp", base::GetDirectory("/tmp/evil\\file"), ());
+ TEST_EQUAL(".", base::GetDirectory("evil\\file"), ());
- TEST_EQUAL("/", my::GetDirectory("/somefile.txt"), ());
+ TEST_EQUAL("/", base::GetDirectory("/somefile.txt"), ());
- TEST_EQUAL("/", my::GetDirectory("////somefile"), ());
- TEST_EQUAL("a/b", my::GetDirectory("a/b///somefile.txt"), ());
+ TEST_EQUAL("/", base::GetDirectory("////somefile"), ());
+ TEST_EQUAL("a/b", base::GetDirectory("a/b///somefile.txt"), ());
- TEST_EQUAL("/a/b", my::GetDirectory("/a/b/c"), ());
- TEST_EQUAL("/a/b", my::GetDirectory("/a/b/c.txt"), ());
+ TEST_EQUAL("/a/b", base::GetDirectory("/a/b/c"), ());
+ TEST_EQUAL("/a/b", base::GetDirectory("/a/b/c.txt"), ());
- TEST_EQUAL(".", my::GetDirectory("somefile.txt"), ());
- TEST_EQUAL(".", my::GetDirectory("somefile"), ());
+ TEST_EQUAL(".", base::GetDirectory("somefile.txt"), ());
+ TEST_EQUAL(".", base::GetDirectory("somefile"), ());
}
UNIT_TEST(FilePath_Slash)
{
- TEST_EQUAL("/", my::AddSlashIfNeeded(""), ());
- TEST_EQUAL("/", my::AddSlashIfNeeded("/"), ());
- TEST_EQUAL("./", my::AddSlashIfNeeded("."), ());
- TEST_EQUAL("data/", my::AddSlashIfNeeded("data"), ());
- TEST_EQUAL("data/", my::AddSlashIfNeeded("data/"), ());
- TEST_EQUAL("/data/", my::AddSlashIfNeeded("/data"), ());
- TEST_EQUAL("/data/", my::AddSlashIfNeeded("/data/"), ());
- TEST_EQUAL("../../data/", my::AddSlashIfNeeded("../../data"), ());
- TEST_EQUAL("../../data/", my::AddSlashIfNeeded("../../data/"), ());
+ TEST_EQUAL("/", base::AddSlashIfNeeded(""), ());
+ TEST_EQUAL("/", base::AddSlashIfNeeded("/"), ());
+ TEST_EQUAL("./", base::AddSlashIfNeeded("."), ());
+ TEST_EQUAL("data/", base::AddSlashIfNeeded("data"), ());
+ TEST_EQUAL("data/", base::AddSlashIfNeeded("data/"), ());
+ TEST_EQUAL("/data/", base::AddSlashIfNeeded("/data"), ());
+ TEST_EQUAL("/data/", base::AddSlashIfNeeded("/data/"), ());
+ TEST_EQUAL("../../data/", base::AddSlashIfNeeded("../../data"), ());
+ TEST_EQUAL("../../data/", base::AddSlashIfNeeded("../../data/"), ());
}
UNIT_TEST(FilePath_Join)
{
- TEST_EQUAL("omim/strings.txt", my::JoinFoldersToPath("omim", "strings.txt"), ());
- TEST_EQUAL("omim/strings.txt", my::JoinFoldersToPath("omim/", "strings.txt"), ());
- TEST_EQUAL("../../omim/strings.txt", my::JoinFoldersToPath({"..", "..", "omim"}, "strings.txt"), ());
- TEST_EQUAL("../../omim/strings.txt", my::JoinFoldersToPath({"../", "..", "omim/"}, "strings.txt"), ());
+ TEST_EQUAL("omim/strings.txt", base::JoinFoldersToPath("omim", "strings.txt"), ());
+ TEST_EQUAL("omim/strings.txt", base::JoinFoldersToPath("omim/", "strings.txt"), ());
+ TEST_EQUAL("../../omim/strings.txt", base::JoinFoldersToPath({"..", "..", "omim"}, "strings.txt"), ());
+ TEST_EQUAL("../../omim/strings.txt", base::JoinFoldersToPath({"../", "..", "omim/"}, "strings.txt"), ());
}
#endif // OMIM_OS_WINDOWS
diff --git a/coding/coding_tests/traffic_test.cpp b/coding/coding_tests/traffic_test.cpp
index 83d621ab86..acc7c01922 100644
--- a/coding/coding_tests/traffic_test.cpp
+++ b/coding/coding_tests/traffic_test.cpp
@@ -42,9 +42,9 @@ void Test(vector<TrafficGPSEncoder::DataPoint> & points)
{
TEST_EQUAL(points[i].m_timestamp, result[i].m_timestamp,
(points[i].m_timestamp, result[i].m_timestamp));
- TEST(my::AlmostEqualAbsOrRel(points[i].m_latLon.lat, result[i].m_latLon.lat, kEps),
+ TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lat, result[i].m_latLon.lat, kEps),
(points[i].m_latLon.lat, result[i].m_latLon.lat));
- TEST(my::AlmostEqualAbsOrRel(points[i].m_latLon.lon, result[i].m_latLon.lon, kEps),
+ TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lon, result[i].m_latLon.lon, kEps),
(points[i].m_latLon.lon, result[i].m_latLon.lon));
}
diff --git a/coding/coding_tests/writer_test.cpp b/coding/coding_tests/writer_test.cpp
index 7d5277f6c2..2f9de2aacb 100644
--- a/coding/coding_tests/writer_test.cpp
+++ b/coding/coding_tests/writer_test.cpp
@@ -254,7 +254,7 @@ UNIT_TEST(FileWriter_Reserve)
{
uint64_t size;
- TEST(my::GetFileSize(TEST_FILE, size), ());
+ TEST(base::GetFileSize(TEST_FILE, size), ());
TEST_EQUAL(size, TEST_SIZE, ());
FileWriter w(TEST_FILE, FileWriter::OP_WRITE_EXISTING);
diff --git a/coding/coding_tests/zip_creator_test.cpp b/coding/coding_tests/zip_creator_test.cpp
index 781f6ff9f4..7a5c0b5419 100644
--- a/coding/coding_tests/zip_creator_test.cpp
+++ b/coding/coding_tests/zip_creator_test.cpp
@@ -24,10 +24,10 @@ void CreateAndTestZip(string const & filePath, string const & zipPath)
string const unzippedFile = "unzipped.tmp";
ZipFileReader::UnzipFile(zipPath, files[0].first, unzippedFile);
- TEST(my::IsEqualFiles(filePath, unzippedFile), ());
- TEST(my::DeleteFileX(filePath), ());
- TEST(my::DeleteFileX(zipPath), ());
- TEST(my::DeleteFileX(unzippedFile), ());
+ TEST(base::IsEqualFiles(filePath, unzippedFile), ());
+ TEST(base::DeleteFileX(filePath), ());
+ TEST(base::DeleteFileX(zipPath), ());
+ TEST(base::DeleteFileX(unzippedFile), ());
}
}
diff --git a/coding/compressed_bit_vector.hpp b/coding/compressed_bit_vector.hpp
index 925759d83d..7bc8115639 100644
--- a/coding/compressed_bit_vector.hpp
+++ b/coding/compressed_bit_vector.hpp
@@ -14,7 +14,7 @@
namespace coding
{
-class CompressedBitVector : public my::RefCounted
+class CompressedBitVector : public base::RefCounted
{
public:
enum class StorageStrategy
diff --git a/coding/file_container.cpp b/coding/file_container.cpp
index 62a30d6dc1..2e7cd1780f 100644
--- a/coding/file_container.cpp
+++ b/coding/file_container.cpp
@@ -377,7 +377,7 @@ void FilesContainerW::DeleteSection(Tag const & tag)
}
// swap files
- if (!my::DeleteFileX(m_name) || !my::RenameFileX(m_name + ".tmp", m_name))
+ if (!base::DeleteFileX(m_name) || !base::RenameFileX(m_name + ".tmp", m_name))
MYTHROW(RootException, ("Can't rename file", m_name, "Sharing violation or disk error!"));
// do open to update m_info
diff --git a/coding/file_name_utils.cpp b/coding/file_name_utils.cpp
index 0a470f1aff..fc74539e1e 100644
--- a/coding/file_name_utils.cpp
+++ b/coding/file_name_utils.cpp
@@ -1,9 +1,10 @@
-#include "file_name_utils.hpp"
+#include "coding/file_name_utils.hpp"
#include "std/target_os.hpp"
+using namespace std;
-namespace my
+namespace base
{
void GetNameWithoutExt(string & name)
{
@@ -63,7 +64,7 @@ string GetNativeSeparator()
string JoinFoldersToPath(const string & folder, const string & file)
{
- return my::AddSlashIfNeeded(folder) + file;
+ return base::AddSlashIfNeeded(folder) + file;
}
string JoinFoldersToPath(initializer_list<string> const & folders, const string & file)
@@ -84,5 +85,4 @@ string AddSlashIfNeeded(string const & path)
return path;
return path + sep;
}
-
-} // namespace my
+} // namespace base
diff --git a/coding/file_name_utils.hpp b/coding/file_name_utils.hpp
index a7ccdd8ad1..42939f4b0a 100644
--- a/coding/file_name_utils.hpp
+++ b/coding/file_name_utils.hpp
@@ -1,45 +1,45 @@
#pragma once
-#include "std/initializer_list.hpp"
-#include "std/string.hpp"
-
+#include <initializer_list>
+#include <string>
#include <utility>
-namespace my
+namespace base
{
- /// Remove extension from file name.
- void GetNameWithoutExt(string & name);
- string FilenameWithoutExt(string name);
- /// @return File extension with the dot or empty string if no extension found.
- string GetFileExtension(string const & name);
+/// Remove extension from file name.
+void GetNameWithoutExt(std::string & name);
+std::string FilenameWithoutExt(std::string name);
+/// @return File extension with the dot or empty std::string if no extension found.
+std::string GetFileExtension(std::string const & name);
- /// Get file name from full path.
- void GetNameFromFullPath(string & name);
+/// Get file name from full path.
+void GetNameFromFullPath(std::string & name);
- /// Get file name from full path without extension.
- string GetNameFromFullPathWithoutExt(string const & path);
+/// Get file name from full path without extension.
+std::string GetNameFromFullPathWithoutExt(std::string const & path);
- /// Returns all but last components of the path. After dropping the last
- /// component, all trailing slashes are removed, unless the result is a
- /// root directory. If the argument is a single component, returns ".".
- string GetDirectory(string const & path);
+/// Returns all but last components of the path. After dropping the last
+/// component, all trailing slashes are removed, unless the result is a
+/// root directory. If the argument is a single component, returns ".".
+std::string GetDirectory(std::string const & path);
- /// Get folder separator for specific platform
- string GetNativeSeparator();
+/// Get folder separator for specific platform
+std::string GetNativeSeparator();
- /// @deprecated use JoinPath instead.
- string JoinFoldersToPath(const string & folder, const string & file);
- string JoinFoldersToPath(initializer_list<string> const & folders, const string & file);
+/// @deprecated use JoinPath instead.
+std::string JoinFoldersToPath(std::string const & folder, std::string const & file);
+std::string JoinFoldersToPath(std::initializer_list<std::string> const & folders,
+ std::string const & file);
- /// Add the terminating slash to the folder path string if it's not already there.
- string AddSlashIfNeeded(string const & path);
+/// Add the terminating slash to the folder path std::string if it's not already there.
+std::string AddSlashIfNeeded(std::string const & path);
- inline std::string JoinPath(std::string const & file) { return file; }
+inline std::string JoinPath(std::string const & file) { return file; }
- /// Create full path from some folder using native folders separator.
- template<typename... Args>
- std::string JoinPath(std::string const & folder, Args&&... args)
- {
- return AddSlashIfNeeded(folder) + JoinPath(std::forward<Args>(args)...);
- }
+/// Create full path from some folder using native folders separator.
+template <typename... Args>
+std::string JoinPath(std::string const & folder, Args &&... args)
+{
+ return AddSlashIfNeeded(folder) + JoinPath(std::forward<Args>(args)...);
}
+} // namespace base
diff --git a/coding/file_reader.cpp b/coding/file_reader.cpp
index e19920e255..1966935e1e 100644
--- a/coding/file_reader.cpp
+++ b/coding/file_reader.cpp
@@ -17,11 +17,11 @@ using namespace std;
namespace
{
-class FileDataWithCachedSize : public my::FileData
+class FileDataWithCachedSize : public base::FileData
{
public:
explicit FileDataWithCachedSize(string const & fileName)
- : my::FileData(fileName, FileData::OP_READ), m_Size(FileData::Size())
+ : base::FileData(fileName, FileData::OP_READ), m_Size(FileData::Size())
{
}
diff --git a/coding/file_writer.cpp b/coding/file_writer.cpp
index b8f44298f9..e6d2e798a3 100644
--- a/coding/file_writer.cpp
+++ b/coding/file_writer.cpp
@@ -11,7 +11,7 @@ FileWriter::FileWriter(FileWriter && rhs)
}
FileWriter::FileWriter(string const & fileName, FileWriter::Op op, bool bTruncOnClose)
- : m_pFileData(make_unique<my::FileData>(fileName, static_cast<my::FileData::Op>(op)))
+ : m_pFileData(make_unique<base::FileData>(fileName, static_cast<base::FileData::Op>(op)))
, m_bTruncOnClose(bTruncOnClose)
{
}
@@ -73,7 +73,7 @@ void FileWriter::Reserve(uint64_t size)
void FileWriter::DeleteFileX(string const & fName)
{
- (void)my::DeleteFileX(fName);
+ UNUSED_VALUE(base::DeleteFileX(fName));
}
void FileWriter::WritePadding(uint64_t offset, uint64_t factor)
diff --git a/coding/file_writer.hpp b/coding/file_writer.hpp
index a35d889621..86711963ef 100644
--- a/coding/file_writer.hpp
+++ b/coding/file_writer.hpp
@@ -4,9 +4,15 @@
#include "base/base.hpp"
+#include <cstddef>
+#include <cstdint>
#include <memory>
+#include <string>
-namespace my { class FileData; }
+namespace base
+{
+class FileData;
+}
// FileWriter, not thread safe.
class FileWriter : public Writer
@@ -32,7 +38,7 @@ public:
FileWriter(FileWriter && rhs);
- explicit FileWriter(string const & fileName,
+ explicit FileWriter(std::string const & fileName,
Op operation = OP_WRITE_TRUNCATE, bool bTruncOnClose = false);
~FileWriter() override;
@@ -48,13 +54,13 @@ public:
void Reserve(uint64_t size);
- static void DeleteFileX(string const & fName);
+ static void DeleteFileX(std::string const & fName);
- string const & GetName() const;
+ std::string const & GetName() const;
private:
void WritePadding(uint64_t offset, uint64_t factor);
- std::unique_ptr<my::FileData> m_pFileData;
+ std::unique_ptr<base::FileData> m_pFileData;
bool m_bTruncOnClose;
};
diff --git a/coding/geometry_coding.cpp b/coding/geometry_coding.cpp
index 90ba013f2b..e6e821bce8 100644
--- a/coding/geometry_coding.cpp
+++ b/coding/geometry_coding.cpp
@@ -16,14 +16,14 @@ namespace
inline m2::PointU ClampPoint(m2::PointU const & maxPoint, m2::Point<double> const & point)
{
using uvalue_t = m2::PointU::value_type;
- // return m2::PointU(my::clamp(static_cast<uvalue_t>(point.x), static_cast<uvalue_t>(0),
+ // return m2::PointU(base::clamp(static_cast<uvalue_t>(point.x), static_cast<uvalue_t>(0),
// maxPoint.x),
- // my::clamp(static_cast<uvalue_t>(point.y), static_cast<uvalue_t>(0),
+ // base::clamp(static_cast<uvalue_t>(point.y), static_cast<uvalue_t>(0),
// maxPoint.y));
return m2::PointU(
- static_cast<uvalue_t>(my::clamp(point.x, 0.0, static_cast<double>(maxPoint.x))),
- static_cast<uvalue_t>(my::clamp(point.y, 0.0, static_cast<double>(maxPoint.y))));
+ static_cast<uvalue_t>(base::clamp(point.x, 0.0, static_cast<double>(maxPoint.x))),
+ static_cast<uvalue_t>(base::clamp(point.y, 0.0, static_cast<double>(maxPoint.y))));
}
struct edge_less_p0
diff --git a/coding/internal/file_data.cpp b/coding/internal/file_data.cpp
index 3c3fda6195..8a8ff3df58 100644
--- a/coding/internal/file_data.cpp
+++ b/coding/internal/file_data.cpp
@@ -23,10 +23,8 @@
#include "tizen/inc/FIo.hpp"
#endif
-
-namespace my
+namespace base
{
-
FileData::FileData(string const & fileName, Op op)
: m_FileName(fileName), m_Op(op)
{
@@ -210,7 +208,7 @@ bool GetFileSize(string const & fName, uint64_t & sz)
{
try
{
- typedef my::FileData fdata_t;
+ typedef base::FileData fdata_t;
fdata_t f(fName, fdata_t::OP_READ);
sz = f.Size();
return true;
@@ -321,8 +319,8 @@ bool CopyFileX(string const & fOld, string const & fNew)
bool IsEqualFiles(string const & firstFile, string const & secondFile)
{
- my::FileData first(firstFile, my::FileData::OP_READ);
- my::FileData second(secondFile, my::FileData::OP_READ);
+ base::FileData first(firstFile, base::FileData::OP_READ);
+ base::FileData second(secondFile, base::FileData::OP_READ);
if (first.Size() != second.Size())
return false;
@@ -348,5 +346,4 @@ bool IsEqualFiles(string const & firstFile, string const & secondFile)
return true;
}
-
-}
+} // namespace base
diff --git a/coding/internal/file_data.hpp b/coding/internal/file_data.hpp
index 2bd4514d98..d794ac23dc 100644
--- a/coding/internal/file_data.hpp
+++ b/coding/internal/file_data.hpp
@@ -18,9 +18,8 @@ namespace Tizen
}
#endif
-
-namespace my {
-
+namespace base
+{
class FileData: private noncopyable
{
public:
@@ -68,4 +67,4 @@ bool WriteToTempAndRenameToFile(string const & dest, function<bool(string const
/// @return false if copy fails. DO NOT THROWS exceptions
bool CopyFileX(string const & fOld, string const & fNew);
bool IsEqualFiles(string const & firstFile, string const & secondFile);
-}
+} // namespace base
diff --git a/coding/pointd_to_pointu.cpp b/coding/pointd_to_pointu.cpp
index 6cc75da59c..7dd2593da1 100644
--- a/coding/pointd_to_pointu.cpp
+++ b/coding/pointd_to_pointu.cpp
@@ -14,7 +14,7 @@ uint32_t DoubleToUint32(double x, double min, double max, uint32_t coordBits)
{
ASSERT_GREATER_OR_EQUAL(coordBits, 1, ());
ASSERT_LESS_OR_EQUAL(coordBits, 32, ());
- x = my::clamp(x, min, max);
+ x = base::clamp(x, min, max);
return static_cast<uint32_t>(0.5 + (x - min) / (max - min) * bits::GetFullMask(static_cast<uint8_t>(coordBits)));
}
@@ -27,8 +27,8 @@ double Uint32ToDouble(uint32_t x, double min, double max, uint32_t coordBits)
m2::PointU PointDToPointU(double x, double y, uint32_t coordBits)
{
- x = my::clamp(x, MercatorBounds::minX, MercatorBounds::maxX);
- y = my::clamp(y, MercatorBounds::minY, MercatorBounds::maxY);
+ x = base::clamp(x, MercatorBounds::minX, MercatorBounds::maxX);
+ y = base::clamp(y, MercatorBounds::minY, MercatorBounds::maxY);
uint32_t const ix = static_cast<uint32_t>(0.5 +
(x - MercatorBounds::minX) /
diff --git a/coding/reader_cache.hpp b/coding/reader_cache.hpp
index 6f2c758d26..e6bc84e6d2 100644
--- a/coding/reader_cache.hpp
+++ b/coding/reader_cache.hpp
@@ -4,27 +4,29 @@
#include "base/cache.hpp"
#include "base/stats.hpp"
-#include "std/algorithm.hpp"
-#include "std/cstring.hpp"
-#include "std/sstream.hpp"
-#include "std/vector.hpp"
-
+#include <algorithm>
+#include <cstdint>
+#include <cstring>
+#include <sstream>
+#include <string>
+#include <vector>
namespace impl
{
-
-template <bool bEnable> struct ReaderCacheStats
+template <bool Enable>
+struct ReaderCacheStats
{
- string GetStatsStr(uint32_t, uint32_t) const { return ""; }
- my::NoopStats<uint32_t> m_ReadSize;
- my::NoopStats<uint32_t> m_CacheHit;
+ std::string GetStatsStr(uint32_t, uint32_t) const { return ""; }
+ base::NoopStats<uint32_t> m_ReadSize;
+ base::NoopStats<uint32_t> m_CacheHit;
};
-template <> struct ReaderCacheStats<true>
+template <>
+struct ReaderCacheStats<true>
{
- string GetStatsStr(uint32_t logPageSize, uint32_t pageCount) const
+ std::string GetStatsStr(uint32_t logPageSize, uint32_t pageCount) const
{
- ostringstream out;
+ std::ostringstream out;
out << "LogPageSize: " << logPageSize << " PageCount: " << pageCount;
out << " ReadSize(" << m_ReadSize.GetStatsStr() << ")";
out << " CacheHit(" << m_CacheHit.GetStatsStr() << ")";
@@ -36,11 +38,10 @@ template <> struct ReaderCacheStats<true>
return out.str();
}
- my::AverageStats<uint32_t> m_ReadSize;
- my::AverageStats<uint32_t> m_CacheHit;
+ base::AverageStats<uint32_t> m_ReadSize;
+ base::AverageStats<uint32_t> m_CacheHit;
};
-
-}
+} // namespace impl
template <class ReaderT, bool bStats = false>
class ReaderCache
@@ -60,7 +61,7 @@ public:
char * pDst = static_cast<char *>(p);
uint64_t pageNum = pos >> m_LogPageSize;
size_t const firstPageOffset = static_cast<size_t>(pos - (pageNum << m_LogPageSize));
- size_t const firstCopySize = min(size, PageSize() - firstPageOffset);
+ size_t const firstCopySize = std::min(size, PageSize() - firstPageOffset);
ASSERT_GREATER(firstCopySize, 0, ());
memcpy(pDst, ReadPage(reader, pageNum) + firstPageOffset, firstCopySize);
size -= firstCopySize;
@@ -69,7 +70,7 @@ public:
++pageNum;
while (size > 0)
{
- size_t const copySize = min(size, PageSize());
+ size_t const copySize = std::min(size, PageSize());
memcpy(pDst, ReadPage(reader, pageNum), copySize);
size -= copySize;
pos += copySize;
@@ -78,7 +79,7 @@ public:
}
}
- string GetStatsStr() const
+ std::string GetStatsStr() const
{
return m_Stats.GetStatsStr(m_LogPageSize, m_Cache.GetCacheSize());
}
@@ -89,19 +90,19 @@ private:
inline char const * ReadPage(ReaderT & reader, uint64_t pageNum)
{
bool cached;
- vector<char> & v = m_Cache.Find(pageNum, cached);
+ std::vector<char> & v = m_Cache.Find(pageNum, cached);
m_Stats.m_CacheHit(cached ? 1 : 0);
if (!cached)
{
if (v.empty())
v.resize(PageSize());
uint64_t const pos = pageNum << m_LogPageSize;
- reader.Read(pos, &v[0], min(PageSize(), static_cast<size_t>(reader.Size() - pos)));
+ reader.Read(pos, &v[0], std::min(PageSize(), static_cast<size_t>(reader.Size() - pos)));
}
return &v[0];
}
- my::Cache<uint64_t, vector<char> > m_Cache;
+ base::Cache<uint64_t, std::vector<char> > m_Cache;
uint32_t const m_LogPageSize;
impl::ReaderCacheStats<bStats> m_Stats;
};
diff --git a/coding/serdes_json.hpp b/coding/serdes_json.hpp
index bffb58d69c..67639dfac9 100644
--- a/coding/serdes_json.hpp
+++ b/coding/serdes_json.hpp
@@ -12,6 +12,7 @@
#include <cstring>
#include <memory>
#include <type_traits>
+#include <utility>
#include <vector>
namespace coding
@@ -88,13 +89,13 @@ public:
template <typename R, EnableIfNotIterable<R> * = nullptr, EnableIfNotEnum<R> * = nullptr>
void operator()(R const & r, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONObject(), name, [this, &r] { r.Visit(*this); });
+ NewScopeWith(base::NewJSONObject(), name, [this, &r] { r.Visit(*this); });
}
template <typename T, EnableIfIterable<T> * = nullptr>
void operator()(T const & src, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONArray(), name, [this, &src] {
+ NewScopeWith(base::NewJSONArray(), name, [this, &src] {
for (auto const & v : src)
(*this)(v);
});
@@ -103,7 +104,7 @@ public:
template <typename R>
void operator()(std::unique_ptr<R> const & r, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONObject(), name, [this, &r] {
+ NewScopeWith(base::NewJSONObject(), name, [this, &r] {
CHECK(r, ());
r->Visit(*this);
});
@@ -112,7 +113,7 @@ public:
template <typename R>
void operator()(std::shared_ptr<R> const & r, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONObject(), name, [this, &r] {
+ NewScopeWith(base::NewJSONObject(), name, [this, &r] {
CHECK(r, ());
r->Visit(*this);
});
@@ -131,9 +132,9 @@ public:
protected:
template <typename Fn>
- void NewScopeWith(my::JSONPtr json_object, char const * name, Fn && fn)
+ void NewScopeWith(base::JSONPtr json_object, char const * name, Fn && fn)
{
- my::JSONPtr safe_json = std::move(m_json);
+ base::JSONPtr safe_json = std::move(m_json);
m_json = std::move(json_object);
auto rollback = [this, &safe_json, name]()
@@ -153,7 +154,7 @@ protected:
fn();
}
- my::JSONPtr m_json = nullptr;
+ base::JSONPtr m_json = nullptr;
Sink & m_sink;
};
@@ -203,7 +204,7 @@ public:
json_t * outerContext = SaveContext(name);
if (!json_is_array(m_json))
- MYTHROW(my::Json::Exception, ("The field", name, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));
vs.resize(json_array_size(m_json));
for (size_t index = 0; index < vs.size(); ++index)
@@ -223,7 +224,7 @@ public:
json_t * outerContext = SaveContext(name);
if (!json_is_array(m_json))
- MYTHROW(my::Json::Exception, ("The field", name, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));
T tmp;
size_t size = json_array_size(m_json);
@@ -246,12 +247,12 @@ public:
json_t * outerContext = SaveContext(name);
if (!json_is_array(m_json))
- MYTHROW(my::Json::Exception,
+ MYTHROW(base::Json::Exception,
("The field", name, "must contain a json array.", json_dumps(m_json, 0)));
if (N != json_array_size(m_json))
{
- MYTHROW(my::Json::Exception, ("The field", name, "must contain a json array of size", N,
+ MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array of size", N,
"but size is", json_array_size(m_json)));
}
@@ -318,7 +319,7 @@ protected:
{
json_t * context = m_json;
if (name)
- m_json = my::GetJSONObligatoryField(context, name);
+ m_json = base::GetJSONObligatoryField(context, name);
return context;
}
@@ -328,7 +329,7 @@ protected:
m_json = context;
}
- my::Json m_jsonObject;
+ base::Json m_jsonObject;
json_t * m_json = nullptr;
};
} // namespace coding
diff --git a/coding/sha1.cpp b/coding/sha1.cpp
index 7a6c2515db..a6182d497d 100644
--- a/coding/sha1.cpp
+++ b/coding/sha1.cpp
@@ -21,7 +21,7 @@ SHA1::Hash SHA1::Calculate(std::string const & filePath)
uint32_t constexpr kFileBufferSize = 8192;
try
{
- my::FileData file(filePath, my::FileData::OP_READ);
+ base::FileData file(filePath, base::FileData::OP_READ);
uint64_t const fileSize = file.Size();
CSHA1 sha1;
diff --git a/coding/zip_creator.cpp b/coding/zip_creator.cpp
index dca31e1674..189257aa0d 100644
--- a/coding/zip_creator.cpp
+++ b/coding/zip_creator.cpp
@@ -58,7 +58,7 @@ void CreateTMZip(tm_zip & res)
bool CreateZipFromPathDeflatedAndDefaultCompression(string const & filePath, string const & zipFilePath)
{
// 2. Open zip file for writing.
- MY_SCOPE_GUARD(outFileGuard, bind(&my::DeleteFileX, cref(zipFilePath)));
+ MY_SCOPE_GUARD(outFileGuard, bind(&base::DeleteFileX, cref(zipFilePath)));
ZipHandle zip(zipFilePath);
if (!zip.Handle())
return false;
@@ -67,7 +67,7 @@ bool CreateZipFromPathDeflatedAndDefaultCompression(string const & filePath, str
CreateTMZip(zipInfo.tmz_date);
string fileName = filePath;
- my::GetNameFromFullPath(fileName);
+ base::GetNameFromFullPath(fileName);
if (!strings::IsASCIIString(fileName))
fileName = "MapsMe.kml";
@@ -80,7 +80,7 @@ bool CreateZipFromPathDeflatedAndDefaultCompression(string const & filePath, str
// Write source file into zip file.
try
{
- my::FileData file(filePath, my::FileData::OP_READ);
+ base::FileData file(filePath, base::FileData::OP_READ);
uint64_t const fileSize = file.Size();
uint64_t currSize = 0;
diff --git a/drape/batcher_helpers.cpp b/drape/batcher_helpers.cpp
index 1be5eda2df..a7653b7a8c 100644
--- a/drape/batcher_helpers.cpp
+++ b/drape/batcher_helpers.cpp
@@ -61,7 +61,7 @@ protected:
int16_t GetCWNormalizer()
{
int16_t tmp = m_minStripCounter;
- m_minStripCounter = my::cyclicClamp(m_minStripCounter + 1, 0, 5);
+ m_minStripCounter = base::cyclicClamp(m_minStripCounter + 1, 0, 5);
switch (tmp)
{
case 4: return 1;
diff --git a/drape/color.hpp b/drape/color.hpp
index 75cd292a06..0fbb174dad 100644
--- a/drape/color.hpp
+++ b/drape/color.hpp
@@ -30,9 +30,9 @@ struct Color
bool operator< (Color const & other) const { return m_rgba < other.m_rgba; }
Color operator*(float s) const
{
- return Color(static_cast<uint8_t>(my::clamp(GetRedF() * s, 0.0f, 1.0f) * 255.0f),
- static_cast<uint8_t>(my::clamp(GetGreenF() * s, 0.0f, 1.0f) * 255.0f),
- static_cast<uint8_t>(my::clamp(GetBlueF() * s, 0.0f, 1.0f) * 255.0f),
+ return Color(static_cast<uint8_t>(base::clamp(GetRedF() * s, 0.0f, 1.0f) * 255.0f),
+ static_cast<uint8_t>(base::clamp(GetGreenF() * s, 0.0f, 1.0f) * 255.0f),
+ static_cast<uint8_t>(base::clamp(GetBlueF() * s, 0.0f, 1.0f) * 255.0f),
GetAlpha());
}
diff --git a/drape/cpu_buffer.cpp b/drape/cpu_buffer.cpp
index c5f63765d0..69b6a34ae5 100644
--- a/drape/cpu_buffer.cpp
+++ b/drape/cpu_buffer.cpp
@@ -12,7 +12,7 @@ namespace dp
CPUBuffer::CPUBuffer(uint8_t elementSize, uint32_t capacity)
: TBase(elementSize, capacity)
{
- uint32_t memorySize = my::NextPowOf2(GetCapacity() * GetElementSize());
+ uint32_t memorySize = base::NextPowOf2(GetCapacity() * GetElementSize());
m_memory = SharedBufferManager::instance().reserveSharedBuffer(memorySize);
m_memoryCursor = NonConstData();
}
diff --git a/drape/drape_tests/bidi_tests.cpp b/drape/drape_tests/bidi_tests.cpp
index ef071d7606..099a294fd9 100644
--- a/drape/drape_tests/bidi_tests.cpp
+++ b/drape/drape_tests/bidi_tests.cpp
@@ -2,13 +2,14 @@
#include "drape/bidi.hpp"
+#include <string>
UNIT_TEST(BidiDirection)
{
- string base = "\u0686\u0631\u0645\u0647\u064A\u0646";
+ std::string base = "\u0686\u0631\u0645\u0647\u064A\u0646";
strings::UniString in = strings::MakeUniString(base);
strings::UniString out1 = bidi::log2vis(in);
- string out = "\uFEE6\uFEF4\uFEEC\uFEE3\uFEAE\uFB7C";
+ std::string out = "\uFEE6\uFEF4\uFEEC\uFEE3\uFEAE\uFB7C";
strings::UniString out2 = strings::MakeUniString(out);
bool eq = out1 == out2;
TEST_EQUAL(eq, true, ());
diff --git a/drape/drape_tests/failure_reporter.cpp b/drape/drape_tests/failure_reporter.cpp
index 94a4161c94..e5c8d13670 100644
--- a/drape/drape_tests/failure_reporter.cpp
+++ b/drape/drape_tests/failure_reporter.cpp
@@ -23,8 +23,8 @@ public:
if (!m_throwed)
{
m_throwed = true;
- my::OnTestFailed(my::SrcPoint(file == NULL ? "" : file,
- line, ""), message);
+ base::OnTestFailed(base::SrcPoint(file == NULL ? "" : file,
+ line, ""), message);
}
}
};
diff --git a/drape/drape_tests/glfunctions.cpp b/drape/drape_tests/glfunctions.cpp
index eae86206ca..249e9deae6 100644
--- a/drape/drape_tests/glfunctions.cpp
+++ b/drape/drape_tests/glfunctions.cpp
@@ -296,7 +296,7 @@ uint32_t GLFunctions::glCheckFramebufferStatus()
return MOCK_CALL(glCheckFramebufferStatus());
}
-void CheckGLError(my::SrcPoint const & /*srcPt*/) {}
+void CheckGLError(base::SrcPoint const & /*srcPt*/) {}
void GLFunctions::glEnable(glConst mode) {}
diff --git a/drape/drape_tests/pointers_tests.cpp b/drape/drape_tests/pointers_tests.cpp
index 68b6149f07..7909addc28 100644
--- a/drape/drape_tests/pointers_tests.cpp
+++ b/drape/drape_tests/pointers_tests.cpp
@@ -17,7 +17,7 @@ public:
#if defined(TRACK_POINTERS)
bool g_assertRaised = false;
-bool OnAssertRaised(my::SrcPoint const & /* srcPoint */, std::string const & /* msg */)
+bool OnAssertRaised(base::SrcPoint const & /* srcPoint */, std::string const & /* msg */)
{
g_assertRaised = true;
return false;
@@ -83,14 +83,14 @@ UNIT_TEST(RefPointerExpiringTest)
{
#if defined(TRACK_POINTERS)
g_assertRaised = false;
- my::AssertFailedFn prevFn = my::SetAssertFunction(OnAssertRaised);
+ base::AssertFailedFn prevFn = base::SetAssertFunction(OnAssertRaised);
drape_ptr<Tester> ptr = make_unique_dp<Tester>();
ref_ptr<Tester> refPtr1 = make_ref(ptr);
ref_ptr<Tester> refPtr2 = make_ref(ptr);
ptr.reset();
- my::SetAssertFunction(prevFn);
+ base::SetAssertFunction(prevFn);
TEST(g_assertRaised, ());
#endif
diff --git a/drape/drape_tests/stipple_pen_tests.cpp b/drape/drape_tests/stipple_pen_tests.cpp
index 360ad9dbea..cedce6f8d6 100644
--- a/drape/drape_tests/stipple_pen_tests.cpp
+++ b/drape/drape_tests/stipple_pen_tests.cpp
@@ -18,10 +18,10 @@ void TestPacker(StipplePenPacker & packer, uint32_t width, m2::RectU const & exp
bool IsRectsEqual(m2::RectF const & r1, m2::RectF const & r2)
{
- return my::AlmostEqualULPs(r1.minX(), r2.minX()) &&
- my::AlmostEqualULPs(r1.minY(), r2.minY()) &&
- my::AlmostEqualULPs(r1.maxX(), r2.maxX()) &&
- my::AlmostEqualULPs(r1.maxY(), r2.maxY());
+ return base::AlmostEqualULPs(r1.minX(), r2.minX()) &&
+ base::AlmostEqualULPs(r1.minY(), r2.minY()) &&
+ base::AlmostEqualULPs(r1.maxX(), r2.maxX()) &&
+ base::AlmostEqualULPs(r1.maxY(), r2.maxY());
}
class DummyStipplePenIndex : public StipplePenIndex
diff --git a/drape/drape_tests/testingmain.cpp b/drape/drape_tests/testingmain.cpp
index 10849c188f..e8ea11d522 100644
--- a/drape/drape_tests/testingmain.cpp
+++ b/drape/drape_tests/testingmain.cpp
@@ -37,7 +37,7 @@ int main(int argc, char * argv[])
UNUSED_VALUE(argv);
#endif
- my::ScopedLogLevelChanger const infoLogLevel(LINFO);
+ base::ScopedLogLevelChanger const infoLogLevel(LINFO);
emul::GLMockFunctions::Init(&argc, argv);
MY_SCOPE_GUARD(GLMockScope, bind(&emul::GLMockFunctions::Teardown));
diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp
index 5669e9638c..14d22f136b 100644
--- a/drape/glfunctions.cpp
+++ b/drape/glfunctions.cpp
@@ -1017,7 +1017,7 @@ std::string GetGLError(GLenum error)
}
} // namespace
-void CheckGLError(my::SrcPoint const & srcPoint)
+void CheckGLError(base::SrcPoint const & srcPoint)
{
GLenum result = glGetError();
while (result != GL_NO_ERROR)
diff --git a/drape/glfunctions.hpp b/drape/glfunctions.hpp
index c950203e62..3df71f5a75 100644
--- a/drape/glfunctions.hpp
+++ b/drape/glfunctions.hpp
@@ -150,7 +150,7 @@ public:
static uint32_t glCheckFramebufferStatus();
};
-void CheckGLError(my::SrcPoint const & src);
+void CheckGLError(base::SrcPoint const & src);
#ifdef DEBUG
#define GLCHECK(x) do { (x); CheckGLError(SRC()); } while (false)
diff --git a/drape/glyph_manager.cpp b/drape/glyph_manager.cpp
index 781bf31295..e1d88f6cfd 100644
--- a/drape/glyph_manager.cpp
+++ b/drape/glyph_manager.cpp
@@ -597,14 +597,14 @@ GlyphManager::Glyph GlyphManager::GenerateGlyph(Glyph const & glyph, uint32_t sd
ASSERT(img.GetWidth() == glyph.m_image.m_width, ());
ASSERT(img.GetHeight() == glyph.m_image.m_height, ());
- size_t bufferSize = my::NextPowOf2(glyph.m_image.m_width * glyph.m_image.m_height);
+ size_t bufferSize = base::NextPowOf2(glyph.m_image.m_width * glyph.m_image.m_height);
resultGlyph.m_image.m_data = SharedBufferManager::instance().reserveSharedBuffer(bufferSize);
img.GetData(*resultGlyph.m_image.m_data);
}
else
{
- size_t bufferSize = my::NextPowOf2(glyph.m_image.m_width * glyph.m_image.m_height);
+ size_t bufferSize = base::NextPowOf2(glyph.m_image.m_width * glyph.m_image.m_height);
resultGlyph.m_image.m_data = SharedBufferManager::instance().reserveSharedBuffer(bufferSize);
resultGlyph.m_image.m_data->assign(glyph.m_image.m_data->begin(), glyph.m_image.m_data->end());
}
diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp
index 511bb70b2b..4c70c1f9b0 100644
--- a/drape/overlay_handle.cpp
+++ b/drape/overlay_handle.cpp
@@ -273,7 +273,7 @@ uint64_t CalculateOverlayPriority(int minZoomLevel, uint8_t rank, float depth)
float const kMinDepth = -100000.0f;
float const kMaxDepth = 100000.0f;
- float const d = my::clamp(depth, kMinDepth, kMaxDepth) - kMinDepth;
+ float const d = base::clamp(depth, kMinDepth, kMaxDepth) - kMinDepth;
auto const priority = static_cast<uint32_t>(d);
return (static_cast<uint64_t>(minZoom) << 56) |
diff --git a/drape/stipple_pen_resource.cpp b/drape/stipple_pen_resource.cpp
index cb8f1d8e75..0e6d67f6da 100644
--- a/drape/stipple_pen_resource.cpp
+++ b/drape/stipple_pen_resource.cpp
@@ -177,7 +177,7 @@ void StipplePenIndex::UploadResources(ref_ptr<Texture> texture)
SharedBufferManager & mng = SharedBufferManager::instance();
uint32_t const bytesPerNode = kMaxStipplePenLength * kStippleHeight;
- uint32_t reserveBufferSize = my::NextPowOf2(static_cast<uint32_t>(pendingNodes.size()) * bytesPerNode);
+ uint32_t reserveBufferSize = base::NextPowOf2(static_cast<uint32_t>(pendingNodes.size()) * bytesPerNode);
SharedBufferManager::shared_buffer_ptr_t ptr = mng.reserveSharedBuffer(reserveBufferSize);
uint8_t * rawBuffer = SharedBufferManager::GetRawPointer(ptr);
memset(rawBuffer, 0, reserveBufferSize);
diff --git a/drape/texture_manager.cpp b/drape/texture_manager.cpp
index 16a5fb496b..71cf970617 100644
--- a/drape/texture_manager.cpp
+++ b/drape/texture_manager.cpp
@@ -120,7 +120,7 @@ void ParsePatternsList(string const & patternsFile, ToDo toDo)
}
m2::PointU StipplePenTextureSize(size_t patternsCount, uint32_t maxTextureSize)
{
- uint32_t const sz = my::NextPowOf2(static_cast<uint32_t>(patternsCount) + kReservedPatterns);
+ uint32_t const sz = base::NextPowOf2(static_cast<uint32_t>(patternsCount) + kReservedPatterns);
uint32_t const stippleTextureHeight =
std::min(maxTextureSize, std::max(sz, kMinStippleTextureHeight));
return m2::PointU(kStippleTextureWidth, stippleTextureHeight);
@@ -129,7 +129,7 @@ m2::PointU StipplePenTextureSize(size_t patternsCount, uint32_t maxTextureSize)
m2::PointU ColorTextureSize(size_t colorsCount, uint32_t maxTextureSize)
{
uint32_t const sz = static_cast<uint32_t>(floor(sqrt(colorsCount + kReservedColors)));
- uint32_t colorTextureSize = std::max(my::NextPowOf2(sz), kMinColorTextureSize);
+ uint32_t colorTextureSize = std::max(base::NextPowOf2(sz), kMinColorTextureSize);
colorTextureSize *= ColorTexture::GetColorSizeInPixels();
colorTextureSize = std::min(maxTextureSize, colorTextureSize);
return m2::PointU(colorTextureSize, colorTextureSize);
diff --git a/drape/texture_manager.hpp b/drape/texture_manager.hpp
index 836ef808ec..07b637bfe1 100644
--- a/drape/texture_manager.hpp
+++ b/drape/texture_manager.hpp
@@ -252,7 +252,7 @@ private:
buffer_vector<GlyphGroup, 64> m_glyphGroups;
buffer_vector<HybridGlyphGroup, 4> m_hybridGlyphGroups;
- my::Timer m_uploadTimer;
+ base::Timer m_uploadTimer;
std::atomic_flag m_nothingToUpload;
std::mutex m_calcGlyphsMutex;
};
diff --git a/drape/texture_of_colors.cpp b/drape/texture_of_colors.cpp
index 45cfb1c880..124afacc03 100644
--- a/drape/texture_of_colors.cpp
+++ b/drape/texture_of_colors.cpp
@@ -119,7 +119,7 @@ void ColorPalette::UploadResources(ref_ptr<Texture> texture)
size_t const pixelStride = uploadRect.SizeX();
size_t const byteCount = kBytesPerPixel * uploadRect.SizeX() * uploadRect.SizeY();
- size_t const bufferSize = static_cast<size_t>(my::NextPowOf2(static_cast<uint32_t>(byteCount)));
+ size_t const bufferSize = static_cast<size_t>(base::NextPowOf2(static_cast<uint32_t>(byteCount)));
SharedBufferManager::shared_buffer_ptr_t buffer = SharedBufferManager::instance().reserveSharedBuffer(bufferSize);
uint8_t * pointer = SharedBufferManager::GetRawPointer(buffer);
diff --git a/drape_frontend/animation/interpolators.cpp b/drape_frontend/animation/interpolators.cpp
index 7036a0eeef..369bf87225 100644
--- a/drape_frontend/animation/interpolators.cpp
+++ b/drape_frontend/animation/interpolators.cpp
@@ -12,7 +12,7 @@ double CalcAnimSpeedDuration(double pxDiff, double pxSpeed)
{
double constexpr kEps = 1e-5;
- if (my::AlmostEqualAbs(pxDiff, 0.0, kEps))
+ if (base::AlmostEqualAbs(pxDiff, 0.0, kEps))
return 0.0;
return fabs(pxDiff) / pxSpeed;
diff --git a/drape_frontend/color_constants.cpp b/drape_frontend/color_constants.cpp
index 1ce41f1c3c..0eea536971 100644
--- a/drape_frontend/color_constants.cpp
+++ b/drape_frontend/color_constants.cpp
@@ -51,7 +51,7 @@ public:
try
{
- my::Json root(data);
+ base::Json root(data);
if (root.get() == nullptr)
return;
@@ -77,7 +77,7 @@ public:
m_nightColors[df::GetTransitTextColorName(name)] = ParseColor(strValue);
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LWARNING, ("Reading transit colors failed:", e.Msg()));
}
diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp
index 448c2753e2..a2974dac95 100644
--- a/drape_frontend/drape_engine.cpp
+++ b/drape_frontend/drape_engine.cpp
@@ -49,7 +49,7 @@ DrapeEngine::DrapeEngine(Params && params)
double timeInBackground = 0.0;
double lastEnterBackground = 0.0;
if (settings::Get("LastEnterBackground", lastEnterBackground))
- timeInBackground = my::Timer::LocalTime() - lastEnterBackground;
+ timeInBackground = base::Timer::LocalTime() - lastEnterBackground;
std::vector<PostprocessRenderer::Effect> effects;
@@ -760,7 +760,7 @@ void DrapeEngine::SetFontScaleFactor(double scaleFactor)
double const kMinScaleFactor = 0.5;
double const kMaxScaleFactor = 2.0;
- scaleFactor = my::clamp(scaleFactor, kMinScaleFactor, kMaxScaleFactor);
+ scaleFactor = base::clamp(scaleFactor, kMinScaleFactor, kMaxScaleFactor);
VisualParams::Instance().SetFontScale(scaleFactor);
}
diff --git a/drape_frontend/drape_frontend_tests/navigator_test.cpp b/drape_frontend/drape_frontend_tests/navigator_test.cpp
index d129a8b50f..d182517117 100644
--- a/drape_frontend/drape_frontend_tests/navigator_test.cpp
+++ b/drape_frontend/drape_frontend_tests/navigator_test.cpp
@@ -61,8 +61,8 @@ namespace
P const & pxP = arr[i];
P const gP = nav.PtoG(pxP);
P const pxP2 = nav.GtoP(gP);
- TEST(my::AlmostEqualAbs(pxP.x, pxP2.x, 0.00001), (pxP.x, pxP2.x));
- TEST(my::AlmostEqualAbs(pxP.y, pxP2.y, 0.00001), (pxP.y, pxP2.y));
+ TEST(base::AlmostEqualAbs(pxP.x, pxP2.x, 0.00001), (pxP.x, pxP2.x));
+ TEST(base::AlmostEqualAbs(pxP.y, pxP2.y, 0.00001), (pxP.y, pxP2.y));
}
}
}
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index f8d481b089..412a4f0614 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -1941,7 +1941,7 @@ void FrontendRenderer::Routine::Do()
m_renderer.OnContextCreate();
- my::Timer timer;
+ base::Timer timer;
double frameTime = 0.0;
bool modelViewChanged = true;
bool viewportChanged = true;
diff --git a/drape_frontend/gps_track_renderer.cpp b/drape_frontend/gps_track_renderer.cpp
index 9d78c195fd..dd37e53480 100644
--- a/drape_frontend/gps_track_renderer.cpp
+++ b/drape_frontend/gps_track_renderer.cpp
@@ -159,7 +159,7 @@ dp::Color GpsTrackRenderer::CalculatePointColor(size_t pointIndex, m2::PointD co
endAlpha = kMaxNightAlpha;
}
- double const ta = my::clamp(lengthFromStart / fullLength, 0.0, 1.0);
+ double const ta = base::clamp(lengthFromStart / fullLength, 0.0, 1.0);
double const alpha = startAlpha * (1.0 - ta) + endAlpha * ta;
if ((end.m_timestamp - start.m_timestamp) > kUnknownDistanceTime)
@@ -171,7 +171,7 @@ dp::Color GpsTrackRenderer::CalculatePointColor(size_t pointIndex, m2::PointD co
double const length = (end.m_point - start.m_point).Length();
double const dist = (curPoint - start.m_point).Length();
- double const td = my::clamp(dist / length, 0.0, 1.0);
+ double const td = base::clamp(dist / length, 0.0, 1.0);
double const speed = max(start.m_speedMPS * (1.0 - td) + end.m_speedMPS * td, 0.0);
dp::Color const color = GetColorBySpeed(speed);
diff --git a/drape_frontend/gui/compass.cpp b/drape_frontend/gui/compass.cpp
index 92c9fdca7f..002592c7c2 100644
--- a/drape_frontend/gui/compass.cpp
+++ b/drape_frontend/gui/compass.cpp
@@ -33,8 +33,8 @@ struct CompassVertex
class CompassHandle : public TappableHandle
{
using TBase = TappableHandle;
- double const kVisibleStartAngle = my::DegToRad(5.0);
- double const kVisibleEndAngle = my::DegToRad(355.0);
+ double const kVisibleStartAngle = base::DegToRad(5.0);
+ double const kVisibleEndAngle = base::DegToRad(355.0);
public:
CompassHandle(uint32_t id, m2::PointF const & pivot, m2::PointF const & size,
diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp
index ba48c7e7c1..f0fcff1510 100644
--- a/drape_frontend/gui/ruler_helper.cpp
+++ b/drape_frontend/gui/ruler_helper.cpp
@@ -110,7 +110,7 @@ RulerHelper::RulerHelper()
void RulerHelper::Update(ScreenBase const & screen)
{
m2::PointD pivot = screen.PixelRect().Center();
- int const minPxWidth = my::rounds(kMinPixelWidth * df::VisualParams::Instance().GetVisualScale());
+ int const minPxWidth = base::rounds(kMinPixelWidth * df::VisualParams::Instance().GetVisualScale());
m2::PointD pt1 = screen.PtoG(pivot);
m2::PointD pt0 = screen.PtoG(pivot - m2::PointD(minPxWidth, 0));
@@ -130,7 +130,7 @@ void RulerHelper::Update(ScreenBase const & screen)
double const a = ang::AngleTo(pt1, pt0);
pt0 = MercatorBounds::GetSmPoint(pt1, cos(a) * metersDiff, sin(a) * metersDiff);
- m_pixelLength = my::rounds(pivot.Length(screen.GtoP(pt0)));
+ m_pixelLength = base::rounds(pivot.Length(screen.GtoP(pt0)));
}
int drawScale = df::GetDrawTileScale(screen);
diff --git a/drape_frontend/gui/scale_fps_helper.hpp b/drape_frontend/gui/scale_fps_helper.hpp
index a59acfa341..55ce30d03a 100644
--- a/drape_frontend/gui/scale_fps_helper.hpp
+++ b/drape_frontend/gui/scale_fps_helper.hpp
@@ -48,7 +48,7 @@ private:
int m_scale = 1;
bool m_isVisible = false;
- my::Timer m_fpsAggregationTimer;
+ base::Timer m_fpsAggregationTimer;
double m_aggregatedFrameTime = 0.0;
uint32_t m_framesCounter = 1;
bool m_isPaused = false;
diff --git a/drape_frontend/line_shape_helper.cpp b/drape_frontend/line_shape_helper.cpp
index 7013b81541..bbd9015ea2 100644
--- a/drape_frontend/line_shape_helper.cpp
+++ b/drape_frontend/line_shape_helper.cpp
@@ -266,7 +266,7 @@ float GetProjectionLength(glsl::vec2 const & newPoint, glsl::vec2 const & startP
glsl::vec2 const v2 = newPoint - startPoint;
float const squareLen = glsl::dot(v1, v1);
float const proj = glsl::dot(v1, v2) / squareLen;
- return sqrt(squareLen) * my::clamp(proj, 0.0f, 1.0f);
+ return sqrt(squareLen) * base::clamp(proj, 0.0f, 1.0f);
}
} // namespace df
diff --git a/drape_frontend/my_position_controller.cpp b/drape_frontend/my_position_controller.cpp
index 566ffac37a..27cac70d95 100644
--- a/drape_frontend/my_position_controller.cpp
+++ b/drape_frontend/my_position_controller.cpp
@@ -428,7 +428,7 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool
if ((isNavigable && hasBearing) ||
(!isNavigable && hasBearing && info.HasSpeed() && info.m_speedMpS > kMinSpeedThresholdMps))
{
- SetDirection(my::DegToRad(info.m_bearing));
+ SetDirection(base::DegToRad(info.m_bearing));
m_lastGPSBearing.Reset();
}
@@ -657,7 +657,7 @@ bool MyPositionController::AlmostCurrentPosition(m2::PointD const & pos) const
bool MyPositionController::AlmostCurrentAzimut(double azimut) const
{
double const kDirectionEqualityDelta = 1e-5;
- return my::AlmostEqualAbs(azimut, m_drawDirection, kDirectionEqualityDelta);
+ return base::AlmostEqualAbs(azimut, m_drawDirection, kDirectionEqualityDelta);
}
void MyPositionController::SetDirection(double bearing)
diff --git a/drape_frontend/my_position_controller.hpp b/drape_frontend/my_position_controller.hpp
index f7e211bbab..238a5b2d3c 100644
--- a/drape_frontend/my_position_controller.hpp
+++ b/drape_frontend/my_position_controller.hpp
@@ -184,12 +184,12 @@ private:
double m_autoScale2d;
double m_autoScale3d;
- my::Timer m_lastGPSBearing;
- my::Timer m_pendingTimer;
- my::Timer m_routingNotFollowTimer;
+ base::Timer m_lastGPSBearing;
+ base::Timer m_pendingTimer;
+ base::Timer m_routingNotFollowTimer;
bool m_blockRoutingNotFollowTimer = false;
- my::Timer m_blockAutoZoomTimer;
- my::Timer m_updateLocationTimer;
+ base::Timer m_blockAutoZoomTimer;
+ base::Timer m_updateLocationTimer;
double m_lastLocationTimestamp;
m2::RectD m_pixelRect;
diff --git a/drape_frontend/traffic_renderer.cpp b/drape_frontend/traffic_renderer.cpp
index b220aa32c6..51dc400a02 100644
--- a/drape_frontend/traffic_renderer.cpp
+++ b/drape_frontend/traffic_renderer.cpp
@@ -316,7 +316,7 @@ bool TrafficRenderer::CanBeRenderedAsLine(RoadClass const & roadClass, int zoomL
if (it == lineDrawer->end())
return false;
- width = max(1, my::rounds(TrafficRenderer::GetPixelWidthInternal(roadClass, zoomLevel)));
+ width = max(1, base::rounds(TrafficRenderer::GetPixelWidthInternal(roadClass, zoomLevel)));
return width <= dp::SupportManager::Instance().GetMaxLineWidth();
}
} // namespace df
diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp
index ff27e1ba0e..836c26cc73 100644
--- a/drape_frontend/user_event_stream.hpp
+++ b/drape_frontend/user_event_stream.hpp
@@ -59,7 +59,7 @@ class TouchEvent : public UserEvent
public:
TouchEvent()
: m_type(TOUCH_CANCEL)
- , m_timeStamp(my::Timer::LocalTime())
+ , m_timeStamp(base::Timer::LocalTime())
, m_pointersMask(0xFFFF)
{}
@@ -477,7 +477,7 @@ private:
bool m_needTrackCenter = false;
Navigator m_navigator;
- my::Timer m_touchTimer;
+ base::Timer m_touchTimer;
enum ERecognitionState
{
STATE_EMPTY,
@@ -507,7 +507,7 @@ private:
m2::PointD m_startDoubleTapAndHold;
KineticScroller m_scroller;
- my::Timer m_kineticTimer;
+ base::Timer m_kineticTimer;
bool m_kineticScrollEnabled = true;
};
} // namespace df
diff --git a/drape_frontend/visual_params.cpp b/drape_frontend/visual_params.cpp
index b954d46707..db74bf8bd4 100644
--- a/drape_frontend/visual_params.cpp
+++ b/drape_frontend/visual_params.cpp
@@ -195,7 +195,7 @@ int GetTileScaleBase(ScreenBase const & s)
int GetTileScaleBase(m2::RectD const & r)
{
double const sz = std::max(r.SizeX(), r.SizeY());
- return std::max(1, my::rounds(log((MercatorBounds::maxX - MercatorBounds::minX) / sz) / log(2.0)));
+ return std::max(1, base::rounds(log((MercatorBounds::maxX - MercatorBounds::minX) / sz) / log(2.0)));
}
double GetTileScaleBase(double drawScale)
@@ -235,12 +235,12 @@ m2::RectD GetRectForDrawScale(int drawScale, m2::PointD const & center)
m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center, uint32_t tileSize, double visualScale)
{
- return GetRectForDrawScale(my::rounds(drawScale), center, tileSize, visualScale);
+ return GetRectForDrawScale(base::rounds(drawScale), center, tileSize, visualScale);
}
m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center)
{
- return GetRectForDrawScale(my::rounds(drawScale), center);
+ return GetRectForDrawScale(base::rounds(drawScale), center);
}
uint32_t CalculateTileSize(uint32_t screenWidth, uint32_t screenHeight)
@@ -268,9 +268,9 @@ uint32_t CalculateTileSize(uint32_t screenWidth, uint32_t screenHeight)
}
#ifndef OMIM_OS_DESKTOP
- return static_cast<uint32_t>(my::clamp(res / 2, 256, 1024));
+ return static_cast<uint32_t>(base::clamp(res / 2, 256, 1024));
#else
- return static_cast<uint32_t>(my::clamp(res / 2, 512, 1024));
+ return static_cast<uint32_t>(base::clamp(res / 2, 512, 1024));
#endif
}
@@ -341,7 +341,7 @@ m2::PointF InterpolateByZoomLevels(int index, float lerpCoef, std::vector<m2::Po
double GetNormalizedZoomLevel(double screenScale, int minZoom)
{
double const kMaxZoom = scales::GetUpperStyleScale() + 1.0;
- return my::clamp((GetZoomLevel(screenScale) - minZoom) / (kMaxZoom - minZoom), 0.0, 1.0);
+ return base::clamp((GetZoomLevel(screenScale) - minZoom) / (kMaxZoom - minZoom), 0.0, 1.0);
}
double GetScreenScale(double zoomLevel)
@@ -360,6 +360,6 @@ double GetZoomLevel(double screenScale)
auto const len = pxLen * screenScale;
auto const factor = (MercatorBounds::maxX - MercatorBounds::minX) / len;
static double const kLog2 = log(2.0);
- return my::clamp(GetDrawTileScale(fabs(log(factor) / kLog2)), 1.0, scales::GetUpperStyleScale() + 1.0);
+ return base::clamp(GetDrawTileScale(fabs(log(factor) / kLog2)), 1.0, scales::GetUpperStyleScale() + 1.0);
}
} // namespace df
diff --git a/editor/config_loader.cpp b/editor/config_loader.cpp
index 71e765dbfb..f04e7924ee 100644
--- a/editor/config_loader.cpp
+++ b/editor/config_loader.cpp
@@ -108,7 +108,7 @@ bool ConfigLoader::SaveAndReload(pugi::xml_document const & doc)
auto const filePath = GetConfigFilePath();
auto const result =
- my::WriteToTempAndRenameToFile(filePath, [&doc](string const & fileName)
+ base::WriteToTempAndRenameToFile(filePath, [&doc](string const & fileName)
{
return doc.save_file(fileName.c_str(), " ");
});
@@ -174,7 +174,7 @@ void ConfigLoader::GetRemoteConfig(pugi::xml_document & doc)
bool ConfigLoader::SaveHash(string const & hash, string const & filePath)
{
auto const result =
- my::WriteToTempAndRenameToFile(filePath, [&hash](string const & fileName)
+ base::WriteToTempAndRenameToFile(filePath, [&hash](string const & fileName)
{
ofstream ofs(fileName, ofstream::out);
if (!ofs.is_open())
diff --git a/editor/editor_notes.cpp b/editor/editor_notes.cpp
index f4723a668c..5056a82bb7 100644
--- a/editor/editor_notes.cpp
+++ b/editor/editor_notes.cpp
@@ -117,7 +117,7 @@ bool Save(std::string const & fileName, std::list<editor::Note> const & notes,
{
pugi::xml_document xml;
SaveToXml(notes, xml, uploadedNotesCount);
- return my::WriteToTempAndRenameToFile(fileName, [&xml](std::string const & fileName) {
+ return base::WriteToTempAndRenameToFile(fileName, [&xml](std::string const & fileName) {
return xml.save_file(fileName.data(), " ");
});
}
diff --git a/editor/editor_storage.cpp b/editor/editor_storage.cpp
index d1ccf6b0ad..e6d3b601b2 100644
--- a/editor/editor_storage.cpp
+++ b/editor/editor_storage.cpp
@@ -26,7 +26,7 @@ bool LocalStorage::Save(xml_document const & doc)
std::lock_guard<std::mutex> guard(m_mutex);
- return my::WriteToTempAndRenameToFile(editorFilePath, [&doc](string const & fileName) {
+ return base::WriteToTempAndRenameToFile(editorFilePath, [&doc](string const & fileName) {
return doc.save_file(fileName.data(), " " /* indent */);
});
}
@@ -52,7 +52,7 @@ bool LocalStorage::Reset()
{
std::lock_guard<std::mutex> guard(m_mutex);
- return my::DeleteFileX(GetEditorFilePath());
+ return base::DeleteFileX(GetEditorFilePath());
}
// StorageMemory -----------------------------------------------------------------------------------
diff --git a/editor/editor_tests/editor_notes_test.cpp b/editor/editor_tests/editor_notes_test.cpp
index d4b7ecd8fb..8d1b868333 100644
--- a/editor/editor_tests/editor_notes_test.cpp
+++ b/editor/editor_tests/editor_notes_test.cpp
@@ -16,7 +16,7 @@ using platform::tests_support::ScopedFile;
UNIT_TEST(Notes_Smoke)
{
auto const fileName = "notes.xml";
- auto const fullFileName = my::JoinFoldersToPath({GetPlatform().WritableDir()}, fileName);
+ auto const fullFileName = base::JoinFoldersToPath({GetPlatform().WritableDir()}, fileName);
ScopedFile sf(fileName, ScopedFile::Mode::DoNotCreate);
{
auto const notes = Notes::MakeNotes(fullFileName, true);
diff --git a/editor/editor_tests/osm_editor_test.cpp b/editor/editor_tests/osm_editor_test.cpp
index 6a159120e7..c829883b54 100644
--- a/editor/editor_tests/osm_editor_test.cpp
+++ b/editor/editor_tests/osm_editor_test.cpp
@@ -743,7 +743,7 @@ void EditorTest::GetStatsTest()
TEST(stats.m_edits.empty(), ());
TEST_EQUAL(stats.m_uploadedCount, 0, ());
- TEST_EQUAL(stats.m_lastUploadTimestamp, my::INVALID_TIME_STAMP, ());
+ TEST_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ());
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [](FeatureType & ft)
{
@@ -769,7 +769,7 @@ void EditorTest::GetStatsTest()
stats = editor.GetStats();
TEST_EQUAL(stats.m_edits.size(), 3, ());
TEST_EQUAL(stats.m_uploadedCount, 0, ());
- TEST_EQUAL(stats.m_lastUploadTimestamp, my::INVALID_TIME_STAMP, ());
+ TEST_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ());
osm::EditableMapObject emo;
CreateCafeAtPoint({6.0, 6.0}, mwmId, emo);
@@ -781,7 +781,7 @@ void EditorTest::GetStatsTest()
stats = editor.GetStats();
TEST_EQUAL(stats.m_edits.size(), 1, ());
TEST_EQUAL(stats.m_uploadedCount, 1, ());
- TEST_NOT_EQUAL(stats.m_lastUploadTimestamp, my::INVALID_TIME_STAMP, ());
+ TEST_NOT_EQUAL(stats.m_lastUploadTimestamp, base::INVALID_TIME_STAMP, ());
}
void EditorTest::IsCreatedFeatureTest()
diff --git a/editor/editor_tests/xml_feature_test.cpp b/editor/editor_tests/xml_feature_test.cpp
index 59a6be07e1..fed6d4b45b 100644
--- a/editor/editor_tests/xml_feature_test.cpp
+++ b/editor/editor_tests/xml_feature_test.cpp
@@ -51,7 +51,7 @@ UNIT_TEST(XMLFeature_Setters)
XMLFeature feature(XMLFeature::Type::Node);
feature.SetCenter(MercatorBounds::FromLatLon(55.7978998, 37.4745280));
- feature.SetModificationTime(my::StringToTimestamp("2015-11-27T21:13:32Z"));
+ feature.SetModificationTime(base::StringToTimestamp("2015-11-27T21:13:32Z"));
feature.SetName("Gorki Park");
feature.SetName("en", "Gorki Park");
@@ -85,7 +85,7 @@ UNIT_TEST(XMLFeature_UintLang)
XMLFeature feature(XMLFeature::Type::Node);
feature.SetCenter(MercatorBounds::FromLatLon(55.79, 37.47));
- feature.SetModificationTime(my::StringToTimestamp("2015-11-27T21:13:32Z"));
+ feature.SetModificationTime(base::StringToTimestamp("2015-11-27T21:13:32Z"));
feature.SetName(StringUtf8Multilang::kDefaultCode, "Gorki Park");
feature.SetName(StringUtf8Multilang::GetLangIndex("ru"), "Парк Горького");
@@ -194,7 +194,7 @@ UNIT_TEST(XMLFeature_FromXml)
TEST_EQUAL(feature.GetTagValue("opening_hours"), "Mo-Fr 08:15-17:30", ());
TEST_EQUAL(feature.GetTagValue("amenity"), "atm", ());
- TEST_EQUAL(my::TimestampToString(feature.GetModificationTime()), "2015-11-27T21:13:32Z", ());
+ TEST_EQUAL(base::TimestampToString(feature.GetModificationTime()), "2015-11-27T21:13:32Z", ());
}
UNIT_TEST(XMLFeature_ForEachName)
diff --git a/editor/feature_matcher.cpp b/editor/feature_matcher.cpp
index 8717198a03..9eaa16dee4 100644
--- a/editor/feature_matcher.cpp
+++ b/editor/feature_matcher.cpp
@@ -97,7 +97,7 @@ double MatchByGeometry(LGeometry const & lhs, RGeometry const & rhs)
auto const unionArea = lhsArea + rhsArea - intersectionArea;
// Avoid infinity.
- if (my::AlmostEqualAbs(unionArea, 0.0, 1e-18))
+ if (base::AlmostEqualAbs(unionArea, 0.0, 1e-18))
return kPenaltyScore;
auto const score = intersectionArea / unionArea;
diff --git a/editor/osm_editor.cpp b/editor/osm_editor.cpp
index b5d4045d9f..47432e52ea 100644
--- a/editor/osm_editor.cpp
+++ b/editor/osm_editor.cpp
@@ -166,8 +166,8 @@ bool IsObsolete(editor::XMLFeature const & xml, FeatureID const & fid)
{
// TODO(mgsergio): If xml and feature are identical return true
auto const uploadTime = xml.GetUploadTime();
- return uploadTime != my::INVALID_TIME_STAMP &&
- my::TimeTToSecondsSinceEpoch(uploadTime) < GetMwmCreationTimeByMwmId(fid.m_mwmId);
+ return uploadTime != base::INVALID_TIME_STAMP &&
+ base::TimeTToSecondsSinceEpoch(uploadTime) < GetMwmCreationTimeByMwmId(fid.m_mwmId);
}
} // namespace
@@ -267,7 +267,7 @@ bool Editor::Save(FeaturesContainer const & features) const
xf.SetTagValue(kAddrStreetTag, fti.m_street);
ASSERT_NOT_EQUAL(0, fti.m_modificationTimestamp, ());
xf.SetModificationTime(fti.m_modificationTimestamp);
- if (fti.m_uploadAttemptTimestamp != my::INVALID_TIME_STAMP)
+ if (fti.m_uploadAttemptTimestamp != base::INVALID_TIME_STAMP)
{
xf.SetUploadTime(fti.m_uploadAttemptTimestamp);
ASSERT(!fti.m_uploadStatus.empty(), ("Upload status updates with upload timestamp."));
@@ -923,7 +923,7 @@ bool Editor::FillFeatureInfo(FeatureStatus status, XMLFeature const & xml, Featu
fti.m_street = xml.GetTagValue(kAddrStreetTag);
fti.m_modificationTimestamp = xml.GetModificationTime();
- ASSERT_NOT_EQUAL(my::INVALID_TIME_STAMP, fti.m_modificationTimestamp, ());
+ ASSERT_NOT_EQUAL(base::INVALID_TIME_STAMP, fti.m_modificationTimestamp, ());
fti.m_uploadAttemptTimestamp = xml.GetUploadTime();
fti.m_uploadStatus = xml.GetUploadStatus();
fti.m_uploadError = xml.GetUploadError();
@@ -1024,9 +1024,9 @@ Editor::Stats Editor::GetStats() const
auto feature = fti.m_feature;
stats.m_edits.push_back(make_pair(FeatureID(id.first, index.first),
fti.m_uploadStatus + " " + fti.m_uploadError));
- LOG(LDEBUG, (fti.m_uploadAttemptTimestamp == my::INVALID_TIME_STAMP
+ LOG(LDEBUG, (fti.m_uploadAttemptTimestamp == base::INVALID_TIME_STAMP
? "NOT_UPLOADED_YET"
- : my::TimestampToString(fti.m_uploadAttemptTimestamp),
+ : base::TimestampToString(fti.m_uploadAttemptTimestamp),
fti.m_uploadStatus, fti.m_uploadError, feature.GetFeatureType(),
feature::GetCenter(feature)));
if (fti.m_uploadStatus == kUploaded)
@@ -1093,7 +1093,7 @@ void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid,
CHECK_THREAD_CHECKER(MainThreadChecker, (""));
auto const version = GetMwmCreationTimeByMwmId(fid.m_mwmId);
- auto const stringVersion = my::TimestampToString(my::SecondsSinceEpochToTimeT(version));
+ auto const stringVersion = base::TimestampToString(base::SecondsSinceEpochToTimeT(version));
ostringstream sstr;
auto canCreate = true;
diff --git a/editor/osm_editor.hpp b/editor/osm_editor.hpp
index af3eece05a..caea5c0664 100644
--- a/editor/osm_editor.hpp
+++ b/editor/osm_editor.hpp
@@ -90,7 +90,7 @@ public:
/// <id, feature status string>
vector<pair<FeatureID, string>> m_edits;
size_t m_uploadedCount = 0;
- time_t m_lastUploadTimestamp = my::INVALID_TIME_STAMP;
+ time_t m_lastUploadTimestamp = base::INVALID_TIME_STAMP;
};
// Predefined messages.
@@ -185,7 +185,7 @@ private:
// TODO(a): Use this structure as part of FeatureTypeInfo.
struct UploadInfo
{
- time_t m_uploadAttemptTimestamp = my::INVALID_TIME_STAMP;
+ time_t m_uploadAttemptTimestamp = base::INVALID_TIME_STAMP;
/// Is empty if upload has never occured or one of k* constants above otherwise.
string m_uploadStatus;
string m_uploadError;
@@ -198,8 +198,8 @@ private:
FeatureType m_feature;
/// If not empty contains Feature's addr:street, edited by user.
string m_street;
- time_t m_modificationTimestamp = my::INVALID_TIME_STAMP;
- time_t m_uploadAttemptTimestamp = my::INVALID_TIME_STAMP;
+ time_t m_modificationTimestamp = base::INVALID_TIME_STAMP;
+ time_t m_uploadAttemptTimestamp = base::INVALID_TIME_STAMP;
/// Is empty if upload has never occured or one of k* constants above otherwise.
string m_uploadStatus;
string m_uploadError;
diff --git a/editor/server_api.cpp b/editor/server_api.cpp
index f20ce26394..47784c68fe 100644
--- a/editor/server_api.cpp
+++ b/editor/server_api.cpp
@@ -164,7 +164,7 @@ UserPreferences ServerApi06::GetUserPreferences() const
UserPreferences pref;
pref.m_id = user.attribute("id").as_ullong();
pref.m_displayName = user.attribute("display_name").as_string();
- pref.m_accountCreated = my::StringToTimestamp(user.attribute("account_created").as_string());
+ pref.m_accountCreated = base::StringToTimestamp(user.attribute("account_created").as_string());
pref.m_imageUrl = user.child("img").attribute("href").as_string();
pref.m_changesets = user.child("changesets").attribute("count").as_uint();
return pref;
@@ -187,7 +187,7 @@ OsmOAuth::Response ServerApi06::GetXmlFeaturesAtLatLon(double lat, double lon, d
double const latDegreeOffset = radiusInMeters * MercatorBounds::degreeInMetres;
double const minLat = max(-90.0, lat - latDegreeOffset);
double const maxLat = min( 90.0, lat + latDegreeOffset);
- double const cosL = max(cos(my::DegToRad(max(fabs(minLat), fabs(maxLat)))), 0.00001);
+ double const cosL = max(cos(base::DegToRad(max(fabs(minLat), fabs(maxLat)))), 0.00001);
double const lonDegreeOffset = radiusInMeters * MercatorBounds::degreeInMetres / cosL;
double const minLon = max(-180.0, lon - lonDegreeOffset);
double const maxLon = min( 180.0, lon + lonDegreeOffset);
diff --git a/editor/user_stats.cpp b/editor/user_stats.cpp
index b645fe78b5..f26b19a220 100644
--- a/editor/user_stats.cpp
+++ b/editor/user_stats.cpp
@@ -31,7 +31,7 @@ namespace editor
UserStats::UserStats()
: m_changesCount(kUninitialized), m_rank(kUninitialized)
- , m_updateTime(my::SecondsSinceEpochToTimeT(0)), m_valid(false)
+ , m_updateTime(base::SecondsSinceEpochToTimeT(0)), m_valid(false)
{
}
@@ -70,7 +70,7 @@ bool UserStats::GetLevelUpRequiredFeat(string & levelUpFeat) const
// UserStatsLoader ---------------------------------------------------------------------------------
UserStatsLoader::UserStatsLoader()
- : m_lastUpdate(my::SecondsSinceEpochToTimeT(0))
+ : m_lastUpdate(base::SecondsSinceEpochToTimeT(0))
{
if (!LoadFromSettings())
LOG(LINFO, ("There is no cached user stats info in settings"));
@@ -194,7 +194,7 @@ bool UserStatsLoader::LoadFromSettings()
return false;
}
- m_lastUpdate = my::SecondsSinceEpochToTimeT(lastUpdate);
+ m_lastUpdate = base::SecondsSinceEpochToTimeT(lastUpdate);
m_userStats = UserStats(m_lastUpdate, rating, changesCount, "");
return true;
}
@@ -211,7 +211,7 @@ void UserStatsLoader::SaveToSettings()
int32_t changesCount;
if (m_userStats.GetChangesCount(changesCount))
settings::Set(kSettingsChangesCount, changesCount);
- settings::Set(kSettingsLastUpdate, my::TimeTToSecondsSinceEpoch(m_lastUpdate));
+ settings::Set(kSettingsLastUpdate, base::TimeTToSecondsSinceEpoch(m_lastUpdate));
// Do not save m_requiredLevelUpFeat for it becomes obsolete very fast.
}
diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp
index 37794b5ff1..849505ae3d 100644
--- a/editor/xml_feature.cpp
+++ b/editor/xml_feature.cpp
@@ -260,12 +260,12 @@ void XMLFeature::SetHouse(string const & house) { SetTagValue(kHouseNumber, hous
time_t XMLFeature::GetModificationTime() const
{
- return my::StringToTimestamp(GetRootNode().attribute(kTimestamp).value());
+ return base::StringToTimestamp(GetRootNode().attribute(kTimestamp).value());
}
void XMLFeature::SetModificationTime(time_t const time)
{
- SetAttribute(kTimestamp, my::TimestampToString(time));
+ SetAttribute(kTimestamp, base::TimestampToString(time));
}
uint32_t XMLFeature::GetMWMFeatureIndex() const
@@ -281,12 +281,12 @@ void XMLFeature::SetMWMFeatureIndex(uint32_t index)
time_t XMLFeature::GetUploadTime() const
{
- return my::StringToTimestamp(GetRootNode().attribute(kUploadTimestamp).value());
+ return base::StringToTimestamp(GetRootNode().attribute(kUploadTimestamp).value());
}
void XMLFeature::SetUploadTime(time_t const time)
{
- SetAttribute(kUploadTimestamp, my::TimestampToString(time));
+ SetAttribute(kUploadTimestamp, base::TimestampToString(time));
}
string XMLFeature::GetUploadStatus() const
diff --git a/editor/xml_feature.hpp b/editor/xml_feature.hpp
index ce5c648c0f..0f6c349089 100644
--- a/editor/xml_feature.hpp
+++ b/editor/xml_feature.hpp
@@ -132,7 +132,7 @@ public:
uint32_t GetMWMFeatureIndex() const;
void SetMWMFeatureIndex(uint32_t index);
- /// @returns my::INVALID_TIME_STAMP if there were no any upload attempt.
+ /// @returns base::INVALID_TIME_STAMP if there were no any upload attempt.
time_t GetUploadTime() const;
void SetUploadTime(time_t const time);
diff --git a/feature_list/feature_list.cpp b/feature_list/feature_list.cpp
index c9277060f0..2ba24ff35a 100644
--- a/feature_list/feature_list.cpp
+++ b/feature_list/feature_list.cpp
@@ -327,7 +327,7 @@ int main(int argc, char ** argv)
if (argc > 2)
{
pl.SetResourceDir(argv[2]);
- countriesFile = my::JoinPath(argv[2], COUNTRIES_FILE);
+ countriesFile = base::JoinPath(argv[2], COUNTRIES_FILE);
}
storage::Storage storage(countriesFile, argv[1]);
@@ -363,7 +363,7 @@ int main(int argc, char ** argv)
if (argc > 3 && !strings::StartsWith(mwmInfo->GetCountryName() + DATA_FILE_EXTENSION, argv[3]))
continue;
LOG(LINFO, ("Processing", mwmInfo->GetCountryName()));
- string osmToFeatureFile = my::JoinPath(
+ string osmToFeatureFile = base::JoinPath(
argv[1], mwmInfo->GetCountryName() + DATA_FILE_EXTENSION + OSM2FEATURE_FILE_EXTENSION);
map<uint32_t, base::GeoObjectId> featureIdToOsmId;
ParseFeatureIdToOsmIdMapping(osmToFeatureFile, featureIdToOsmId);
diff --git a/generator/booking_quality_check/booking_addr_match.cpp b/generator/booking_quality_check/booking_addr_match.cpp
index d02eb169c9..3a743b13f4 100644
--- a/generator/booking_quality_check/booking_addr_match.cpp
+++ b/generator/booking_quality_check/booking_addr_match.cpp
@@ -57,7 +57,7 @@ int main(int argc, char * argv[])
if (!FLAGS_user_resource_path.empty())
{
platform.SetResourceDir(FLAGS_user_resource_path);
- countriesFile = my::JoinFoldersToPath(FLAGS_user_resource_path, COUNTRIES_FILE);
+ countriesFile = base::JoinFoldersToPath(FLAGS_user_resource_path, COUNTRIES_FILE);
}
if (!FLAGS_data_path.empty())
diff --git a/generator/booking_quality_check/booking_quality_check.cpp b/generator/booking_quality_check/booking_quality_check.cpp
index 4acc3d52bb..454b329cb7 100644
--- a/generator/booking_quality_check/booking_quality_check.cpp
+++ b/generator/booking_quality_check/booking_quality_check.cpp
@@ -111,7 +111,7 @@ feature::GenerateInfo GetGenerateInfo()
info.SetNodeStorageType("map");
info.SetOsmFileType("o5m");
- info.m_intermediateDir = my::GetDirectory(FLAGS_factors);
+ info.m_intermediateDir = base::GetDirectory(FLAGS_factors);
// Set other info params here.
diff --git a/generator/borders_loader.cpp b/generator/borders_loader.cpp
index 945705cfad..effca15af8 100644
--- a/generator/borders_loader.cpp
+++ b/generator/borders_loader.cpp
@@ -83,7 +83,7 @@ void ForEachCountry(string const & baseDir, ToDo & toDo)
vector<m2::RegionD> borders;
if (osm::LoadBorders(bordersDir + file, borders))
{
- my::GetNameWithoutExt(file);
+ base::GetNameWithoutExt(file);
toDo(file, borders);
toDo.Finish();
}
@@ -169,13 +169,13 @@ void UnpackBorders(string const & baseDir, string const & targetDir)
MYTHROW(FileSystemException, ("Unable to find or create directory", targetDir));
vector<storage::CountryDef> countries;
- FilesContainerR reader(my::JoinFoldersToPath(baseDir, PACKED_POLYGONS_FILE));
+ FilesContainerR reader(base::JoinFoldersToPath(baseDir, PACKED_POLYGONS_FILE));
ReaderSource<ModelReaderPtr> src(reader.GetReader(PACKED_POLYGONS_INFO_TAG));
rw::Read(src, countries);
for (size_t id = 0; id < countries.size(); id++)
{
- ofstream poly(my::JoinFoldersToPath(targetDir, countries[id].m_countryId + ".poly"));
+ ofstream poly(base::JoinFoldersToPath(targetDir, countries[id].m_countryId + ".poly"));
poly << countries[id].m_countryId << endl;
src = reader.GetReader(strings::to_string(id));
uint32_t const count = ReadVarUint<uint32_t>(src);
@@ -198,7 +198,7 @@ void UnpackBorders(string const & baseDir, string const & targetDir)
bool GetBordersRect(string const & baseDir, string const & country, m2::RectD & bordersRect)
{
- string const bordersFile = my::JoinPath(baseDir, BORDERS_DIR, country + BORDERS_EXTENSION);
+ string const bordersFile = base::JoinPath(baseDir, BORDERS_DIR, country + BORDERS_EXTENSION);
if (!Platform::IsFileExistsByFullPath(bordersFile))
{
LOG(LWARNING, ("File with borders does not exist:", bordersFile));
diff --git a/generator/extract_addr/extract_addr.cpp b/generator/extract_addr/extract_addr.cpp
index 1fb43757c5..bc09021cc4 100644
--- a/generator/extract_addr/extract_addr.cpp
+++ b/generator/extract_addr/extract_addr.cpp
@@ -48,28 +48,28 @@ void PrintFeature(FeatureBuilder1 const & fb, uint64_t)
return;
auto const center = MercatorBounds::ToLatLon(fb.GetKeyPoint());
- auto coordinates = my::NewJSONArray();
+ auto coordinates = base::NewJSONArray();
ToJSONArray(*coordinates, std::round(center.lon * kRoundDigits) / kRoundDigits);
ToJSONArray(*coordinates, std::round(center.lat * kRoundDigits) / kRoundDigits);
- auto geometry = my::NewJSONObject();
+ auto geometry = base::NewJSONObject();
ToJSONObject(*geometry, "type", "Point");
ToJSONObject(*geometry, "coordinates", coordinates);
- auto properties = my::NewJSONObject();
+ auto properties = base::NewJSONObject();
ToJSONObject(*properties, "id", fb.GetMostGenericOsmId().GetEncodedId());
if (!name.empty() && !category.empty() && category != "building-address")
{
ToJSONObject(*properties, "name", name);
ToJSONObject(*properties, "tags", category);
}
- auto address = my::NewJSONObject();
+ auto address = base::NewJSONObject();
if (!street.empty())
ToJSONObject(*address, "street", street);
if (!house.empty())
ToJSONObject(*address, "building", house);
ToJSONObject(*properties, "address", address);
- auto feature = my::NewJSONObject();
+ auto feature = base::NewJSONObject();
ToJSONObject(*feature, "type", "Feature");
ToJSONObject(*feature, "geometry", geometry);
ToJSONObject(*feature, "properties", properties);
diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp
index 0da0a33fdb..39c655ae56 100644
--- a/generator/feature_builder.cpp
+++ b/generator/feature_builder.cpp
@@ -191,7 +191,7 @@ namespace
{
bool is_equal(double d1, double d2)
{
- //return my::AlmostEqualULPs(d1, d2, 100000000);
+ //return base::AlmostEqualULPs(d1, d2, 100000000);
return (fabs(d1 - d2) < MercatorBounds::GetCellID2PointAbsEpsilon());
}
diff --git a/generator/feature_helpers.hpp b/generator/feature_helpers.hpp
index a5928f49d5..0e4cc7a9bb 100644
--- a/generator/feature_helpers.hpp
+++ b/generator/feature_helpers.hpp
@@ -66,10 +66,10 @@ public:
// p is close to the borders of |m_rect|, in which case returns a very large number.
double operator()(m2::PointD const & a, m2::PointD const & b, m2::PointD const & p) const
{
- if (my::AlmostEqualAbs(p.x, m_rect.minX(), m_eps) ||
- my::AlmostEqualAbs(p.x, m_rect.maxX(), m_eps) ||
- my::AlmostEqualAbs(p.y, m_rect.minY(), m_eps) ||
- my::AlmostEqualAbs(p.y, m_rect.maxY(), m_eps))
+ if (base::AlmostEqualAbs(p.x, m_rect.minX(), m_eps) ||
+ base::AlmostEqualAbs(p.x, m_rect.maxX(), m_eps) ||
+ base::AlmostEqualAbs(p.y, m_rect.minY(), m_eps) ||
+ base::AlmostEqualAbs(p.y, m_rect.maxY(), m_eps))
{
// Points near rect should be in a result simplified vector.
return std::numeric_limits<double>::max();
diff --git a/generator/feature_segments_checker/feature_segments_checker.cpp b/generator/feature_segments_checker/feature_segments_checker.cpp
index d9e4620163..a17c8724df 100644
--- a/generator/feature_segments_checker/feature_segments_checker.cpp
+++ b/generator/feature_segments_checker/feature_segments_checker.cpp
@@ -103,7 +103,7 @@ bool LinearLeastSquaresFactors(vector<double> const & xs, vector<double> const &
mx2 += xs[i] * xs[i] / n;
}
- if (my::AlmostEqualAbs(mx * mx, mx2, kEpsilon))
+ if (base::AlmostEqualAbs(mx * mx, mx2, kEpsilon))
return false;
k = (my * mx - mxy) / (mx * mx - mx2);
diff --git a/generator/generate_info.hpp b/generator/generate_info.hpp
index ae524eb49c..57308bfaca 100644
--- a/generator/generate_info.hpp
+++ b/generator/generate_info.hpp
@@ -91,19 +91,19 @@ struct GenerateInfo
std::string GetTmpFileName(std::string const & fileName,
std::string const & ext = DATA_FILE_EXTENSION_TMP) const
{
- return my::JoinFoldersToPath(m_tmpDir, fileName + ext);
+ return base::JoinFoldersToPath(m_tmpDir, fileName + ext);
}
std::string GetTargetFileName(std::string const & fileName,
std::string const & ext = DATA_FILE_EXTENSION) const
{
- return my::JoinFoldersToPath(m_targetDir, fileName + ext);
+ return base::JoinFoldersToPath(m_targetDir, fileName + ext);
}
std::string GetIntermediateFileName(std::string const & fileName,
std::string const & ext = "") const
{
- return my::JoinFoldersToPath(m_intermediateDir, fileName + ext);
+ return base::JoinFoldersToPath(m_intermediateDir, fileName + ext);
}
std::string GetAddressesFileName() const
diff --git a/generator/generator_tests/altitude_test.cpp b/generator/generator_tests/altitude_test.cpp
index 72fabcd4de..8d97dd968b 100644
--- a/generator/generator_tests/altitude_test.cpp
+++ b/generator/generator_tests/altitude_test.cpp
@@ -166,12 +166,12 @@ void TestAltitudesBuilding(vector<TPoint3DList> const & roads, bool hasAltitudeE
{
classificator::Load();
Platform & platform = GetPlatform();
- std::string const testDirFullPath = my::JoinPath(platform.WritableDir(), kTestDir);
+ std::string const testDirFullPath = base::JoinPath(platform.WritableDir(), kTestDir);
// Building mwm without altitude section.
LocalCountryFile country(testDirFullPath, CountryFile(kTestMwm), 1);
ScopedDir testScopedDir(kTestDir);
- ScopedFile testScopedMwm(my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION),
+ ScopedFile testScopedMwm(base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION),
ScopedFile::Mode::Create);
BuildMwmWithoutAltitudes(roads, country);
diff --git a/generator/generator_tests/city_roads_tests.cpp b/generator/generator_tests/city_roads_tests.cpp
index 47d473e417..1c5914bc96 100644
--- a/generator/generator_tests/city_roads_tests.cpp
+++ b/generator/generator_tests/city_roads_tests.cpp
@@ -68,16 +68,16 @@ void TestCityRoadsBuilding(vector<uint64_t> && cityRoadFeatureIds)
string const writableDir = GetPlatform().WritableDir();
// Building empty mwm.
- LocalCountryFile country(my::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
+ LocalCountryFile country(base::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
0 /* version */);
ScopedDir const scopedDir(kTestDir);
- string const mwmRelativePath = my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
+ string const mwmRelativePath = base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
ScopedFile const scopedMwm(mwmRelativePath, ScopedFile::Mode::Create);
BuildEmptyMwm(country);
// Adding city_roads section to mwm.
- string const mwmFullPath = my::JoinPath(writableDir, mwmRelativePath);
+ string const mwmFullPath = base::JoinPath(writableDir, mwmRelativePath);
vector<uint64_t> originalCityRoadFeatureIds = cityRoadFeatureIds;
SerializeCityRoads(mwmFullPath, move(cityRoadFeatureIds));
diff --git a/generator/generator_tests/intermediate_data_test.cpp b/generator/generator_tests/intermediate_data_test.cpp
index 9dc65739d5..b294efe66f 100644
--- a/generator/generator_tests/intermediate_data_test.cpp
+++ b/generator/generator_tests/intermediate_data_test.cpp
@@ -58,14 +58,14 @@ void TestIntermediateData_SpeedCameraNodesToWays(
ScopedDir const scopedDir(kTestDir);
- string const osmRelativePath = my::JoinPath(kTestDir, kOsmFileName);
+ string const osmRelativePath = base::JoinPath(kTestDir, kOsmFileName);
ScopedFile const osmScopedFile(osmRelativePath, osmSourceXML);
// Generate intermediate data.
GenerateInfo genInfo;
genInfo.m_intermediateDir = writableDir;
genInfo.m_nodeStorageType = feature::GenerateInfo::NodeStorageType::Index;
- genInfo.m_osmFileName = my::JoinPath(tmpDir, osmRelativePath);
+ genInfo.m_osmFileName = base::JoinPath(tmpDir, osmRelativePath);
genInfo.m_osmFileType = feature::GenerateInfo::OsmSourceType::XML;
// Test save intermediate data is OK.
diff --git a/generator/generator_tests/osm_o5m_source_test.cpp b/generator/generator_tests/osm_o5m_source_test.cpp
index d3254dac4d..86574e11bc 100644
--- a/generator/generator_tests/osm_o5m_source_test.cpp
+++ b/generator/generator_tests/osm_o5m_source_test.cpp
@@ -30,8 +30,8 @@ UNIT_TEST(OSM_O5M_Source_Node_read_test)
TEST_EQUAL(em.uid, 395071, ());
TEST_EQUAL(em.version, 8, ());
TEST_EQUAL(em.changeset, 12059128, ());
- TEST(my::AlmostEqualAbs(em.lon, 38.7666704, 1e-7), ());
- TEST(my::AlmostEqualAbs(em.lat, 55.0927062, 1e-7), ());
+ TEST(base::AlmostEqualAbs(em.lon, 38.7666704, 1e-7), ());
+ TEST(base::AlmostEqualAbs(em.lat, 55.0927062, 1e-7), ());
auto const tags = em.Tags();
auto tagIterator = tags.begin();
diff --git a/generator/generator_tests/region_info_collector_tests.cpp b/generator/generator_tests/region_info_collector_tests.cpp
index 069cb8c31b..7cd5e93884 100644
--- a/generator/generator_tests/region_info_collector_tests.cpp
+++ b/generator/generator_tests/region_info_collector_tests.cpp
@@ -140,7 +140,7 @@ UNIT_TEST(RegionInfoCollector_Save)
auto & platform = GetPlatform();
auto const tmpDir = platform.TmpDir();
platform.SetWritableDirForTests(tmpDir);
- auto const name = my::JoinPath(tmpDir, "RegionInfoCollector.bin");
+ auto const name = base::JoinPath(tmpDir, "RegionInfoCollector.bin");
regionInfoCollector.Save(name);
{
generator::RegionInfoCollector regionInfoCollector(name);
diff --git a/generator/generator_tests/restriction_collector_test.cpp b/generator/generator_tests/restriction_collector_test.cpp
index 2ec9bca738..f790faa488 100644
--- a/generator/generator_tests/restriction_collector_test.cpp
+++ b/generator/generator_tests/restriction_collector_test.cpp
@@ -76,7 +76,7 @@ UNIT_TEST(RestrictionTest_InvalidCase)
UNIT_TEST(RestrictionTest_ParseRestrictions)
{
std::string const kRestrictionName = "restrictions_in_osm_ids.csv";
- std::string const kRestrictionPath = my::JoinPath(kRestrictionTestDir, kRestrictionName);
+ std::string const kRestrictionPath = base::JoinPath(kRestrictionTestDir, kRestrictionName);
std::string const kRestrictionContent = R"(No, 1, 1,
Only, 0, 2,
Only, 2, 3,
@@ -91,7 +91,7 @@ UNIT_TEST(RestrictionTest_ParseRestrictions)
Platform const & platform = GetPlatform();
TEST(restrictionCollector.ParseRestrictions(
- my::JoinPath(platform.WritableDir(), kRestrictionPath)),
+ base::JoinPath(platform.WritableDir(), kRestrictionPath)),
());
TEST(!restrictionCollector.HasRestrictions(), ());
}
@@ -101,7 +101,7 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
ScopedDir scopedDir(kRestrictionTestDir);
std::string const kRestrictionName = "restrictions_in_osm_ids.csv";
- std::string const kRestrictionPath = my::JoinPath(kRestrictionTestDir, kRestrictionName);
+ std::string const kRestrictionPath = base::JoinPath(kRestrictionTestDir, kRestrictionName);
std::string const kRestrictionContent = R"(No, 10, 10,
Only, 10, 20,
Only, 30, 40,)";
@@ -109,7 +109,7 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
std::string const kOsmIdsToFeatureIdsName = "osm_ids_to_feature_ids" OSM2FEATURE_FILE_EXTENSION;
std::string const osmIdsToFeatureIdsPath =
- my::JoinPath(kRestrictionTestDir, kOsmIdsToFeatureIdsName);
+ base::JoinPath(kRestrictionTestDir, kOsmIdsToFeatureIdsName);
std::string const kOsmIdsToFeatureIdsContent = R"(10, 1,
20, 2,
30, 3,
@@ -119,7 +119,7 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
std::string const osmIdsToFeatureIdsFullPath = mappingScopedFile.GetFullPath();
ReEncodeOsmIdsToFeatureIdsMapping(kOsmIdsToFeatureIdsContent, osmIdsToFeatureIdsFullPath);
- RestrictionCollector restrictionCollector(my::JoinPath(platform.WritableDir(), kRestrictionPath),
+ RestrictionCollector restrictionCollector(base::JoinPath(platform.WritableDir(), kRestrictionPath),
osmIdsToFeatureIdsFullPath);
TEST(restrictionCollector.IsValid(), ());
diff --git a/generator/generator_tests/restriction_test.cpp b/generator/generator_tests/restriction_test.cpp
index 3f46b269dd..4a8efd0461 100644
--- a/generator/generator_tests/restriction_test.cpp
+++ b/generator/generator_tests/restriction_test.cpp
@@ -76,25 +76,25 @@ void TestRestrictionBuilding(string const & restrictionContent, string const & m
string const writableDir = platform.WritableDir();
// Building empty mwm.
- LocalCountryFile country(my::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
+ LocalCountryFile country(base::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
0 /* version */);
ScopedDir const scopedDir(kTestDir);
- string const mwmRelativePath = my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
+ string const mwmRelativePath = base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
ScopedFile const scopedMwm(mwmRelativePath, ScopedFile::Mode::Create);
BuildEmptyMwm(country);
// Creating a file with restrictions.
- string const restrictionRelativePath = my::JoinPath(kTestDir, kRestrictionFileName);
+ string const restrictionRelativePath = base::JoinPath(kTestDir, kRestrictionFileName);
ScopedFile const restrictionScopedFile(restrictionRelativePath, restrictionContent);
// Creating osm ids to feature ids mapping.
- string const mappingRelativePath = my::JoinPath(kTestDir, kOsmIdsToFeatureIdsName);
+ string const mappingRelativePath = base::JoinPath(kTestDir, kOsmIdsToFeatureIdsName);
ScopedFile const mappingFile(mappingRelativePath, ScopedFile::Mode::Create);
string const mappingFullPath = mappingFile.GetFullPath();
ReEncodeOsmIdsToFeatureIdsMapping(mappingContent, mappingFullPath);
// Adding restriction section to mwm.
- string const restrictionFullPath = my::JoinPath(writableDir, restrictionRelativePath);
+ string const restrictionFullPath = base::JoinPath(writableDir, restrictionRelativePath);
string const & mwmFullPath = scopedMwm.GetFullPath();
BuildRoadRestrictions(mwmFullPath, restrictionFullPath, mappingFullPath);
diff --git a/generator/generator_tests/road_access_test.cpp b/generator/generator_tests/road_access_test.cpp
index e50bf61e41..84f7fcf2f0 100644
--- a/generator/generator_tests/road_access_test.cpp
+++ b/generator/generator_tests/road_access_test.cpp
@@ -89,26 +89,26 @@ RoadAccessCollector::RoadAccessByVehicleType SaveAndLoadRoadAccess(string const
string const & writableDir = platform.WritableDir();
// Building empty mwm.
- LocalCountryFile country(my::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
+ LocalCountryFile country(base::JoinPath(writableDir, kTestDir), CountryFile(kTestMwm),
0 /* version */);
ScopedDir const scopedDir(kTestDir);
- string const mwmRelativePath = my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
+ string const mwmRelativePath = base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
ScopedFile const scopedMwm(mwmRelativePath, ScopedFile::Mode::Create);
BuildTestMwmWithRoads(country);
// Creating a file with road access.
- string const roadAccessRelativePath = my::JoinPath(kTestDir, kRoadAccessFilename);
+ string const roadAccessRelativePath = base::JoinPath(kTestDir, kRoadAccessFilename);
ScopedFile const roadAccessFile(roadAccessRelativePath, roadAccessContent);
// Creating osm ids to feature ids mapping.
- string const mappingRelativePath = my::JoinPath(kTestDir, kOsmIdsToFeatureIdsName);
+ string const mappingRelativePath = base::JoinPath(kTestDir, kOsmIdsToFeatureIdsName);
ScopedFile const mappingFile(mappingRelativePath, ScopedFile::Mode::Create);
string const mappingFullPath = mappingFile.GetFullPath();
ReEncodeOsmIdsToFeatureIdsMapping(mappingContent, mappingFullPath);
// Adding road access section to mwm.
- string const roadAccessFullPath = my::JoinPath(writableDir, roadAccessRelativePath);
- string const mwmFullPath = my::JoinPath(writableDir, mwmRelativePath);
+ string const roadAccessFullPath = base::JoinPath(writableDir, roadAccessRelativePath);
+ string const mwmFullPath = base::JoinPath(writableDir, mwmRelativePath);
BuildRoadAccessInfo(mwmFullPath, roadAccessFullPath, mappingFullPath);
// Reading from mwm section and testing road access.
diff --git a/generator/generator_tests/speed_cameras_test.cpp b/generator/generator_tests/speed_cameras_test.cpp
index 4b5dc6d4cf..1490758d13 100644
--- a/generator/generator_tests/speed_cameras_test.cpp
+++ b/generator/generator_tests/speed_cameras_test.cpp
@@ -119,7 +119,7 @@ bool CheckCameraMapsEquality(CameraMap const & lhs, CameraMap const & rhs)
// It can differ on jenknins and local computer.
if (!(vectorL[i].first.m_segmentId == vectorR[i].first.m_segmentId &&
vectorL[i].second.m_maxSpeedKmPH == vectorR[i].second.m_maxSpeedKmPH &&
- my::AlmostEqualAbs(vectorL[i].second.m_coef, vectorR[i].second.m_coef, kCoefEqualityEpsilonM)))
+ base::AlmostEqualAbs(vectorL[i].second.m_coef, vectorR[i].second.m_coef, kCoefEqualityEpsilonM)))
{
LOG(LINFO, ("These should be equals:",
"sId:", vectorL[i].first.m_segmentId, vectorR[i].first.m_segmentId,
@@ -142,10 +142,10 @@ void TestSpeedCameraSectionBuilding(string const & osmContent, CameraMap const &
platform.SetWritableDirForTests(tmpDir);
// Create test dir.
- string const testDirFullPath = my::JoinPath(tmpDir, kTestDir);
+ string const testDirFullPath = base::JoinPath(tmpDir, kTestDir);
FORCE_USE_VALUE(Platform::MkDir(testDirFullPath));
- string const osmRelativePath = my::JoinPath(kTestDir, kOsmFileName);
+ string const osmRelativePath = base::JoinPath(kTestDir, kOsmFileName);
ScopedFile const osmScopedFile(osmRelativePath, osmContent);
// Step 1. Generate intermediate data.
@@ -156,14 +156,14 @@ void TestSpeedCameraSectionBuilding(string const & osmContent, CameraMap const &
genInfo.m_targetDir = testDirFullPath;
genInfo.m_intermediateDir = testDirFullPath;
genInfo.m_nodeStorageType = feature::GenerateInfo::NodeStorageType::Index;
- genInfo.m_osmFileName = my::JoinPath(tmpDir, osmRelativePath);
+ genInfo.m_osmFileName = base::JoinPath(tmpDir, osmRelativePath);
genInfo.m_osmFileType = feature::GenerateInfo::OsmSourceType::XML;
TEST(GenerateIntermediateData(genInfo), ("Can not generate intermediate data for speed cam"));
// Building empty mwm.
- LocalCountryFile country(my::JoinPath(tmpDir, kTestDir), CountryFile(kTestMwm), 0 /* version */);
- string const mwmRelativePath = my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
+ LocalCountryFile country(base::JoinPath(tmpDir, kTestDir), CountryFile(kTestMwm), 0 /* version */);
+ string const mwmRelativePath = base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION);
ScopedFile const scopedMwm(mwmRelativePath, ScopedFile::Mode::Create);
// Step 2. Generate binary file about cameras.
@@ -189,13 +189,13 @@ void TestSpeedCameraSectionBuilding(string const & osmContent, CameraMap const &
if (!answer.empty())
{
// Check that intermediate file is non empty.
- TEST_NOT_EQUAL(my::FileData(camerasFilename, my::FileData::OP_READ).Size(), 0,
+ TEST_NOT_EQUAL(base::FileData(camerasFilename, base::FileData::OP_READ).Size(), 0,
("SpeedCam intermediate file is empty"));
}
else
{
// Check that intermediate file is empty.
- TEST_EQUAL(my::FileData(camerasFilename, my::FileData::OP_READ).Size(), 0,
+ TEST_EQUAL(base::FileData(camerasFilename, base::FileData::OP_READ).Size(), 0,
("SpeedCam intermediate file is non empty"));
}
diff --git a/generator/generator_tests/sponsored_storage_tests.cpp b/generator/generator_tests/sponsored_storage_tests.cpp
index 4dbe48c27d..f323fad6a0 100644
--- a/generator/generator_tests/sponsored_storage_tests.cpp
+++ b/generator/generator_tests/sponsored_storage_tests.cpp
@@ -23,7 +23,7 @@ UNIT_TEST(LoadExcludedIds)
generator::SponsoredObjectStorage<generator::BookingHotel> storage(
kDummyDistanseForTesting, kDummyCountOfObjectsForTesting);
- auto const & path = my::JoinPath(GetPlatform().WritableDir(), kExcludedIdsFileName);
+ auto const & path = base::JoinPath(GetPlatform().WritableDir(), kExcludedIdsFileName);
auto const excludedIds = storage.LoadExcludedIds(path);
generator::BookingHotel::ObjectId id;
TEST_EQUAL(excludedIds.size(), 3, ());
diff --git a/generator/generator_tests/ugc_test.cpp b/generator/generator_tests/ugc_test.cpp
index 0030813c2b..6726de9bf1 100644
--- a/generator/generator_tests/ugc_test.cpp
+++ b/generator/generator_tests/ugc_test.cpp
@@ -55,7 +55,7 @@ UNIT_TEST(UGC_TranslateRatingTest)
TEST_EQUAL(ugc.m_ratings.size(), 2, ());
TEST_EQUAL(ugc.m_ratings[0].m_key, "2", ());
- TEST(my::AlmostEqualAbs(ugc.m_ratings[0].m_value, 3.4f, 1e-6f), ());
+ TEST(base::AlmostEqualAbs(ugc.m_ratings[0].m_value, 3.4f, 1e-6f), ());
}
UNIT_TEST(UGC_TranslateEmptyUgcTest)
diff --git a/generator/generator_tests_support/test_mwm_builder.cpp b/generator/generator_tests_support/test_mwm_builder.cpp
index 5a0b524e7a..c35493999a 100644
--- a/generator/generator_tests_support/test_mwm_builder.cpp
+++ b/generator/generator_tests_support/test_mwm_builder.cpp
@@ -124,10 +124,10 @@ void TestMwmBuilder::Finish()
CHECK(GenerateFinalFeatures(info, m_file.GetCountryFile().GetName(), m_type),
("Can't sort features."));
- CHECK(my::DeleteFileX(tmpFilePath), ());
+ CHECK(base::DeleteFileX(tmpFilePath), ());
string const path = m_file.GetPath(MapOptions::Map);
- (void)my::DeleteFileX(path + OSM2FEATURE_FILE_EXTENSION);
+ (void)base::DeleteFileX(path + OSM2FEATURE_FILE_EXTENSION);
CHECK(feature::BuildOffsetsTable(path), ("Can't build feature offsets table."));
diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp
index c8546b37a0..4f153cd164 100644
--- a/generator/generator_tool/generator_tool.cpp
+++ b/generator/generator_tool/generator_tool.cpp
@@ -88,7 +88,7 @@ DEFINE_string(output, "", "File name for process (without 'mwm' ext).");
DEFINE_bool(preload_cache, false, "Preload all ways and relations cache.");
DEFINE_string(node_storage, "map",
"Type of storage for intermediate points representation. Available: raw, map, mem.");
-DEFINE_uint64(planet_version, my::SecondsSinceEpoch(),
+DEFINE_uint64(planet_version, base::SecondsSinceEpoch(),
"Version as seconds since epoch, by default - now.");
// Preprocessing and feature generator.
@@ -184,7 +184,7 @@ int main(int argc, char ** argv)
}
string const path =
- FLAGS_data_path.empty() ? pl.WritableDir() : my::AddSlashIfNeeded(FLAGS_data_path);
+ FLAGS_data_path.empty() ? pl.WritableDir() : base::AddSlashIfNeeded(FLAGS_data_path);
// So that stray GetWritablePathForFile calls do not crash the generator.
pl.SetWritableDirForTests(path);
@@ -194,13 +194,13 @@ int main(int argc, char ** argv)
genInfo.m_intermediateDir =
FLAGS_intermediate_data_path.empty() ?
- path : my::AddSlashIfNeeded(FLAGS_intermediate_data_path);
+ path : base::AddSlashIfNeeded(FLAGS_intermediate_data_path);
genInfo.m_targetDir = genInfo.m_tmpDir = path;
/// @todo Probably, it's better to add separate option for .mwm.tmp files.
if (!FLAGS_intermediate_data_path.empty())
{
- string const tmpPath = my::JoinPath(genInfo.m_intermediateDir, "tmp");
+ string const tmpPath = base::JoinPath(genInfo.m_intermediateDir, "tmp");
if (Platform::MkDir(tmpPath) != Platform::ERR_UNKNOWN)
genInfo.m_tmpDir = tmpPath;
}
@@ -313,8 +313,8 @@ int main(int argc, char ** argv)
return -1;
}
- auto const locDataFile = my::JoinPath(path, FLAGS_output + LOC_DATA_FILE_EXTENSION);
- auto const outFile = my::JoinPath(path, FLAGS_output + LOC_IDX_FILE_EXTENSION);
+ auto const locDataFile = base::JoinPath(path, FLAGS_output + LOC_DATA_FILE_EXTENSION);
+ auto const outFile = base::JoinPath(path, FLAGS_output + LOC_IDX_FILE_EXTENSION);
if (FLAGS_generate_geo_objects_index)
{
if (!feature::GenerateGeoObjectsData(genInfo.m_tmpDir, FLAGS_nodes_list_path, locDataFile))
@@ -360,7 +360,7 @@ int main(int argc, char ** argv)
for (size_t i = 0; i < count; ++i)
{
string const & country = genInfo.m_bucketNames[i];
- string const datFile = my::JoinPath(path, country + DATA_FILE_EXTENSION);
+ string const datFile = base::JoinPath(path, country + DATA_FILE_EXTENSION);
string const osmToFeatureFilename =
genInfo.GetTargetFileName(country) + OSM2FEATURE_FILE_EXTENSION;
@@ -529,7 +529,7 @@ int main(int argc, char ** argv)
}
}
- string const datFile = my::JoinPath(path, FLAGS_output + DATA_FILE_EXTENSION);
+ string const datFile = base::JoinPath(path, FLAGS_output + DATA_FILE_EXTENSION);
if (FLAGS_calc_statistics)
{
diff --git a/generator/locality_sorter.cpp b/generator/locality_sorter.cpp
index 7427a1448e..5ee038be01 100644
--- a/generator/locality_sorter.cpp
+++ b/generator/locality_sorter.cpp
@@ -201,7 +201,7 @@ bool GenerateLocalityDataImpl(FeaturesCollector & collector, NeedSerialize const
for (auto const & filename : files)
{
- auto const file = my::JoinFoldersToPath(featuresDir, filename);
+ auto const file = base::JoinFoldersToPath(featuresDir, filename);
LOG(LINFO, ("Processing", file));
CalculateMidPoints midPoints;
@@ -256,7 +256,7 @@ bool GenerateGeoObjectsData(string const & featuresDir, string const & nodesFile
header.SetScales({scales::GetUpperScale()});
LocalityCollector localityCollector(dataFile, header,
- static_cast<uint32_t>(my::SecondsSinceEpoch()));
+ static_cast<uint32_t>(base::SecondsSinceEpoch()));
return GenerateLocalityDataImpl(localityCollector, needSerialize, featuresDir, dataFile);
}
@@ -267,7 +267,7 @@ bool GenerateRegionsData(string const & featuresDir, string const & dataFile)
header.SetScales({scales::GetUpperScale()});
LocalityCollector regionsCollector(dataFile, header,
- static_cast<uint32_t>(my::SecondsSinceEpoch()));
+ static_cast<uint32_t>(base::SecondsSinceEpoch()));
auto const needSerialize = [](FeatureBuilder1 const & fb) { return fb.IsArea(); };
return GenerateLocalityDataImpl(regionsCollector, needSerialize, featuresDir, dataFile);
}
diff --git a/generator/mwm_diff/mwm_diff_tests/diff_test.cpp b/generator/mwm_diff/mwm_diff_tests/diff_test.cpp
index 034b46e26f..57050e1cb3 100644
--- a/generator/mwm_diff/mwm_diff_tests/diff_test.cpp
+++ b/generator/mwm_diff/mwm_diff_tests/diff_test.cpp
@@ -18,12 +18,12 @@ namespace mwm_diff
{
UNIT_TEST(IncrementalUpdates_Smoke)
{
- string const oldMwmPath = my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
+ string const oldMwmPath = base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
string const newMwmPath1 =
- my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-new1.mwm");
+ base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-new1.mwm");
string const newMwmPath2 =
- my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-new2.mwm");
- string const diffPath = my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwmdiff");
+ base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-new2.mwm");
+ string const diffPath = base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwmdiff");
MY_SCOPE_GUARD(cleanup, [&] {
FileWriter::DeleteFileX(newMwmPath1);
@@ -39,7 +39,7 @@ UNIT_TEST(IncrementalUpdates_Smoke)
TEST(MakeDiff(oldMwmPath, newMwmPath1, diffPath), ());
TEST(ApplyDiff(oldMwmPath, newMwmPath2, diffPath), ());
- TEST(my::IsEqualFiles(newMwmPath1, newMwmPath2), ());
+ TEST(base::IsEqualFiles(newMwmPath1, newMwmPath2), ());
}
} // namespace mwm_diff
} // namespace generator
diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp
index e488f15969..475ec0398a 100644
--- a/generator/osm2type.cpp
+++ b/generator/osm2type.cpp
@@ -756,7 +756,7 @@ namespace ftype
{
params.layer = atoi(v.c_str());
int8_t const bound = 10;
- params.layer = my::clamp(params.layer, static_cast<int8_t>(-bound), bound);
+ params.layer = base::clamp(params.layer, static_cast<int8_t>(-bound), bound);
}
}
},
diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp
index b0927bfeef..d6f05466f9 100644
--- a/generator/osm_element.hpp
+++ b/generator/osm_element.hpp
@@ -120,8 +120,8 @@ struct OsmElement
{
return type == e.type
&& id == e.id
- && my::AlmostEqualAbs(lon, e.lon, 1e-7)
- && my::AlmostEqualAbs(lat, e.lat, 1e-7)
+ && base::AlmostEqualAbs(lon, e.lon, 1e-7)
+ && base::AlmostEqualAbs(lat, e.lat, 1e-7)
&& ref == e.ref
&& k == e.k
&& v == e.v
diff --git a/generator/region_info_collector.cpp b/generator/region_info_collector.cpp
index 46db1f4d6b..dd3684abea 100644
--- a/generator/region_info_collector.cpp
+++ b/generator/region_info_collector.cpp
@@ -139,7 +139,7 @@ void RegionInfoCollector::FillRegionData(base::GeoObjectId const & osmId, OsmEle
}
catch (std::exception const & e) // std::invalid_argument, std::out_of_range
{
- LOG(::my::LWARNING, (e.what()));
+ LOG(::base::LWARNING, (e.what()));
rd.m_adminLevel = AdminLevel::Unknown;
}
}
diff --git a/generator/region_meta.cpp b/generator/region_meta.cpp
index 9b699a070d..60d0de780e 100644
--- a/generator/region_meta.cpp
+++ b/generator/region_meta.cpp
@@ -31,7 +31,7 @@ bool ReadRegionDataImpl(std::string const & countryName, RegionData & data)
auto reader = GetPlatform().GetReader(COUNTRIES_META_FILE);
std::string buffer;
reader->ReadAsString(buffer);
- my::Json root(buffer.data());
+ base::Json root(buffer.data());
json_t * jsonData = nullptr;
FromJSONObjectOptionalField(root.get(), countryName, jsonData);
@@ -65,7 +65,7 @@ bool ReadRegionDataImpl(std::string const & countryName, RegionData & data)
for (json_t * holiday : holidays)
{
if (!json_is_array(holiday) || json_array_size(holiday) != 2)
- MYTHROW(my::Json::Exception, ("Holiday must be an array of two elements in", countryName));
+ MYTHROW(base::Json::Exception, ("Holiday must be an array of two elements in", countryName));
json_t * reference = json_array_get(holiday, 0);
int8_t refId = 0;
if (json_is_integer(reference))
@@ -78,14 +78,14 @@ bool ReadRegionDataImpl(std::string const & countryName, RegionData & data)
}
else
{
- MYTHROW(my::Json::Exception,
+ MYTHROW(base::Json::Exception,
("Holiday month reference should be either a std::string or a number in", countryName));
}
if (refId <= 0)
- MYTHROW(my::Json::Exception, ("Incorrect month reference in", countryName));
+ MYTHROW(base::Json::Exception, ("Incorrect month reference in", countryName));
if (!json_is_integer(json_array_get(holiday, 1)))
- MYTHROW(my::Json::Exception, ("Holiday day offset should be a number in", countryName));
+ MYTHROW(base::Json::Exception, ("Holiday day offset should be a number in", countryName));
data.AddPublicHoliday(refId, json_integer_value(json_array_get(holiday, 1)));
}
@@ -97,7 +97,7 @@ bool ReadRegionDataImpl(std::string const & countryName, RegionData & data)
{
LOG(LWARNING, ("Error reading", COUNTRIES_META_FILE, ":", e.Msg()));
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, ("Error parsing JSON in", COUNTRIES_META_FILE, ":", e.Msg()));
}
diff --git a/generator/regions.cpp b/generator/regions.cpp
index 16a19772fb..b8a0a64d62 100644
--- a/generator/regions.cpp
+++ b/generator/regions.cpp
@@ -50,16 +50,16 @@ public:
auto const & main = nodePtrList.front()->GetData();
auto const & country = nodePtrList.back()->GetData();
- auto geometry = my::NewJSONObject();
+ auto geometry = base::NewJSONObject();
ToJSONObject(*geometry, "type", "Point");
- auto coordinates = my::NewJSONArray();
+ auto coordinates = base::NewJSONArray();
auto const center = main.GetCenter();
ToJSONArray(*coordinates, center.get<0>());
ToJSONArray(*coordinates, center.get<1>());
ToJSONObject(*geometry, "coordinates", coordinates);
- auto localeEn = my::NewJSONObject();
- auto address = my::NewJSONObject();
+ auto localeEn = base::NewJSONObject();
+ auto address = base::NewJSONObject();
for (auto const & p : boost::adaptors::reverse(nodePtrList))
{
auto const & region = p->GetData();
@@ -75,10 +75,10 @@ public:
ToJSONObject(*localeEn, label, region.GetEnglishOrTransliteratedName());
}
- auto locales = my::NewJSONObject();
+ auto locales = base::NewJSONObject();
ToJSONObject(*locales, "en", localeEn);
- auto properties = my::NewJSONObject();
+ auto properties = base::NewJSONObject();
ToJSONObject(*properties, "name", main.GetName());
ToJSONObject(*properties, "rank", main.GetRank());
ToJSONObject(*properties, "address", address);
@@ -86,7 +86,7 @@ public:
if (country.HasIsoCode())
ToJSONObject(*properties, "code", country.GetIsoCode());
- auto feature = my::NewJSONObject();
+ auto feature = base::NewJSONObject();
ToJSONObject(*feature, "type", "Feature");
ToJSONObject(*feature, "geometry", geometry);
ToJSONObject(*feature, "properties", properties);
@@ -669,7 +669,7 @@ bool GenerateRegions(feature::GenerateInfo const & genInfo)
using namespace regions;
LOG(LINFO, ("Start generating regions.."));
- auto timer = my::Timer();
+ auto timer = base::Timer();
Transliteration::Instance().Init(GetPlatform().ResourcesDir());
diff --git a/generator/relation_tags.hpp b/generator/relation_tags.hpp
index d9469367c4..aa584f680a 100644
--- a/generator/relation_tags.hpp
+++ b/generator/relation_tags.hpp
@@ -49,7 +49,7 @@ protected:
routing::TagsProcessor & m_routingTagsProcessor;
private:
- my::Cache<uint64_t, RelationElement> m_cache;
+ base::Cache<uint64_t, RelationElement> m_cache;
};
class RelationTagsNode : public RelationTagsBase
diff --git a/generator/restaurants_info/restaurants_info.cpp b/generator/restaurants_info/restaurants_info.cpp
index 93a8133b2c..6b0f17946a 100644
--- a/generator/restaurants_info/restaurants_info.cpp
+++ b/generator/restaurants_info/restaurants_info.cpp
@@ -33,7 +33,7 @@ feature::GenerateInfo GetGenerateInfo()
info.SetNodeStorageType("map");
info.SetOsmFileType("o5m");
- info.m_intermediateDir = my::GetDirectory(FLAGS_out);
+ info.m_intermediateDir = base::GetDirectory(FLAGS_out);
// Set other info params here.
diff --git a/generator/routing_index_generator.cpp b/generator/routing_index_generator.cpp
index 5511d28389..ab4354036b 100644
--- a/generator/routing_index_generator.cpp
+++ b/generator/routing_index_generator.cpp
@@ -335,8 +335,8 @@ void CalcCrossMwmConnectors(
vector<CrossMwmConnectorSerializer::Transition<CrossMwmId>> & transitions,
CrossMwmConnectorPerVehicleType<CrossMwmId> & connectors)
{
- my::Timer timer;
- string const polyFile = my::JoinPath(path, BORDERS_DIR, country + BORDERS_EXTENSION);
+ base::Timer timer;
+ string const polyFile = base::JoinPath(path, BORDERS_DIR, country + BORDERS_EXTENSION);
vector<m2::RegionD> borders;
osm::LoadBorders(polyFile, borders);
@@ -388,7 +388,7 @@ void FillWeights(string const & path, string const & mwmFile, string const & cou
CountryParentNameGetterFn const & countryParentNameGetterFn,
bool disableCrossMwmProgress, CrossMwmConnector<CrossMwmId> & connector)
{
- my::Timer timer;
+ base::Timer timer;
shared_ptr<VehicleModelInterface> vehicleModel =
CarModelFactory(countryParentNameGetterFn).GetVehicleModelForCountry(country);
diff --git a/generator/search_index_builder.cpp b/generator/search_index_builder.cpp
index a6e782e731..6d5a2ee4db 100644
--- a/generator/search_index_builder.cpp
+++ b/generator/search_index_builder.cpp
@@ -517,7 +517,7 @@ void BuildSearchIndex(FilesContainerR & container, Writer & indexWriter)
using Value = FeatureIndexValue;
LOG(LINFO, ("Start building search index for", container.GetFileName()));
- my::Timer timer;
+ base::Timer timer;
auto const & categoriesHolder = GetDefaultCategories();
diff --git a/generator/sponsored_object_storage.hpp b/generator/sponsored_object_storage.hpp
index b6b82c6fe7..6a17480144 100644
--- a/generator/sponsored_object_storage.hpp
+++ b/generator/sponsored_object_storage.hpp
@@ -72,7 +72,7 @@ public:
return;
}
- auto const excludedIdsPath = my::JoinPath(GetPlatform().ResourcesDir(), BOOKING_EXCLUDED_FILE);
+ auto const excludedIdsPath = base::JoinPath(GetPlatform().ResourcesDir(), BOOKING_EXCLUDED_FILE);
LoadData(dataSource, LoadExcludedIds(excludedIdsPath));
}
diff --git a/generator/sponsored_scoring.cpp b/generator/sponsored_scoring.cpp
index 0ca1db65ff..af0e2a10ef 100644
--- a/generator/sponsored_scoring.cpp
+++ b/generator/sponsored_scoring.cpp
@@ -88,7 +88,7 @@ namespace impl
double GetLinearNormDistanceScore(double distance, double const maxDistance)
{
CHECK_NOT_EQUAL(maxDistance, 0.0, ("maxDistance cannot be 0."));
- distance = my::clamp(distance, 0.0, maxDistance);
+ distance = base::clamp(distance, 0.0, maxDistance);
return 1.0 - distance / maxDistance;
}
diff --git a/generator/tesselator.cpp b/generator/tesselator.cpp
index da9e497bfe..f4c3c6cec0 100644
--- a/generator/tesselator.cpp
+++ b/generator/tesselator.cpp
@@ -127,7 +127,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
{
for (int j = 0; j < 3; ++j)
{
- if (to.m_p[i] == from.m_p[my::NextModN(j, 3)] && to.m_p[my::NextModN(i, 3)] == from.m_p[j])
+ if (to.m_p[i] == from.m_p[base::NextModN(j, 3)] && to.m_p[base::NextModN(i, 3)] == from.m_p[j])
return std::make_pair(i, j);
}
}
@@ -143,14 +143,14 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info)
void TrianglesInfo::ListInfo::GetNeighbors(
Triangle const & trg, Triangle const & from, int * nb) const
{
- int i = my::NextModN(CommonEdge(trg, from).first, 3);
- int j = my::NextModN(i, 3);
+ int i = base::NextModN(CommonEdge(trg, from).first, 3);
+ int j = base::NextModN(i, 3);
int ind = 0;
TIterator it = m_neighbors.find(std::make_pair(trg.m_p[j], trg.m_p[i]));
nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key;
- it = m_neighbors.find(std::make_pair(trg.m_p[my::NextModN(j, 3)], trg.m_p[j]));
+ it = m_neighbors.find(std::make_pair(trg.m_p[base::NextModN(j, 3)], trg.m_p[j]));
nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key;
}
diff --git a/generator/tesselator.hpp b/generator/tesselator.hpp
index c1b385ffdc..0f3c7becd7 100644
--- a/generator/tesselator.hpp
+++ b/generator/tesselator.hpp
@@ -69,7 +69,7 @@ namespace tesselator
{
size_t operator()(std::pair<T1, T2> const & p) const
{
- return my::Hash(p.first, p.second);
+ return base::Hash(p.first, p.second);
}
};
diff --git a/generator/transit_generator.cpp b/generator/transit_generator.cpp
index 4122b559f5..04b8dc26e5 100644
--- a/generator/transit_generator.cpp
+++ b/generator/transit_generator.cpp
@@ -45,7 +45,7 @@ namespace
{
void LoadBorders(string const & dir, TCountryId const & countryId, vector<m2::RegionD> & borders)
{
- string const polyFile = my::JoinPath(dir, BORDERS_DIR, countryId + BORDERS_EXTENSION);
+ string const polyFile = base::JoinPath(dir, BORDERS_DIR, countryId + BORDERS_EXTENSION);
borders.clear();
osm::LoadBorders(polyFile, borders);
}
@@ -61,7 +61,7 @@ void FillOsmIdToFeatureIdsMap(string const & osmIdToFeatureIdsPath, OsmIdToFeatu
string GetMwmPath(string const & mwmDir, TCountryId const & countryId)
{
- return my::JoinPath(mwmDir, countryId + DATA_FILE_EXTENSION);
+ return base::JoinPath(mwmDir, countryId + DATA_FILE_EXTENSION);
}
/// \brief Calculates best pedestrian segment for every gate in |graphData.m_gates|.
@@ -157,7 +157,7 @@ void DeserializeFromJson(OsmIdToFeatureIdsMap const & mapping,
LOG(LCRITICAL, ("Can't open", transitJsonPath, e.what()));
}
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
CHECK(root.get() != nullptr, ("Cannot parse the json file:", transitJsonPath));
data.Clear();
@@ -184,7 +184,7 @@ void BuildTransit(string const & mwmDir, TCountryId const & countryId,
{
LOG(LINFO, ("Building transit section for", countryId, "mwmDir:", mwmDir));
Platform::FilesList graphFiles;
- Platform::GetFilesByExt(my::AddSlashIfNeeded(transitDir), TRANSIT_FILE_EXTENSION, graphFiles);
+ Platform::GetFilesByExt(base::AddSlashIfNeeded(transitDir), TRANSIT_FILE_EXTENSION, graphFiles);
string const mwmPath = GetMwmPath(mwmDir, countryId);
OsmIdToFeatureIdsMap mapping;
@@ -195,7 +195,7 @@ void BuildTransit(string const & mwmDir, TCountryId const & countryId,
GraphData jointData;
for (auto const & fileName : graphFiles)
{
- auto const filePath = my::JoinPath(transitDir, fileName);
+ auto const filePath = base::JoinPath(transitDir, fileName);
GraphData data;
DeserializeFromJson(mapping, filePath, data);
// @todo(bykoianko) Json should be clipped on feature generation step. It's much more efficient.
diff --git a/generator/ugc_translator.cpp b/generator/ugc_translator.cpp
index e2d5ed4a16..bd20f17103 100644
--- a/generator/ugc_translator.cpp
+++ b/generator/ugc_translator.cpp
@@ -27,7 +27,7 @@ bool UGCTranslator::TranslateUGC(base::GeoObjectId const & id, ugc::UGC & ugc)
std::string str(src.cbegin(), src.cend());
- my::Json json(str);
+ base::Json json(str);
auto const size = json_array_size(json.get());
diff --git a/geocoder/geocoder.cpp b/geocoder/geocoder.cpp
index a8c6e4d012..91a61faa06 100644
--- a/geocoder/geocoder.cpp
+++ b/geocoder/geocoder.cpp
@@ -137,7 +137,7 @@ Geocoder::Geocoder(string pathToJsonHierarchy) : m_hierarchy(pathToJsonHierarchy
void Geocoder::ProcessQuery(string const & query, vector<Result> & results) const
{
#if defined(DEBUG)
- my::Timer timer;
+ base::Timer timer;
MY_SCOPE_GUARD(printDuration, [&timer]() {
LOG(LINFO, ("Total geocoding time:", timer.ElapsedSeconds(), "seconds"));
});
diff --git a/geocoder/geocoder_tests/geocoder_tests.cpp b/geocoder/geocoder_tests/geocoder_tests.cpp
index 2d7535b562..13d8f61909 100644
--- a/geocoder/geocoder_tests/geocoder_tests.cpp
+++ b/geocoder/geocoder_tests/geocoder_tests.cpp
@@ -47,7 +47,7 @@ void TestGeocoder(Geocoder & geocoder, string const & query, vector<Result> && e
for (size_t i = 0; i < actual.size(); ++i)
{
TEST_EQUAL(actual[i].m_osmId, expected[i].m_osmId, ());
- TEST(my::AlmostEqualAbs(actual[i].m_certainty, expected[i].m_certainty, kCertaintyEps),
+ TEST(base::AlmostEqualAbs(actual[i].m_certainty, expected[i].m_certainty, kCertaintyEps),
(query, actual[i].m_certainty, expected[i].m_certainty));
}
}
diff --git a/geocoder/hierarchy.cpp b/geocoder/hierarchy.cpp
index b3def3cf72..8a47aefc27 100644
--- a/geocoder/hierarchy.cpp
+++ b/geocoder/hierarchy.cpp
@@ -18,11 +18,11 @@ bool Hierarchy::Entry::DeserializeFromJSON(string const & jsonStr, ParsingStats
{
try
{
- my::Json root(jsonStr.c_str());
+ base::Json root(jsonStr.c_str());
DeserializeFromJSONImpl(root.get(), jsonStr, stats);
return true;
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LDEBUG, ("Can't parse entry:", e.Msg(), jsonStr));
}
@@ -36,11 +36,11 @@ void Hierarchy::Entry::DeserializeFromJSONImpl(json_t * const root, string const
if (!json_is_object(root))
{
++stats.m_badJsons;
- MYTHROW(my::Json::Exception, ("Not a json object."));
+ MYTHROW(base::Json::Exception, ("Not a json object."));
}
- json_t * const properties = my::GetJSONObligatoryField(root, "properties");
- json_t * const address = my::GetJSONObligatoryField(properties, "address");
+ json_t * const properties = base::GetJSONObligatoryField(root, "properties");
+ json_t * const address = base::GetJSONObligatoryField(properties, "address");
bool hasDuplicateAddress = false;
for (size_t i = 0; i < static_cast<size_t>(Type::Count); ++i)
diff --git a/geometry/angles.cpp b/geometry/angles.cpp
index c911abf0b3..02cc633c25 100644
--- a/geometry/angles.cpp
+++ b/geometry/angles.cpp
@@ -9,7 +9,7 @@ double AngleIn2PI(double ang)
if (ang < 0.0)
ang += period;
- if (my::AlmostEqualULPs(period, ang))
+ if (base::AlmostEqualULPs(period, ang))
return 0.0;
return ang;
diff --git a/geometry/distance_on_sphere.cpp b/geometry/distance_on_sphere.cpp
index 5900059769..52040c692f 100644
--- a/geometry/distance_on_sphere.cpp
+++ b/geometry/distance_on_sphere.cpp
@@ -20,10 +20,10 @@ namespace ms
{
double DistanceOnSphere(double lat1Deg, double lon1Deg, double lat2Deg, double lon2Deg)
{
- double const lat1 = my::DegToRad(lat1Deg);
- double const lat2 = my::DegToRad(lat2Deg);
+ double const lat1 = base::DegToRad(lat1Deg);
+ double const lat2 = base::DegToRad(lat2Deg);
double const dlat = sin((lat2 - lat1) * 0.5);
- double const dlon = sin((my::DegToRad(lon2Deg) - my::DegToRad(lon1Deg)) * 0.5);
+ double const dlon = sin((base::DegToRad(lon2Deg) - base::DegToRad(lon1Deg)) * 0.5);
double const y = dlat * dlat + dlon * dlon * cos(lat1) * cos(lat2);
return 2.0 * atan2(sqrt(y), sqrt(max(0.0, 1.0 - y)));
}
@@ -31,7 +31,7 @@ double DistanceOnSphere(double lat1Deg, double lon1Deg, double lat2Deg, double l
double AreaOnSphere(ms::LatLon const & ll1, ms::LatLon const & ll2, ms::LatLon const & ll3)
{
// Todo: proper area on sphere (not needed for now)
- double const avgLat = my::DegToRad((ll1.lat + ll2.lat + ll3.lat) / 3);
+ double const avgLat = base::DegToRad((ll1.lat + ll2.lat + ll3.lat) / 3);
return cos(avgLat) * 0.5 *
fabs((ll2.lon - ll1.lon) * (ll3.lat - ll1.lat) -
(ll3.lon - ll1.lon) * (ll2.lat - ll1.lat));
diff --git a/geometry/geometry_tests/angle_test.cpp b/geometry/geometry_tests/angle_test.cpp
index 22dc6a8e4f..deadadb6e2 100644
--- a/geometry/geometry_tests/angle_test.cpp
+++ b/geometry/geometry_tests/angle_test.cpp
@@ -75,18 +75,18 @@ UNIT_TEST(ShortestDistance)
UNIT_TEST(TwoVectorsAngle)
{
double const eps = 1e-10;
- TEST(my::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
- m2::Point<double>(0, 1) /* p1 */,
- m2::Point<double>(1, 0)) /* p2 */, 3 * math::pi2, eps), ());
- TEST(my::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(1, 1) /* p */,
- m2::Point<double>(2, 2) /* p1 */,
- m2::Point<double>(1, 2)) /* p2 */, math::pi4, eps), ());
- TEST(my::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
- m2::Point<double>(1, 0) /* p1 */,
- m2::Point<double>(0, -1)) /* p2 */, 3 * math::pi2, eps), ());
- TEST(my::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
- m2::Point<double>(1, 0) /* p1 */,
- m2::Point<double>(-1, 0)) /* p2 */, math::pi, eps), ());
+ TEST(base::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
+ m2::Point<double>(0, 1) /* p1 */,
+ m2::Point<double>(1, 0)) /* p2 */, 3 * math::pi2, eps), ());
+ TEST(base::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(1, 1) /* p */,
+ m2::Point<double>(2, 2) /* p1 */,
+ m2::Point<double>(1, 2)) /* p2 */, math::pi4, eps), ());
+ TEST(base::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
+ m2::Point<double>(1, 0) /* p1 */,
+ m2::Point<double>(0, -1)) /* p2 */, 3 * math::pi2, eps), ());
+ TEST(base::AlmostEqualAbs(ang::TwoVectorsAngle(m2::Point<double>(0, 0) /* p */,
+ m2::Point<double>(1, 0) /* p1 */,
+ m2::Point<double>(-1, 0)) /* p2 */, math::pi, eps), ());
}
UNIT_TEST(Azimuth)
diff --git a/geometry/geometry_tests/screen_test.cpp b/geometry/geometry_tests/screen_test.cpp
index 7e6fdfb721..dd8d4ff324 100644
--- a/geometry/geometry_tests/screen_test.cpp
+++ b/geometry/geometry_tests/screen_test.cpp
@@ -22,10 +22,10 @@ namespace
b2 = screen.GtoP(b2);
// check that we are in boundaries.
- TEST(my::between_s(0, width, my::rounds(b1.x)), ());
- TEST(my::between_s(0, width, my::rounds(b2.x)), ());
- TEST(my::between_s(0, height, my::rounds(b1.y)), ());
- TEST(my::between_s(0, height, my::rounds(b2.y)), ());
+ TEST(base::between_s(0, width, base::rounds(b1.x)), ());
+ TEST(base::between_s(0, width, base::rounds(b2.x)), ());
+ TEST(base::between_s(0, height, base::rounds(b1.y)), ());
+ TEST(base::between_s(0, height, base::rounds(b2.y)), ());
}
}
diff --git a/geometry/geometry_tests/vector_test.cpp b/geometry/geometry_tests/vector_test.cpp
index 0b8ea7ee7c..6cd493acaf 100644
--- a/geometry/geometry_tests/vector_test.cpp
+++ b/geometry/geometry_tests/vector_test.cpp
@@ -2,17 +2,19 @@
#include "geometry/avg_vector.hpp"
-
namespace
{
-template <class T, size_t N> bool EqualArrays(T (&a1)[N], T (&a2)[N])
+template <class T, size_t N>
+bool EqualArrays(T (&a1)[N], T (&a2)[N])
+{
+ for (size_t i = 0; i < N; ++i)
{
- for (size_t i = 0; i < N; ++i)
- if (!my::AlmostEqualULPs(a1[i], a2[i]))
- return false;
- return true;
+ if (!base::AlmostEqualULPs(a1[i], a2[i]))
+ return false;
}
+ return true;
}
+} // namespace
UNIT_TEST(AvgVector_Smoke)
{
diff --git a/geometry/latlon.cpp b/geometry/latlon.cpp
index fa0521a2c3..9df06e46a5 100644
--- a/geometry/latlon.cpp
+++ b/geometry/latlon.cpp
@@ -24,6 +24,6 @@ bool LatLon::operator==(ms::LatLon const & p) const { return lat == p.lat && lon
bool LatLon::EqualDxDy(LatLon const & p, double eps) const
{
- return (my::AlmostEqualAbs(lat, p.lat, eps) && my::AlmostEqualAbs(lon, p.lon, eps));
+ return (base::AlmostEqualAbs(lat, p.lat, eps) && base::AlmostEqualAbs(lon, p.lon, eps));
}
} // namespace ms
diff --git a/geometry/latlon.hpp b/geometry/latlon.hpp
index ceff8cbe31..95476645b4 100644
--- a/geometry/latlon.hpp
+++ b/geometry/latlon.hpp
@@ -29,7 +29,7 @@ public:
struct Hash
{
- size_t operator()(ms::LatLon const & p) const { return my::Hash(p.lat, p.lon); }
+ size_t operator()(ms::LatLon const & p) const { return base::Hash(p.lat, p.lon); }
};
};
diff --git a/geometry/mercator.cpp b/geometry/mercator.cpp
index 9f46e5585a..0977316e1c 100644
--- a/geometry/mercator.cpp
+++ b/geometry/mercator.cpp
@@ -18,7 +18,7 @@ m2::RectD MercatorBounds::MetresToXY(double lon, double lat, double lonMetresR,
double const minLat = max(-90.0, lat - latDegreeOffset);
double const maxLat = min(90.0, lat + latDegreeOffset);
- double const cosL = max(cos(my::DegToRad(max(fabs(minLat), fabs(maxLat)))), 0.00001);
+ double const cosL = max(cos(base::DegToRad(max(fabs(minLat), fabs(maxLat)))), 0.00001);
ASSERT_GREATER(cosL, 0.0, ());
double const lonDegreeOffset = lonMetresR * degreeInMetres / cosL;
@@ -36,7 +36,7 @@ m2::PointD MercatorBounds::GetSmPoint(m2::PointD const & pt, double lonMetresR,
double const latDegreeOffset = latMetresR * degreeInMetres;
double const newLat = min(90.0, max(-90.0, lat + latDegreeOffset));
- double const cosL = max(cos(my::DegToRad(newLat)), 0.00001);
+ double const cosL = max(cos(base::DegToRad(newLat)), 0.00001);
ASSERT_GREATER(cosL, 0.0, ());
double const lonDegreeOffset = lonMetresR * degreeInMetres / cosL;
diff --git a/geometry/mercator.hpp b/geometry/mercator.hpp
index eea5d1cfee..0da726428b 100644
--- a/geometry/mercator.hpp
+++ b/geometry/mercator.hpp
@@ -15,21 +15,21 @@ struct MercatorBounds
static m2::RectD FullRect() { return m2::RectD(minX, minY, maxX, maxY); }
- static bool ValidLon(double d) { return my::between_s(-180.0, 180.0, d); }
- static bool ValidLat(double d) { return my::between_s(-90.0, 90.0, d); }
+ static bool ValidLon(double d) { return base::between_s(-180.0, 180.0, d); }
+ static bool ValidLat(double d) { return base::between_s(-90.0, 90.0, d); }
- static bool ValidX(double d) { return my::between_s(minX, maxX, d); }
- static bool ValidY(double d) { return my::between_s(minY, maxY, d); }
+ static bool ValidX(double d) { return base::between_s(minX, maxX, d); }
+ static bool ValidY(double d) { return base::between_s(minY, maxY, d); }
- static double ClampX(double d) { return my::clamp(d, minX, maxX); }
- static double ClampY(double d) { return my::clamp(d, minY, maxY); }
+ static double ClampX(double d) { return base::clamp(d, minX, maxX); }
+ static double ClampY(double d) { return base::clamp(d, minY, maxY); }
- static double YToLat(double y) { return my::RadToDeg(2.0 * atan(tanh(0.5 * my::DegToRad(y)))); }
+ static double YToLat(double y) { return base::RadToDeg(2.0 * atan(tanh(0.5 * base::DegToRad(y)))); }
static double LatToY(double lat)
{
- double const sinx = sin(my::DegToRad(my::clamp(lat, -86.0, 86.0)));
- double const res = my::RadToDeg(0.5 * log((1.0 + sinx) / (1.0 - sinx)));
+ double const sinx = sin(base::DegToRad(base::clamp(lat, -86.0, 86.0)));
+ double const res = base::RadToDeg(0.5 * log((1.0 + sinx) / (1.0 - sinx)));
return ClampY(res);
}
diff --git a/geometry/point2d.hpp b/geometry/point2d.hpp
index b43ea8af7a..9d0fc638e1 100644
--- a/geometry/point2d.hpp
+++ b/geometry/point2d.hpp
@@ -159,7 +159,7 @@ public:
struct Hash
{
- size_t operator()(m2::Point<T> const & p) const { return my::Hash(p.x, p.y); }
+ size_t operator()(m2::Point<T> const & p) const { return base::Hash(p.x, p.y); }
};
};
@@ -235,13 +235,13 @@ std::string DebugPrint(m2::Point<T> const & p)
template <typename T>
bool AlmostEqualAbs(m2::Point<T> const & a, m2::Point<T> const & b, double const eps)
{
- return my::AlmostEqualAbs(a.x, b.x, eps) && my::AlmostEqualAbs(a.y, b.y, eps);
+ return base::AlmostEqualAbs(a.x, b.x, eps) && base::AlmostEqualAbs(a.y, b.y, eps);
}
template <typename T>
bool AlmostEqualULPs(m2::Point<T> const & a, m2::Point<T> const & b, unsigned int maxULPs = 256)
{
- return my::AlmostEqualULPs(a.x, b.x, maxULPs) && my::AlmostEqualULPs(a.y, b.y, maxULPs);
+ return base::AlmostEqualULPs(a.x, b.x, maxULPs) && base::AlmostEqualULPs(a.y, b.y, maxULPs);
}
/// Calculate three points of a triangle (p1, p2 and p3) which give an arrow that
@@ -269,7 +269,7 @@ template <typename T>
Point<T> PointAtSegment(Point<T> const & p1, Point<T> const & p2, T shiftFromP1)
{
Point<T> p12 = p2 - p1;
- shiftFromP1 = my::clamp(shiftFromP1, static_cast<T>(0.0), static_cast<T>(p12.Length()));
+ shiftFromP1 = base::clamp(shiftFromP1, static_cast<T>(0.0), static_cast<T>(p12.Length()));
return p1 + p12.Normalize() * shiftFromP1;
}
@@ -298,7 +298,7 @@ bool operator<(Point<T> const & l, Point<T> const & r)
}
} // namespace m2
-namespace my
+namespace base
{
template <typename T>
bool AlmostEqualULPs(m2::Point<T> const & p1, m2::Point<T> const & p2, unsigned int maxULPs = 256)
@@ -311,4 +311,4 @@ bool AlmostEqualAbs(m2::Point<T> const & p1, m2::Point<T> const & p2, double con
{
return m2::AlmostEqualAbs(p1, p2, eps);
}
-} // namespace my
+} // namespace base
diff --git a/geometry/polygon.hpp b/geometry/polygon.hpp
index b4d91722c5..8b67bc070a 100644
--- a/geometry/polygon.hpp
+++ b/geometry/polygon.hpp
@@ -16,17 +16,17 @@ bool FindSingleStripForIndex(size_t i, size_t n, IsVisibleF isVisible)
{
// Searching for a strip only in a single direction, because the opposite direction
// is traversed from the last vertex of the possible strip.
- size_t a = my::PrevModN(i, n);
- size_t b = my::NextModN(i, n);
+ size_t a = base::PrevModN(i, n);
+ size_t b = base::NextModN(i, n);
for (size_t j = 2; j < n; ++j)
{
ASSERT_NOT_EQUAL ( a, b, () );
if (!isVisible(a, b))
return false;
if (j & 1)
- a = my::PrevModN(a, n);
+ a = base::PrevModN(a, n);
else
- b = my::NextModN(b, n);
+ b = base::NextModN(b, n);
}
ASSERT_EQUAL ( a, b, () );
diff --git a/geometry/rect2d.hpp b/geometry/rect2d.hpp
index e0a26a37a3..1e87a7c6c4 100644
--- a/geometry/rect2d.hpp
+++ b/geometry/rect2d.hpp
@@ -195,8 +195,8 @@ public:
void SetSizesToIncludePoint(Point<T> const & pt)
{
Point<T> const c = Center();
- T const dx = my::Abs(pt.x - c.x);
- T const dy = my::Abs(pt.y - c.y);
+ T const dx = base::Abs(pt.x - c.x);
+ T const dy = base::Abs(pt.y - c.y);
m_minX = c.x - dx;
m_minY = c.y - dy;
diff --git a/geometry/region2d.hpp b/geometry/region2d.hpp
index cd3c856b06..fa60739806 100644
--- a/geometry/region2d.hpp
+++ b/geometry/region2d.hpp
@@ -25,8 +25,8 @@ struct DefEqualFloat
{
static_assert(std::is_floating_point<typename Point::value_type>::value, "");
- return my::AlmostEqualAbs(p1.x, p2.x, static_cast<typename Point::value_type>(kPrecision)) &&
- my::AlmostEqualAbs(p1.y, p2.y, static_cast<typename Point::value_type>(kPrecision));
+ return base::AlmostEqualAbs(p1.x, p2.x, static_cast<typename Point::value_type>(kPrecision)) &&
+ base::AlmostEqualAbs(p1.y, p2.y, static_cast<typename Point::value_type>(kPrecision));
}
template <typename Coord>
@@ -34,7 +34,7 @@ struct DefEqualFloat
{
static_assert(std::is_floating_point<Coord>::value, "");
- return my::AlmostEqualAbs(val, 0.0, kPrecision * kPrecision);
+ return base::AlmostEqualAbs(val, 0.0, kPrecision * kPrecision);
}
// Determines if value of a val lays between a p1 and a p2 values with some precision.
bool IsAlmostBetween(double val, double p1, double p2) const
diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp
index 62e2260521..1721b3148f 100644
--- a/geometry/screenbase.cpp
+++ b/geometry/screenbase.cpp
@@ -210,9 +210,9 @@ void ScreenBase::SetAngle(double angle)
UpdateDependentParameters();
}
-int ScreenBase::GetWidth() const { return my::rounds(m_PixelRect.SizeX()); }
+int ScreenBase::GetWidth() const { return base::rounds(m_PixelRect.SizeX()); }
-int ScreenBase::GetHeight() const { return my::rounds(m_PixelRect.SizeY()); }
+int ScreenBase::GetHeight() const { return base::rounds(m_PixelRect.SizeY()); }
ScreenBase::MatrixT const ScreenBase::CalcTransform(m2::PointD const & oldPt1,
m2::PointD const & oldPt2,
diff --git a/indexer/cell_id.hpp b/indexer/cell_id.hpp
index 81c64c0349..d8a931a9a5 100644
--- a/indexer/cell_id.hpp
+++ b/indexer/cell_id.hpp
@@ -68,10 +68,10 @@ public:
#if 0 // DEBUG
double minX, minY, maxX, maxY;
GetCellBounds(id1, minX, minY, maxX, maxY);
- ASSERT(my::between_s(minX, maxX, x1), (x1, minX, maxX));
- ASSERT(my::between_s(minX, maxX, x2), (x2, minX, maxX));
- ASSERT(my::between_s(minY, maxY, y1), (y1, minY, maxY));
- ASSERT(my::between_s(minY, maxY, y2), (y2, minY, maxY));
+ ASSERT(base::between_s(minX, maxX, x1), (x1, minX, maxX));
+ ASSERT(base::between_s(minX, maxX, x2), (x2, minX, maxX));
+ ASSERT(base::between_s(minY, maxY, y1), (y1, minY, maxY));
+ ASSERT(base::between_s(minY, maxY, y2), (y2, minY, maxY));
#endif
return id1;
}
diff --git a/indexer/displacement_manager.hpp b/indexer/displacement_manager.hpp
index 509d401795..0a34f7d58b 100644
--- a/indexer/displacement_manager.hpp
+++ b/indexer/displacement_manager.hpp
@@ -179,7 +179,7 @@ private:
float const kMinDepth = -100000.0f;
float const kMaxDepth = 100000.0f;
- float const d = my::clamp(depth, kMinDepth, kMaxDepth) - kMinDepth;
+ float const d = base::clamp(depth, kMinDepth, kMaxDepth) - kMinDepth;
uint8_t rank = ft.GetRank();
m_priority = (static_cast<uint32_t>(d) << 8) | rank;
}
diff --git a/indexer/feature_impl.cpp b/indexer/feature_impl.cpp
index 0e14bb9534..402980f847 100644
--- a/indexer/feature_impl.cpp
+++ b/indexer/feature_impl.cpp
@@ -65,7 +65,7 @@ bool IsHouseNumber(strings::UniString const & s)
uint8_t PopulationToRank(uint64_t p)
{
- return static_cast<uint8_t>(min(0xFF, my::rounds(log(double(p)) / log(1.1))));
+ return static_cast<uint8_t>(min(0xFF, base::rounds(log(double(p)) / log(1.1))));
}
uint64_t RankToPopulation(uint8_t r)
diff --git a/indexer/features_offsets_table.cpp b/indexer/features_offsets_table.cpp
index 21b5a3c1f2..de57933902 100644
--- a/indexer/features_offsets_table.cpp
+++ b/indexer/features_offsets_table.cpp
@@ -137,7 +137,7 @@ namespace feature
LOG(LINFO, ("Saving features offsets table to ", filePath));
string const fileNameTmp = filePath + EXTENSION_TMP;
succinct::mapper::freeze(m_table, fileNameTmp.c_str());
- my::RenameFileX(fileNameTmp, filePath);
+ base::RenameFileX(fileNameTmp, filePath);
}
uint32_t FeaturesOffsetsTable::GetFeatureOffset(size_t index) const
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index d6437cf3af..253bf11ae2 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -485,7 +485,7 @@ double GetRadiusByPopulation(uint64_t p)
uint64_t GetPopulationByRadius(double r)
{
- return my::rounds(pow(r / 550.0, 3.6));
+ return base::rounds(pow(r / 550.0, 3.6));
}
bool IsTypeConformed(uint32_t type, base::StringIL const & path)
diff --git a/indexer/indexer_tests/centers_table_test.cpp b/indexer/indexer_tests/centers_table_test.cpp
index 5b6432b314..a0207931fd 100644
--- a/indexer/indexer_tests/centers_table_test.cpp
+++ b/indexer/indexer_tests/centers_table_test.cpp
@@ -34,7 +34,7 @@ struct CentersTableTest
UNIT_CLASS_TEST(CentersTableTest, Smoke)
{
- string const kMap = my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
+ string const kMap = base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
feature::DataHeader header(kMap);
auto const codingParams = header.GetDefGeometryCodingParams();
diff --git a/indexer/indexer_tests/rank_table_test.cpp b/indexer/indexer_tests/rank_table_test.cpp
index 0fe0ff282e..a148072ea8 100644
--- a/indexer/indexer_tests/rank_table_test.cpp
+++ b/indexer/indexer_tests/rank_table_test.cpp
@@ -77,9 +77,9 @@ UNIT_TEST(RankTableBuilder_EndToEnd)
classificator::Load();
string const originalMapPath =
- my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
- string const mapPath = my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-copy.mwm");
- my::CopyFileX(originalMapPath, mapPath);
+ base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
+ string const mapPath = base::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass-copy.mwm");
+ base::CopyFileX(originalMapPath, mapPath);
MY_SCOPE_GUARD(cleanup, bind(&FileWriter::DeleteFileX, mapPath));
platform::LocalCountryFile localFile =
diff --git a/indexer/map_style_reader.cpp b/indexer/map_style_reader.cpp
index d9f0889ab5..efb77d543c 100644
--- a/indexer/map_style_reader.cpp
+++ b/indexer/map_style_reader.cpp
@@ -98,7 +98,7 @@ ReaderPtr<Reader> StyleReader::GetDrawingRulesReader() const
std::string("drules_proto") + GetStyleRulesSuffix(GetCurrentStyle()) + ".bin";
auto overriddenRulesFile =
- my::JoinFoldersToPath({GetPlatform().WritableDir(), kStylesOverrideDir}, rulesFile);
+ base::JoinFoldersToPath({GetPlatform().WritableDir(), kStylesOverrideDir}, rulesFile);
if (GetPlatform().IsFileExistsByFullPath(overriddenRulesFile))
rulesFile = overriddenRulesFile;
@@ -110,10 +110,10 @@ ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
{
std::string const resourceDir =
std::string("resources-") + density + GetStyleResourcesSuffix(GetCurrentStyle());
- std::string resFile = my::JoinFoldersToPath(resourceDir, file);
+ std::string resFile = base::JoinFoldersToPath(resourceDir, file);
auto overriddenResFile =
- my::JoinFoldersToPath({GetPlatform().WritableDir(), kStylesOverrideDir}, resFile);
+ base::JoinFoldersToPath({GetPlatform().WritableDir(), kStylesOverrideDir}, resFile);
if (GetPlatform().IsFileExistsByFullPath(overriddenResFile))
resFile = overriddenResFile;
@@ -122,7 +122,7 @@ ReaderPtr<Reader> StyleReader::GetResourceReader(std::string const & file,
ReaderPtr<Reader> StyleReader::GetDefaultResourceReader(std::string const & file) const
{
- return GetPlatform().GetReader(my::JoinFoldersToPath("resources-default", file));
+ return GetPlatform().GetReader(base::JoinFoldersToPath("resources-default", file));
}
StyleReader & GetStyleReader()
diff --git a/indexer/rank_table.cpp b/indexer/rank_table.cpp
index 61a441174d..be6aab988c 100644
--- a/indexer/rank_table.cpp
+++ b/indexer/rank_table.cpp
@@ -245,8 +245,8 @@ uint8_t CalcSearchRank(FeatureType & ft)
auto const transportRank = CalcTransportRank(ft);
auto const populationRank = feature::PopulationToRank(ftypes::GetPopulation(ft));
- return my::clamp(eventRank + transportRank + populationRank, 0,
- static_cast<int>(numeric_limits<uint8_t>::max()));
+ return base::clamp(eventRank + transportRank + populationRank, 0,
+ static_cast<int>(numeric_limits<uint8_t>::max()));
}
// Creates rank table if it does not exists in |rcont| or has wrong
diff --git a/indexer/scales.cpp b/indexer/scales.cpp
index 0abc495743..9555e8fb9d 100644
--- a/indexer/scales.cpp
+++ b/indexer/scales.cpp
@@ -34,12 +34,12 @@ namespace scales
int GetScaleLevel(double ratio)
{
- return my::rounds(GetScaleLevelD(ratio));
+ return base::rounds(GetScaleLevelD(ratio));
}
int GetScaleLevel(m2::RectD const & r)
{
- return my::rounds(GetScaleLevelD(r));
+ return base::rounds(GetScaleLevelD(r));
}
double GetRationForLevel(double level)
diff --git a/indexer/string_set.hpp b/indexer/string_set.hpp
index 0b287cd755..5133a07c8c 100644
--- a/indexer/string_set.hpp
+++ b/indexer/string_set.hpp
@@ -16,7 +16,7 @@ namespace search
// need guaranteed O(Log(AlphabetSize) * Length(s)), refactor this
// class.
//
-// TODO (@y): unify this with my::MemTrie.
+// TODO (@y): unify this with base::MemTrie.
template <typename TChar, size_t OutDegree>
class StringSet
{
diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/SideButtons/MWMSideButtonsView.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/SideButtons/MWMSideButtonsView.mm
index 26bb25b24f..357b9b2562 100644
--- a/iphone/Maps/Classes/CustomViews/MapViewControls/SideButtons/MWMSideButtonsView.mm
+++ b/iphone/Maps/Classes/CustomViews/MapViewControls/SideButtons/MWMSideButtonsView.mm
@@ -35,7 +35,7 @@ CGFloat const kButtonsBottomOffset = 6;
- (void)layoutSubviews
{
CGFloat spacing = self.availableHeight - self.zoomOut.maxY - self.location.height;
- spacing = my::clamp(spacing, kLocationButtonSpacingMin, kLocationButtonSpacingMax);
+ spacing = base::clamp(spacing, kLocationButtonSpacingMin, kLocationButtonSpacingMax);
self.location.minY = self.zoomOut.maxY + spacing;
self.bounds = {{}, {self.zoomOut.width, self.location.maxY}};
diff --git a/iphone/Maps/Common/Statistics/fabric_logging.hpp b/iphone/Maps/Common/Statistics/fabric_logging.hpp
index 603c436bde..d74e79c5b2 100644
--- a/iphone/Maps/Common/Statistics/fabric_logging.hpp
+++ b/iphone/Maps/Common/Statistics/fabric_logging.hpp
@@ -6,6 +6,6 @@
namespace platform
{
- void IosLogMessage(my::LogLevel level, my::SrcPoint const & srcPoint, std::string const & msg);
- bool IosAssertMessage(my::SrcPoint const & srcPoint, std::string const & msg);
+ void IosLogMessage(base::LogLevel level, base::SrcPoint const & srcPoint, std::string const & msg);
+ bool IosAssertMessage(base::SrcPoint const & srcPoint, std::string const & msg);
}
diff --git a/iphone/Maps/Common/Statistics/fabric_logging_ios.mm b/iphone/Maps/Common/Statistics/fabric_logging_ios.mm
index 27510f2f39..d503b23e59 100644
--- a/iphone/Maps/Common/Statistics/fabric_logging_ios.mm
+++ b/iphone/Maps/Common/Statistics/fabric_logging_ios.mm
@@ -8,7 +8,7 @@
namespace platform
{
-void LogMessageFabric(my::LogLevel level, my::SrcPoint const & srcPoint, std::string const & msg)
+void LogMessageFabric(base::LogLevel level, base::SrcPoint const & srcPoint, std::string const & msg)
{
std::string recordType;
switch (level)
@@ -26,15 +26,15 @@ void LogMessageFabric(my::LogLevel level, my::SrcPoint const & srcPoint, std::st
CLSLog(@"%@", @(srcString.c_str()));
}
-void IosLogMessage(my::LogLevel level, my::SrcPoint const & srcPoint, std::string const & msg)
+void IosLogMessage(base::LogLevel level, base::SrcPoint const & srcPoint, std::string const & msg)
{
LogMessageFabric(level, srcPoint, msg);
- my::LogMessageDefault(level, srcPoint, msg);
+ base::LogMessageDefault(level, srcPoint, msg);
}
-bool IosAssertMessage(my::SrcPoint const & srcPoint, std::string const & msg)
+bool IosAssertMessage(base::SrcPoint const & srcPoint, std::string const & msg)
{
- LogMessageFabric(my::LCRITICAL, srcPoint, msg);
+ LogMessageFabric(base::LCRITICAL, srcPoint, msg);
std::cerr << "ASSERT FAILED" << std::endl
<< srcPoint.FileName() << ":" << srcPoint.Line() << std::endl
<< msg << std::endl;
diff --git a/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm b/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm
index 27bea56e19..e3e02f3b1c 100644
--- a/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm
+++ b/iphone/Maps/Core/Bookmarks/MWMBookmarksManager.mm
@@ -355,7 +355,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
if (!manager.shareCategoryURL)
return;
- my::DeleteFileX(manager.shareCategoryURL.path.UTF8String);
+ base::DeleteFileX(manager.shareCategoryURL.path.UTF8String);
manager.shareCategoryURL = nil;
}
diff --git a/iphone/Maps/Core/Location/MWMLocationHelpers.h b/iphone/Maps/Core/Location/MWMLocationHelpers.h
index 271c79ca1b..0667197afb 100644
--- a/iphone/Maps/Core/Location/MWMLocationHelpers.h
+++ b/iphone/Maps/Core/Location/MWMLocationHelpers.h
@@ -56,7 +56,7 @@ static inline double headingToNorthRad(CLHeading * heading)
if (heading)
{
north = (heading.trueHeading < 0) ? heading.magneticHeading : heading.trueHeading;
- north = my::DegToRad(north);
+ north = base::DegToRad(north);
}
return north;
}
diff --git a/iphone/Maps/Core/Location/MWMLocationManager.mm b/iphone/Maps/Core/Location/MWMLocationManager.mm
index 3bfcb6efb2..1aa223fc6d 100644
--- a/iphone/Maps/Core/Location/MWMLocationManager.mm
+++ b/iphone/Maps/Core/Location/MWMLocationManager.mm
@@ -47,9 +47,9 @@ location::CompassInfo compassInfoFromHeading(CLHeading * h)
{
location::CompassInfo info;
if (h.trueHeading >= 0.0)
- info.m_bearing = my::DegToRad(h.trueHeading);
+ info.m_bearing = base::DegToRad(h.trueHeading);
else if (h.headingAccuracy >= 0.0)
- info.m_bearing = my::DegToRad(h.magneticHeading);
+ info.m_bearing = base::DegToRad(h.magneticHeading);
return info;
}
diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm
index 81442a3a34..aa4dd950fa 100644
--- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm
+++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm
@@ -263,7 +263,7 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName)
auto const locationMercator = lastLocation.mercator;
auto const dataMercator = data.mercator;
- if (my::AlmostEqualAbs(locationMercator, dataMercator, 1e-10))
+ if (base::AlmostEqualAbs(locationMercator, dataMercator, 1e-10))
return;
auto const angle = ang::AngleTo(locationMercator, dataMercator) + info.m_bearing;
diff --git a/iphone/Maps/main.mm b/iphone/Maps/main.mm
index 6e72d92ede..354a2344a9 100644
--- a/iphone/Maps/main.mm
+++ b/iphone/Maps/main.mm
@@ -59,10 +59,10 @@ void setMarketingSender()
int main(int argc, char * argv[])
{
#ifdef MWM_LOG_TO_FILE
- my::SetLogMessageFn(LogMessageFile);
+ base::SetLogMessageFn(LogMessageFile);
#elif OMIM_PRODUCTION
- my::SetLogMessageFn(platform::IosLogMessage);
- my::SetAssertFunction(platform::IosAssertMessage);
+ base::SetLogMessageFn(platform::IosLogMessage);
+ base::SetAssertFunction(platform::IosAssertMessage);
#endif
auto & p = GetPlatform();
LOG(LINFO, ("maps.me started, detected CPU cores:", p.CpuCores()));
diff --git a/kml/kml_tests/serdes_tests.cpp b/kml/kml_tests/serdes_tests.cpp
index 90b6f5f6a9..628078c67f 100644
--- a/kml/kml_tests/serdes_tests.cpp
+++ b/kml/kml_tests/serdes_tests.cpp
@@ -502,7 +502,7 @@ UNIT_TEST(Kml_Serialization_Bin_Memory)
// 4. Check deserialization from the text file.
UNIT_TEST(Kml_Deserialization_Text_File)
{
- std::string const kmlFile = my::JoinPath(GetPlatform().TmpDir(), "tmp.kml");
+ std::string const kmlFile = base::JoinPath(GetPlatform().TmpDir(), "tmp.kml");
MY_SCOPE_GUARD(fileGuard, std::bind(&FileWriter::DeleteFileX, kmlFile));
try
{
@@ -539,7 +539,7 @@ UNIT_TEST(Kml_Deserialization_Text_File)
// 5. Check deserialization from the binary file.
UNIT_TEST(Kml_Deserialization_Bin_File)
{
- std::string const kmbFile = my::JoinPath(GetPlatform().TmpDir(), "tmp.kmb");
+ std::string const kmbFile = base::JoinPath(GetPlatform().TmpDir(), "tmp.kmb");
MY_SCOPE_GUARD(fileGuard, std::bind(&FileWriter::DeleteFileX, kmbFile));
try
{
@@ -579,7 +579,7 @@ UNIT_TEST(Kml_Serialization_Bin_File)
{
auto data = GenerateKmlFileData();
- std::string const kmbFile = my::JoinPath(GetPlatform().TmpDir(), "tmp.kmb");
+ std::string const kmbFile = base::JoinPath(GetPlatform().TmpDir(), "tmp.kmb");
MY_SCOPE_GUARD(fileGuard, std::bind(&FileWriter::DeleteFileX, kmbFile));
try
{
@@ -617,7 +617,7 @@ UNIT_TEST(Kml_Serialization_Text_File)
auto data = GenerateKmlFileData();
- std::string const kmlFile = my::JoinPath(GetPlatform().TmpDir(), "tmp.kml");
+ std::string const kmlFile = base::JoinPath(GetPlatform().TmpDir(), "tmp.kml");
MY_SCOPE_GUARD(fileGuard, std::bind(&FileWriter::DeleteFileX, kmlFile));
try
{
diff --git a/kml/serdes.cpp b/kml/serdes.cpp
index 7f2c0c1527..a1bfa5a54c 100644
--- a/kml/serdes.cpp
+++ b/kml/serdes.cpp
@@ -180,7 +180,7 @@ void SaveColorToABGR(KmlWriter::WriterWrapper & writer, uint32_t rgba)
std::string TimestampToString(Timestamp const & timestamp)
{
auto const ts = std::chrono::system_clock::to_time_t(timestamp);
- std::string const strTimeStamp = my::TimestampToString(ts);
+ std::string const strTimeStamp = base::TimestampToString(ts);
if (strTimeStamp.size() != 20)
MYTHROW(KmlWriter::WriteKmlException, ("We always generate fixed length UTC-format timestamp."));
return strTimeStamp;
@@ -800,8 +800,8 @@ void KmlParser::CharData(std::string value)
}
else if (currTag == "mwm:lastModified")
{
- auto const ts = my::StringToTimestamp(value);
- if (ts != my::INVALID_TIME_STAMP)
+ auto const ts = base::StringToTimestamp(value);
+ if (ts != base::INVALID_TIME_STAMP)
m_data.m_categoryData.m_lastModified = std::chrono::system_clock::from_time_t(ts);
}
else if (currTag == "mwm:accessRules")
@@ -983,8 +983,8 @@ void KmlParser::CharData(std::string value)
{
if (currTag == "when")
{
- auto const ts = my::StringToTimestamp(value);
- if (ts != my::INVALID_TIME_STAMP)
+ auto const ts = base::StringToTimestamp(value);
+ if (ts != base::INVALID_TIME_STAMP)
m_timestamp = std::chrono::system_clock::from_time_t(ts);
}
}
diff --git a/local_ads/event.cpp b/local_ads/event.cpp
index 42683672d7..0367d5d71d 100644
--- a/local_ads/event.cpp
+++ b/local_ads/event.cpp
@@ -39,8 +39,8 @@ bool Event::operator==(Event const & event) const
return m_type == event.m_type && m_mwmVersion == event.m_mwmVersion &&
m_countryId == event.m_countryId && m_featureId == event.m_featureId &&
m_zoomLevel == event.m_zoomLevel &&
- my::AlmostEqualAbs(m_latitude, event.m_latitude, kEps) &&
- my::AlmostEqualAbs(m_longitude, event.m_longitude, kEps) &&
+ base::AlmostEqualAbs(m_latitude, event.m_latitude, kEps) &&
+ base::AlmostEqualAbs(m_longitude, event.m_longitude, kEps) &&
m_accuracyInMeters == event.m_accuracyInMeters &&
duration_cast<seconds>(m_timestamp - event.m_timestamp).count() == 0;
}
diff --git a/local_ads/local_ads_tests/statistics_tests.cpp b/local_ads/local_ads_tests/statistics_tests.cpp
index efe791a04a..a8a92c5147 100644
--- a/local_ads/local_ads_tests/statistics_tests.cpp
+++ b/local_ads/local_ads_tests/statistics_tests.cpp
@@ -63,7 +63,7 @@ UNIT_TEST(LocalAdsStatistics_Write_With_Unprocessed)
std::list<local_ads::Event> expectedUnprocessedEvents = events2;
expectedUnprocessedEvents.sort();
- my::GetNameFromFullPath(fileNameToRebuild);
+ base::GetNameFromFullPath(fileNameToRebuild);
TEST_EQUAL(fileNameToRebuild, "Moscow_123456.dat", ());
TEST_EQUAL(expectedUnprocessedEvents, unprocessedEvents2, ());
}
diff --git a/local_ads/statistics.cpp b/local_ads/statistics.cpp
index c027ade5fa..d9face059d 100644
--- a/local_ads/statistics.cpp
+++ b/local_ads/statistics.cpp
@@ -130,7 +130,7 @@ local_ads::Timestamp GetMaxTimestamp(std::list<local_ads::Event> const & events,
std::string GetPath(std::string const & fileName)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), kStatisticsFolderName}, fileName);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), kStatisticsFolderName}, fileName);
}
std::string GetPath(local_ads::Event const & event)
@@ -196,16 +196,16 @@ std::vector<uint8_t> SerializeForServer(std::list<local_ads::Event> const & even
{
using namespace std::chrono;
ASSERT(!events.empty(), ());
- auto root = my::NewJSONObject();
+ auto root = base::NewJSONObject();
ToJSONObject(*root, "userId", userId);
static std::string offlineId = GetPlatform().MacAddress(true /* md5Decoded */);
ToJSONObject(*root, "offlineId", offlineId);
ToJSONObject(*root, "countryId", events.front().m_countryId);
ToJSONObject(*root, "mwmVersion", events.front().m_mwmVersion);
- auto eventsNode = my::NewJSONArray();
+ auto eventsNode = base::NewJSONArray();
for (auto const & event : events)
{
- auto eventNode = my::NewJSONObject();
+ auto eventNode = base::NewJSONObject();
auto s = duration_cast<seconds>(event.m_timestamp.time_since_epoch()).count();
ToJSONObject(*eventNode, "type", static_cast<uint8_t>(event.m_type));
ToJSONObject(*eventNode, "timestamp", static_cast<int64_t>(s));
diff --git a/map/address_finder.cpp b/map/address_finder.cpp
index 51d42fdc8b..57de96aa25 100644
--- a/map/address_finder.cpp
+++ b/map/address_finder.cpp
@@ -67,7 +67,7 @@ namespace
{
// feature should be visible in needed scale
pair<int, int> const r = feature::GetDrawableScaleRange(types);
- return my::between_s(r.first, r.second, m_scale);
+ return base::between_s(r.first, r.second, m_scale);
}
/// @return epsilon value for distance compare according to priority:
@@ -319,7 +319,7 @@ namespace
{
// we need features with texts for address lookup
pair<int, int> const r = GetDrawableScaleRangeForRules(types, RULE_ANY_TEXT | RULE_SYMBOL);
- return my::between_s(r.first, r.second, m_scale);
+ return base::between_s(r.first, r.second, m_scale);
}
else
return true;
diff --git a/map/benchmark_tool/features_loading.cpp b/map/benchmark_tool/features_loading.cpp
index a057483768..5cc42f8015 100644
--- a/map/benchmark_tool/features_loading.cpp
+++ b/map/benchmark_tool/features_loading.cpp
@@ -20,7 +20,7 @@ namespace
{
class Accumulator
{
- my::Timer m_timer;
+ base::Timer m_timer;
size_t m_count;
Result & m_res;
@@ -78,7 +78,7 @@ namespace
{
acc.Reset(scale);
- my::Timer timer;
+ base::Timer timer;
src.ForEachFeature(r, acc, scale);
res.Add(timer.ElapsedSeconds());
@@ -99,8 +99,8 @@ namespace
void RunFeaturesLoadingBenchmark(string const & file, pair<int, int> scaleRange, AllResult & res)
{
string fileName = file;
- my::GetNameFromFullPath(fileName);
- my::GetNameWithoutExt(fileName);
+ base::GetNameFromFullPath(fileName);
+ base::GetNameWithoutExt(fileName);
platform::LocalCountryFile localFile =
platform::LocalCountryFile::MakeForTesting(fileName);
diff --git a/map/benchmark_tools.cpp b/map/benchmark_tools.cpp
index 2d115bbeb0..e745223a0b 100644
--- a/map/benchmark_tools.cpp
+++ b/map/benchmark_tools.cpp
@@ -91,7 +91,7 @@ void RunGraphicsBenchmark(Framework * framework)
string const & result = request.ServerResponse();
try
{
- my::Json root(result.c_str());
+ base::Json root(result.c_str());
json_t * scenariosNode = json_object_get(root.get(), "scenarios");
if (scenariosNode == nullptr || !json_is_array(scenariosNode))
return;
@@ -142,7 +142,7 @@ void RunGraphicsBenchmark(Framework * framework)
}
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
return;
}
diff --git a/map/bookmark_catalog.cpp b/map/bookmark_catalog.cpp
index d216394ee3..8323048581 100644
--- a/map/bookmark_catalog.cpp
+++ b/map/bookmark_catalog.cpp
@@ -72,7 +72,7 @@ void BookmarkCatalog::Download(std::string const & id, std::string const & name,
m_downloadingIds.insert(std::make_pair(id, name));
static uint32_t counter = 0;
- auto const path = my::JoinPath(GetPlatform().TmpDir(), "file" + strings::to_string(++counter));
+ auto const path = base::JoinPath(GetPlatform().TmpDir(), "file" + strings::to_string(++counter));
platform::RemoteFile remoteFile(BuildCatalogDownloadUrl(id));
remoteFile.DownloadAsync(path, [startHandler = std::move(startHandler)](std::string const &)
diff --git a/map/bookmark_helpers.cpp b/map/bookmark_helpers.cpp
index 2554b0d5dc..ef76c8062d 100644
--- a/map/bookmark_helpers.cpp
+++ b/map/bookmark_helpers.cpp
@@ -284,7 +284,7 @@ std::unique_ptr<kml::FileData> LoadKmzFile(std::string const & file, std::string
auto fileName = files.front().first;
for (auto const & f : files)
{
- if (strings::MakeLowerCase(my::GetFileExtension(f.first)) == kKmlExtension)
+ if (strings::MakeLowerCase(base::GetFileExtension(f.first)) == kKmlExtension)
{
fileName = f.first;
break;
diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp
index 12f9fab0ae..3c5cd4e77e 100644
--- a/map/bookmark_manager.cpp
+++ b/map/bookmark_manager.cpp
@@ -57,24 +57,24 @@ std::string const kBookmarkCloudSettingsParam = "BookmarkCloudParam";
// Returns extension with a dot in a lower case.
std::string GetFileExt(std::string const & filePath)
{
- return strings::MakeLowerCase(my::GetFileExtension(filePath));
+ return strings::MakeLowerCase(base::GetFileExtension(filePath));
}
std::string GetFileName(std::string const & filePath)
{
std::string ret = filePath;
- my::GetNameFromFullPath(ret);
+ base::GetNameFromFullPath(ret);
return ret;
}
std::string GetBookmarksDirectory()
{
- return my::JoinPath(GetPlatform().SettingsDir(), "bookmarks");
+ return base::JoinPath(GetPlatform().SettingsDir(), "bookmarks");
}
std::string GetPrivateBookmarksDirectory()
{
- return my::JoinPath(GetPlatform().PrivateDir(), "bookmarks_private");
+ return base::JoinPath(GetPlatform().PrivateDir(), "bookmarks_private");
}
bool IsBadCharForPath(strings::UniChar const & c)
@@ -139,8 +139,8 @@ BookmarkManager::SharingResult GetFileForSharing(BookmarkManager::KMLDataCollect
auto const categoryName = kml::GetDefaultStr(kmlToShare.second->m_categoryData.m_name);
std::string fileName = BookmarkManager::RemoveInvalidSymbols(categoryName, "");
if (fileName.empty())
- fileName = my::GetNameFromFullPathWithoutExt(kmlToShare.first);
- auto const filePath = my::JoinPath(GetPlatform().TmpDir(), fileName + kKmlExtension);
+ fileName = base::GetNameFromFullPathWithoutExt(kmlToShare.first);
+ auto const filePath = base::JoinPath(GetPlatform().TmpDir(), fileName + kKmlExtension);
MY_SCOPE_GUARD(fileGuard, std::bind(&FileWriter::DeleteFileX, filePath));
auto const categoryId = kmlToShare.second->m_categoryData.m_id;
@@ -151,7 +151,7 @@ BookmarkManager::SharingResult GetFileForSharing(BookmarkManager::KMLDataCollect
"Bookmarks file does not exist.");
}
- auto const tmpFilePath = my::JoinPath(GetPlatform().TmpDir(), fileName + kKmzExtension);
+ auto const tmpFilePath = base::JoinPath(GetPlatform().TmpDir(), fileName + kKmzExtension);
if (!CreateZipFromPathDeflatedAndDefaultCompression(filePath, tmpFilePath))
{
return BookmarkManager::SharingResult(categoryId, BookmarkManager::SharingResult::Code::ArchiveError,
@@ -164,8 +164,8 @@ BookmarkManager::SharingResult GetFileForSharing(BookmarkManager::KMLDataCollect
Cloud::ConvertionResult ConvertBeforeUploading(std::string const & filePath,
std::string const & convertedFilePath)
{
- std::string const fileName = my::GetNameFromFullPathWithoutExt(filePath);
- auto const tmpFilePath = my::JoinPath(GetPlatform().TmpDir(), fileName + kKmlExtension);
+ std::string const fileName = base::GetNameFromFullPathWithoutExt(filePath);
+ auto const tmpFilePath = base::JoinPath(GetPlatform().TmpDir(), fileName + kKmlExtension);
MY_SCOPE_GUARD(fileGuard, bind(&FileWriter::DeleteFileX, tmpFilePath));
auto kmlData = LoadKmlFile(filePath, KmlFileType::Binary);
@@ -203,7 +203,7 @@ std::string const kSettingsParam = "BookmarksMigrationCompleted";
std::string GetBackupFolderName()
{
- return my::JoinPath(GetPlatform().SettingsDir(), "bookmarks_backup");
+ return base::JoinPath(GetPlatform().SettingsDir(), "bookmarks_backup");
}
std::string CheckAndCreateBackupFolder()
@@ -215,7 +215,7 @@ std::string CheckAndCreateBackupFolder()
std::ostringstream ss;
ss << std::setfill('0') << std::setw(4) << t->tm_year + 1900
<< std::setw(2) << t->tm_mon + 1 << std::setw(2) << t->tm_mday;
- auto const backupFolder = my::JoinPath(commonBackupFolder, ss.str());
+ auto const backupFolder = base::JoinPath(commonBackupFolder, ss.str());
// In the case if the folder exists, try to resume.
if (GetPlatform().IsFileExistsByFullPath(backupFolder))
@@ -236,8 +236,8 @@ bool BackupBookmarks(std::string const & backupDir,
{
for (auto const & f : files)
{
- std::string fileName = my::GetNameFromFullPathWithoutExt(f);
- auto const kmzPath = my::JoinPath(backupDir, fileName + kKmzExtension);
+ std::string fileName = base::GetNameFromFullPathWithoutExt(f);
+ auto const kmzPath = base::JoinPath(backupDir, fileName + kKmzExtension);
if (GetPlatform().IsFileExistsByFullPath(kmzPath))
continue;
@@ -252,7 +252,7 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
{
convertedCount = 0;
- auto const conversionFolder = my::JoinPath(GetBackupFolderName(),
+ auto const conversionFolder = base::JoinPath(GetBackupFolderName(),
"conversion");
if (!GetPlatform().IsFileExistsByFullPath(conversionFolder) &&
!GetPlatform().MkDirChecked(conversionFolder))
@@ -265,8 +265,8 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
convertedFiles.reserve(files.size());
for (auto const & f : files)
{
- std::string fileName = my::GetNameFromFullPathWithoutExt(f);
- auto const kmbPath = my::JoinPath(conversionFolder, fileName + kKmbExtension);
+ std::string fileName = base::GetNameFromFullPathWithoutExt(f);
+ auto const kmbPath = base::JoinPath(conversionFolder, fileName + kKmbExtension);
if (!GetPlatform().IsFileExistsByFullPath(kmbPath))
{
auto kmlData = LoadKmlFile(f, KmlFileType::Text);
@@ -275,7 +275,7 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
if (!SaveKmlFile(*kmlData, kmbPath, KmlFileType::Binary))
{
- my::DeleteFileX(kmbPath);
+ base::DeleteFileX(kmbPath);
continue;
}
}
@@ -293,16 +293,16 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
// Move converted bookmark-files with respect of existing files.
for (auto const & f : convertedFiles)
{
- std::string fileName = my::GetNameFromFullPathWithoutExt(f);
- auto kmbPath = my::JoinPath(newBookmarksDir, fileName + kKmbExtension);
+ std::string fileName = base::GetNameFromFullPathWithoutExt(f);
+ auto kmbPath = base::JoinPath(newBookmarksDir, fileName + kKmbExtension);
size_t counter = 1;
while (Platform::IsFileExistsByFullPath(kmbPath))
{
- kmbPath = my::JoinPath(newBookmarksDir,
+ kmbPath = base::JoinPath(newBookmarksDir,
fileName + strings::to_string(counter++) + kKmbExtension);
}
- if (!my::RenameFileX(f, kmbPath))
+ if (!base::RenameFileX(f, kmbPath))
return false;
}
GetPlatform().RmDirRecursively(conversionFolder);
@@ -357,7 +357,7 @@ bool MigrateIfNeeded()
}
for (auto & f : files)
- f = my::JoinFoldersToPath(dir, f);
+ f = base::JoinFoldersToPath(dir, f);
std::string failedStage;
auto const backupDir = CheckAndCreateBackupFolder();
@@ -375,7 +375,7 @@ bool MigrateIfNeeded()
}
for (auto const & f : files)
- my::DeleteFileX(f);
+ base::DeleteFileX(f);
OnMigrationSuccess(files.size(), convertedCount);
return true;
}
@@ -963,7 +963,7 @@ BookmarkManager::KMLDataCollectionPtr BookmarkManager::LoadBookmarks(
cloudFilePaths.reserve(files.size());
for (auto const & file : files)
{
- auto const filePath = my::JoinPath(dir, file);
+ auto const filePath = base::JoinPath(dir, file);
auto kmlData = LoadKmlFile(filePath, fileType);
if (kmlData == nullptr)
continue;
@@ -1067,14 +1067,14 @@ void BookmarkManager::LoadBookmarkRoutine(std::string const & filePath, bool isT
if (migrated)
{
- std::string fileName = my::GetNameFromFullPathWithoutExt(fileSavePath);
+ std::string fileName = base::GetNameFromFullPathWithoutExt(fileSavePath);
- my::DeleteFileX(fileSavePath);
+ base::DeleteFileX(fileSavePath);
fileSavePath = GenerateValidAndUniqueFilePathForKMB(fileName);
if (!SaveKmlFile(*kmlData, fileSavePath, KmlFileType::Binary))
{
- my::DeleteFileX(fileSavePath);
+ base::DeleteFileX(fileSavePath);
fileSavePath.clear();
}
}
@@ -1173,7 +1173,7 @@ boost::optional<std::string> BookmarkManager::GetKMLPath(std::string const & fil
if (fileExt == kKmlExtension)
{
fileSavePath = GenerateValidAndUniqueFilePathForKML(GetFileName(filePath));
- if (!my::CopyFileX(filePath, fileSavePath))
+ if (!base::CopyFileX(filePath, fileSavePath))
return {};
}
else if (fileExt == kKmzExtension)
@@ -1665,7 +1665,7 @@ BookmarkManager::KMLDataCollectionPtr BookmarkManager::PrepareToSaveBookmarks(
{
return nullptr;
}
- auto const fn = my::JoinPath(privateFileDir, group->GetServerId() + kKmbExtension);
+ auto const fn = base::JoinPath(privateFileDir, group->GetServerId() + kKmbExtension);
group->SetFileName(fn);
collection->emplace_back(fn, CollectBmGroupKMLData(group));
continue;
@@ -1688,17 +1688,17 @@ BookmarkManager::KMLDataCollectionPtr BookmarkManager::PrepareToSaveBookmarks(
bool BookmarkManager::SaveKmlFileSafe(kml::FileData & kmlData, std::string const & file)
{
- auto const ext = my::GetFileExtension(file);
+ auto const ext = base::GetFileExtension(file);
auto const fileTmp = file + ".tmp";
if (SaveKmlFile(kmlData, fileTmp, ext == kKmbExtension ?
KmlFileType::Binary : KmlFileType::Text))
{
// Only after successful save we replace original file.
- my::DeleteFileX(file);
- VERIFY(my::RenameFileX(fileTmp, file), (fileTmp, file));
+ base::DeleteFileX(file);
+ VERIFY(base::RenameFileX(fileTmp, file), (fileTmp, file));
return true;
}
- my::DeleteFileX(fileTmp);
+ base::DeleteFileX(fileTmp);
return false;
}
@@ -1905,7 +1905,7 @@ void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler)
Platform::FilesList files;
Platform::GetFilesByExt(oldDir, kKmlExtension, files);
for (auto & f : files)
- f = my::JoinPath(oldDir, f);
+ f = base::JoinPath(oldDir, f);
auto const newDir = GetBookmarksDirectory();
if (!GetPlatform().IsFileExistsByFullPath(newDir) && !GetPlatform().MkDirChecked(newDir))
@@ -1930,11 +1930,11 @@ void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler)
if (FromCatalog(*kmlData) && !::IsMyCategory(userId, kmlData->m_categoryData))
continue;
- std::string fileName = my::GetNameFromFullPathWithoutExt(f);
- auto kmbPath = my::JoinPath(newDir, fileName + kKmbExtension);
+ std::string fileName = base::GetNameFromFullPathWithoutExt(f);
+ auto kmbPath = base::JoinPath(newDir, fileName + kKmbExtension);
size_t counter = 1;
while (Platform::IsFileExistsByFullPath(kmbPath))
- kmbPath = my::JoinPath(newDir, fileName + strings::to_string(counter++) + kKmbExtension);
+ kmbPath = base::JoinPath(newDir, fileName + strings::to_string(counter++) + kKmbExtension);
if (!SaveKmlFile(*kmlData, kmbPath, KmlFileType::Binary))
{
@@ -1943,7 +1943,7 @@ void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler)
}
fileData->emplace_back(kmbPath, std::move(kmlData));
- my::DeleteFileX(f);
+ base::DeleteFileX(f);
}
if (!fileData->empty())
@@ -2128,7 +2128,7 @@ void BookmarkManager::ImportDownloadedFromCatalog(std::string const & id, std::s
if (kmlData && FromCatalog(*kmlData) && kmlData->m_serverId == id)
{
bool const isMyCategory = ::IsMyCategory(userId, kmlData->m_categoryData);
- auto const p = my::JoinPath(isMyCategory ? GetBookmarksDirectory() : GetPrivateBookmarksDirectory(),
+ auto const p = base::JoinPath(isMyCategory ? GetBookmarksDirectory() : GetPrivateBookmarksDirectory(),
id, kKmbExtension);
auto collection = std::make_shared<KMLDataCollection>();
collection->emplace_back(p, std::move(kmlData));
@@ -2371,9 +2371,9 @@ std::string BookmarkManager::GenerateUniqueFileName(const std::string & path, st
size_t counter = 1;
std::string suffix;
- while (Platform::IsFileExistsByFullPath(my::JoinPath(path, name + suffix + kmlExt)))
+ while (Platform::IsFileExistsByFullPath(base::JoinPath(path, name + suffix + kmlExt)))
suffix = strings::to_string(counter++);
- return my::JoinPath(path, name + suffix + kmlExt);
+ return base::JoinPath(path, name + suffix + kmlExt);
}
// static
diff --git a/map/chart_generator.cpp b/map/chart_generator.cpp
index 8983afd2b3..8ce9675f6d 100644
--- a/map/chart_generator.cpp
+++ b/map/chart_generator.cpp
@@ -140,7 +140,7 @@ bool NormalizeChartData(vector<double> const & distanceDataM,
ASSERT_LESS(0, nextPointIdx, ("distFormStartM is greater than 0 but nextPointIdx == 0."));
size_t const prevPointIdx = nextPointIdx - 1;
- if (my::AlmostEqualAbs(distanceDataM[prevPointIdx], distanceDataM[nextPointIdx], kEpsilon))
+ if (base::AlmostEqualAbs(distanceDataM[prevPointIdx], distanceDataM[nextPointIdx], kEpsilon))
return static_cast<double>(altitudeDataM[prevPointIdx]);
double const k = (altitudeDataM[nextPointIdx] - altitudeDataM[prevPointIdx]) /
diff --git a/map/cloud.cpp b/map/cloud.cpp
index 8dda4fe597..c525b054c7 100644
--- a/map/cloud.cpp
+++ b/map/cloud.cpp
@@ -55,12 +55,12 @@ std::string const kSnapshotFile = "snapshot.json";
std::string GetIndexFilePath(std::string const & indexName)
{
- return my::JoinPath(GetPlatform().SettingsDir(), indexName);
+ return base::JoinPath(GetPlatform().SettingsDir(), indexName);
}
std::string GetRestoringFolder(std::string const & serverPathName)
{
- return my::JoinPath(GetPlatform().TmpDir(), serverPathName + "_restore");
+ return base::JoinPath(GetPlatform().TmpDir(), serverPathName + "_restore");
}
std::string BuildMethodUrl(std::string const & serverPathName, std::string const & methodName)
@@ -84,8 +84,8 @@ std::string BuildAuthenticationToken(std::string const & accessToken)
std::string ExtractFileNameWithoutExtension(std::string const & filePath)
{
std::string path = filePath;
- my::GetNameFromFullPath(path);
- my::GetNameWithoutExt(path);
+ base::GetNameFromFullPath(path);
+ base::GetNameWithoutExt(path);
return path;
}
@@ -270,7 +270,7 @@ void ParseRequestJsonResult(std::string const & url, std::string const & serverR
{
DeserializeFromJson(serverResponse, result.m_response);
}
- catch (my::Json::Exception const & exception)
+ catch (base::Json::Exception const & exception)
{
LOG(LWARNING, ("Malformed server response", "url:", url, "response:", serverResponse));
result.m_response = {};
@@ -325,7 +325,7 @@ Cloud::SnapshotResponseData ReadSnapshotFile(std::string const & filename)
DeserializeFromJson(jsonStr, data);
return data;
}
- catch (my::Json::Exception const & exception)
+ catch (base::Json::Exception const & exception)
{
LOG(LWARNING, ("Exception while parsing file:", filename,
"reason:", exception.what(), "json:", jsonStr));
@@ -335,7 +335,7 @@ Cloud::SnapshotResponseData ReadSnapshotFile(std::string const & filename)
bool CheckAndGetFileSize(std::string const & filePath, uint64_t & fileSize)
{
- if (!my::GetFileSize(filePath, fileSize))
+ if (!base::GetFileSize(filePath, fileSize))
return false;
// We do not work with files which size is more than kMaxUploadingFileSizeInBytes.
@@ -398,7 +398,7 @@ void Cloud::SetState(State state)
case State::Disabled:
// Delete index file and clear memory.
- my::DeleteFileX(GetIndexFilePath(m_params.m_indexName));
+ base::DeleteFileX(GetIndexFilePath(m_params.m_indexName));
m_index = Index();
break;
@@ -481,7 +481,7 @@ bool Cloud::ReadIndex()
std::lock_guard<std::mutex> lock(m_mutex);
std::swap(m_index, index);
}
- catch (my::Json::Exception const & exception)
+ catch (base::Json::Exception const & exception)
{
LOG(LWARNING, ("Exception while parsing file:", indexFilePath,
"reason:", exception.what(), "json:", jsonStr));
@@ -687,7 +687,7 @@ void Cloud::ScheduleUploadingTask(EntryPtr const & entry, uint32_t timeout)
auto const uploadedName = PrepareFileToUploading(entryName, hash);
auto deleteAfterUploading = [uploadedName]() {
if (!uploadedName.empty())
- my::DeleteFileX(uploadedName);
+ base::DeleteFileX(uploadedName);
};
MY_SCOPE_GUARD(deleteAfterUploadingGuard, deleteAfterUploading);
@@ -736,7 +736,7 @@ void Cloud::ScheduleUploadingTask(EntryPtr const & entry, uint32_t timeout)
bool Cloud::UploadFile(std::string const & uploadedName)
{
uint64_t uploadedFileSize = 0;
- if (!my::GetFileSize(uploadedName, uploadedFileSize))
+ if (!base::GetFileSize(uploadedName, uploadedFileSize))
{
FinishUploading(SynchronizationResult::DiskError, "File size calculation error");
return false;
@@ -832,11 +832,11 @@ std::string Cloud::PrepareFileToUploading(std::string const & fileName, std::str
// 3. Create a temporary file from the original uploading file.
auto name = ExtractFileNameWithoutExtension(filePath);
- auto const tmpPath = my::JoinFoldersToPath(GetPlatform().TmpDir(), name + ".tmp");
- if (!my::CopyFileX(filePath, tmpPath))
+ auto const tmpPath = base::JoinFoldersToPath(GetPlatform().TmpDir(), name + ".tmp");
+ if (!base::CopyFileX(filePath, tmpPath))
return {};
- MY_SCOPE_GUARD(tmpFileGuard, std::bind(&my::DeleteFileX, std::cref(tmpPath)));
+ MY_SCOPE_GUARD(tmpFileGuard, std::bind(&base::DeleteFileX, std::cref(tmpPath)));
// 4. Calculate SHA1 of the temporary file and compare with original one.
// Original file can be modified during copying process, so we have to
@@ -845,7 +845,7 @@ std::string Cloud::PrepareFileToUploading(std::string const & fileName, std::str
if (originalSha1 != tmpSha1)
return {};
- auto const outputPath = my::JoinFoldersToPath(GetPlatform().TmpDir(),
+ auto const outputPath = base::JoinFoldersToPath(GetPlatform().TmpDir(),
name + ".uploaded");
// 5. Convert temporary file and save to output path.
@@ -1297,7 +1297,7 @@ void Cloud::FinishRestoring(Cloud::SynchronizationResult result, std::string con
std::list<Cloud::SnapshotFileData> Cloud::GetDownloadingList(std::string const & restoringDirPath)
{
- auto const snapshotFile = my::JoinPath(restoringDirPath, kSnapshotFile);
+ auto const snapshotFile = base::JoinPath(restoringDirPath, kSnapshotFile);
auto const prevSnapshot = ReadSnapshotFile(snapshotFile);
SnapshotResponseData currentSnapshot;
@@ -1334,7 +1334,7 @@ std::list<Cloud::SnapshotFileData> Cloud::GetDownloadingList(std::string const &
std::list<Cloud::SnapshotFileData> result;
for (auto & f : currentSnapshot.m_files)
{
- auto const restoringFile = my::JoinPath(restoringDirPath, f.m_fileName);
+ auto const restoringFile = base::JoinPath(restoringDirPath, f.m_fileName);
if (!GetPlatform().IsFileExistsByFullPath(restoringFile))
{
result.push_back(std::move(f));
@@ -1342,7 +1342,7 @@ std::list<Cloud::SnapshotFileData> Cloud::GetDownloadingList(std::string const &
}
uint64_t fileSize = 0;
- if (!my::GetFileSize(restoringFile, fileSize) || fileSize != f.m_fileSize)
+ if (!base::GetFileSize(restoringFile, fileSize) || fileSize != f.m_fileSize)
result.push_back(std::move(f));
}
@@ -1372,7 +1372,7 @@ void Cloud::DownloadingTask(std::string const & dirPath, bool useFallbackUrl,
auto const f = files.front();
files.erase(files.begin());
- auto const filePath = my::JoinPath(dirPath, f.m_fileName);
+ auto const filePath = base::JoinPath(dirPath, f.m_fileName);
auto const url = BuildMethodUrl(m_params.m_serverPathName, kServerDownloadMethod);
auto const result = CloudRequestWithJsonResult<DownloadingRequestData, DownloadingResult>(
@@ -1460,7 +1460,7 @@ void Cloud::CompleteRestoring(std::string const & dirPath)
convertedFiles.reserve(currentSnapshot.m_files.size());
for (auto & f : currentSnapshot.m_files)
{
- auto const restoringFile = my::JoinPath(dirPath, f.m_fileName);
+ auto const restoringFile = base::JoinPath(dirPath, f.m_fileName);
if (!GetPlatform().IsFileExistsByFullPath(restoringFile))
{
FinishRestoring(SynchronizationResult::DiskError, "Restored file is absent");
@@ -1468,7 +1468,7 @@ void Cloud::CompleteRestoring(std::string const & dirPath)
}
uint64_t fileSize = 0;
- if (!my::GetFileSize(restoringFile, fileSize) || fileSize != f.m_fileSize)
+ if (!base::GetFileSize(restoringFile, fileSize) || fileSize != f.m_fileSize)
{
std::string const str = "Restored file has incorrect size. Expected size = " +
strings::to_string(f.m_fileSize) +
@@ -1478,7 +1478,7 @@ void Cloud::CompleteRestoring(std::string const & dirPath)
}
auto const fn = f.m_fileName + ".converted";
- auto const convertedFile = my::JoinPath(dirPath, fn);
+ auto const convertedFile = base::JoinPath(dirPath, fn);
auto const convertionResult = m_params.m_restoreConverter(restoringFile, convertedFile);
if (!convertionResult.m_isSuccessful)
{
@@ -1529,11 +1529,11 @@ void Cloud::ApplyRestoredFiles(std::string const & dirPath, RestoredFilesCollect
readyFiles.reserve(files.size());
for (auto const & f : files)
{
- auto const restoredFile = my::JoinPath(dirPath, f.m_filename);
+ auto const restoredFile = base::JoinPath(dirPath, f.m_filename);
auto const finalFilename =
- my::FilenameWithoutExt(f.m_filename) + m_params.m_restoredFileExtension;
- auto const readyFile = my::JoinPath(m_params.m_restoringFolder, finalFilename);
- if (!my::RenameFileX(restoredFile, readyFile))
+ base::FilenameWithoutExt(f.m_filename) + m_params.m_restoredFileExtension;
+ auto const readyFile = base::JoinPath(m_params.m_restoringFolder, finalFilename);
+ if (!base::RenameFileX(restoredFile, readyFile))
{
FinishRestoring(SynchronizationResult::DiskError, "Restored file moving error");
return;
diff --git a/map/extrapolation/extrapolator.cpp b/map/extrapolation/extrapolator.cpp
index e860e17c3a..1ed83841e0 100644
--- a/map/extrapolation/extrapolator.cpp
+++ b/map/extrapolation/extrapolator.cpp
@@ -63,9 +63,9 @@ location::GpsInfo LinearExtrapolation(location::GpsInfo const & gpsInfo1,
result.m_timestamp += static_cast<double>(timeAfterPoint2Ms) / 1000.0;
result.m_longitude =
- my::clamp(e.Extrapolate(gpsInfo1.m_longitude, gpsInfo2.m_longitude), -180.0, 180.0);
+ base::clamp(e.Extrapolate(gpsInfo1.m_longitude, gpsInfo2.m_longitude), -180.0, 180.0);
result.m_latitude =
- my::clamp(e.Extrapolate(gpsInfo1.m_latitude, gpsInfo2.m_latitude), -90.0, 90.0);
+ base::clamp(e.Extrapolate(gpsInfo1.m_latitude, gpsInfo2.m_latitude), -90.0, 90.0);
result.m_altitude = e.Extrapolate(gpsInfo1.m_altitude, gpsInfo2.m_altitude);
// @TODO(bykoianko) Now |result.m_bearing| == |gpsInfo2.m_bearing|.
diff --git a/map/framework.cpp b/map/framework.cpp
index 4fc6b6af22..6fd46ca17d 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1329,7 +1329,7 @@ void Framework::MemoryWarning()
void Framework::EnterBackground()
{
- m_startBackgroundTime = my::Timer::LocalTime();
+ m_startBackgroundTime = base::Timer::LocalTime();
settings::Set("LastEnterBackground", m_startBackgroundTime);
SaveViewport();
@@ -1354,7 +1354,7 @@ void Framework::EnterBackground()
void Framework::EnterForeground()
{
- m_startForegroundTime = my::Timer::LocalTime();
+ m_startForegroundTime = base::Timer::LocalTime();
if (m_drapeEngine != nullptr && m_startBackgroundTime != 0.0)
{
auto const timeInBackground = m_startForegroundTime - m_startBackgroundTime;
@@ -2426,7 +2426,7 @@ void Framework::PredictLocation(double & lat, double & lon, double accuracy,
double bearing, double speed, double elapsedSeconds)
{
double offsetInM = speed * elapsedSeconds;
- double angle = my::DegToRad(90.0 - bearing);
+ double angle = base::DegToRad(90.0 - bearing);
m2::PointD mercatorPt = MercatorBounds::MetresToXY(lon, lat, accuracy).Center();
mercatorPt = MercatorBounds::GetSmPoint(mercatorPt, offsetInM * cos(angle), offsetInM * sin(angle));
diff --git a/map/gps_track_storage.cpp b/map/gps_track_storage.cpp
index 8e9063b9b0..6bdabddfd4 100644
--- a/map/gps_track_storage.cpp
+++ b/map/gps_track_storage.cpp
@@ -295,8 +295,8 @@ void GpsTrackStorage::TruncFile()
m_stream.close();
// Replace file
- if (!my::DeleteFileX(m_filePath) ||
- !my::RenameFileX(tmpFilePath, m_filePath))
+ if (!base::DeleteFileX(m_filePath) ||
+ !base::RenameFileX(tmpFilePath, m_filePath))
{
MYTHROW(WriteException, ("File:", m_filePath));
}
diff --git a/map/gps_tracker.cpp b/map/gps_tracker.cpp
index 9e69e6010c..6ca9e44495 100644
--- a/map/gps_tracker.cpp
+++ b/map/gps_tracker.cpp
@@ -20,7 +20,7 @@ size_t constexpr kMaxItemCount = 100000; // > 24h with 1point/s
inline string GetFilePath()
{
- return my::JoinFoldersToPath(GetPlatform().WritableDir(), GPS_TRACK_FILENAME);
+ return base::JoinFoldersToPath(GetPlatform().WritableDir(), GPS_TRACK_FILENAME);
}
inline bool GetSettingsIsEnabled()
diff --git a/map/local_ads_manager.cpp b/map/local_ads_manager.cpp
index abe8a75c97..979f191fb4 100644
--- a/map/local_ads_manager.cpp
+++ b/map/local_ads_manager.cpp
@@ -69,7 +69,7 @@ void DeserializeCampaign(ReaderSource<FileReader> & src, std::string & countryNa
std::string GetPath(std::string const & fileName)
{
- return my::JoinFoldersToPath(GetPlatform().WritableDir(), fileName);
+ return base::JoinFoldersToPath(GetPlatform().WritableDir(), fileName);
}
std::string MakeCampaignDownloadingURL(MwmSet::MwmId const & mwmId)
diff --git a/map/map_tests/bookmarks_test.cpp b/map/map_tests/bookmarks_test.cpp
index daf67147be..49812bdbf4 100644
--- a/map/map_tests/bookmarks_test.cpp
+++ b/map/map_tests/bookmarks_test.cpp
@@ -162,8 +162,8 @@ void CheckBookmarks(BookmarkManager const & bmManager, kml::MarkGroupId groupId)
m2::PointD org = bm->GetPivot();
double const kEps = 1e-6;
- TEST(my::AlmostEqualAbs(MercatorBounds::XToLon(org.x), 27.566765, kEps), ());
- TEST(my::AlmostEqualAbs(MercatorBounds::YToLat(org.y), 53.900047, kEps), ());
+ TEST(base::AlmostEqualAbs(MercatorBounds::XToLon(org.x), 27.566765, kEps), ());
+ TEST(base::AlmostEqualAbs(MercatorBounds::YToLat(org.y), 53.900047, kEps), ());
TEST_EQUAL(kml::GetDefaultStr(bm->GetName()), "From: Минск, Минская область, Беларусь", ());
TEST_EQUAL(bm->GetColor(), kml::PredefinedColor::Blue, ());
TEST_EQUAL(bm->GetDescription(), "", ());
@@ -171,8 +171,8 @@ void CheckBookmarks(BookmarkManager const & bmManager, kml::MarkGroupId groupId)
bm = bmManager.GetBookmark(*it++);
org = bm->GetPivot();
- TEST(my::AlmostEqualAbs(MercatorBounds::XToLon(org.x), 27.551532, kEps), ());
- TEST(my::AlmostEqualAbs(MercatorBounds::YToLat(org.y), 53.89306, kEps), ());
+ TEST(base::AlmostEqualAbs(MercatorBounds::XToLon(org.x), 27.551532, kEps), ());
+ TEST(base::AlmostEqualAbs(MercatorBounds::YToLat(org.y), 53.89306, kEps), ());
TEST_EQUAL(kml::GetDefaultStr(bm->GetName()), "<MWM & Sons>", ());
TEST_EQUAL(bm->GetDescription(), "Amps & <brackets>", ());
TEST_EQUAL(kml::ToSecondsSinceEpoch(bm->GetTimeStamp()), 0, ());
@@ -210,7 +210,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
{
string const dir = BookmarkManager::GetActualBookmarksDirectory();
string const ext = BookmarkManager::IsMigrated() ? ".kmb" : BOOKMARKS_FILE_EXTENSION;
- string const fileName = my::JoinPath(dir, "UnitTestBookmarks" + ext);
+ string const fileName = base::JoinPath(dir, "UnitTestBookmarks" + ext);
User user;
BookmarkManager bmManager(user, (BookmarkManager::Callbacks(bmCallbacks)));
@@ -270,9 +270,9 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
TEST(bmManager.SaveBookmarkCategory(groupId3), ());
// old file shouldn't be deleted if we save bookmarks with new category name
uint64_t dummy;
- TEST(my::GetFileSize(fileName, dummy), ());
+ TEST(base::GetFileSize(fileName, dummy), ());
- TEST(my::DeleteFileX(fileName), ());
+ TEST(base::DeleteFileX(fileName), ());
}
namespace
@@ -282,7 +282,7 @@ namespace
string const path = BookmarkManager::GetActualBookmarksDirectory();
string const extension = BookmarkManager::IsMigrated() ? ".kmb" : BOOKMARKS_FILE_EXTENSION;
for (auto const & fileName : arrFiles)
- FileWriter::DeleteFileX(my::JoinPath(path, fileName + extension));
+ FileWriter::DeleteFileX(base::JoinPath(path, fileName + extension));
}
UserMark const * GetMark(Framework & fm, m2::PointD const & pt)
@@ -670,7 +670,7 @@ char const * kmlString3 =
return false;
if (b1.GetScale() != b2.GetScale())
return false;
- if (!my::AlmostEqualAbs(b1.GetPivot(), b2.GetPivot(), 1e-6 /* eps*/))
+ if (!base::AlmostEqualAbs(b1.GetPivot(), b2.GetPivot(), 1e-6 /* eps*/))
return false;
// do not check timestamp
@@ -706,7 +706,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_SpecialXMLNames)
auto const fileName = bmManager.GetCategoryFileName(catId);
auto const fileNameTmp = fileName + ".backup";
- TEST(my::CopyFileX(fileName, fileNameTmp), ());
+ TEST(base::CopyFileX(fileName, fileNameTmp), ());
bmManager.GetEditSession().DeleteBmCategory(catId);
@@ -734,7 +734,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_SpecialXMLNames)
TEST(EqualBookmarks(*bm1, *bm2), ());
TEST_EQUAL(kml::GetDefaultStr(bm1->GetName()), "![X1]{X2}(X3)", ());
- TEST(my::DeleteFileX(fileNameTmp), ());
+ TEST(base::DeleteFileX(fileNameTmp), ());
}
UNIT_CLASS_TEST(Runner, TrackParsingTest_1)
@@ -966,8 +966,8 @@ UNIT_CLASS_TEST(Runner, Bookmarks_AutoSave)
TEST_EQUAL(kmlData2->m_bookmarksData.size(), 1, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData2->m_bookmarksData.front().m_name), "name 3", ());
- TEST(my::DeleteFileX(fileName), ());
- TEST(my::DeleteFileX(fileName2), ());
+ TEST(base::DeleteFileX(fileName), ());
+ TEST(base::DeleteFileX(fileName2), ());
}
UNIT_CLASS_TEST(Runner, Bookmarks_BrokenFile)
diff --git a/map/map_tests/chart_generator_tests.cpp b/map/map_tests/chart_generator_tests.cpp
index 043ce76486..9e03d2bfbc 100644
--- a/map/map_tests/chart_generator_tests.cpp
+++ b/map/map_tests/chart_generator_tests.cpp
@@ -19,7 +19,7 @@ bool AlmostEqualAbs(vector<double> const & v1, vector<double> const & v2)
for (size_t i = 0; i < v1.size(); ++i)
{
- if (!my::AlmostEqualAbs(v1[i], v2[i], kEpsilon))
+ if (!base::AlmostEqualAbs(v1[i], v2[i], kEpsilon))
return false;
}
return true;
diff --git a/map/map_tests/extrapolator_tests.cpp b/map/map_tests/extrapolator_tests.cpp
index 6fce9625ef..4533323c47 100644
--- a/map/map_tests/extrapolator_tests.cpp
+++ b/map/map_tests/extrapolator_tests.cpp
@@ -15,14 +15,14 @@ void TestGpsInfo(GpsInfo const & tested, GpsInfo const & expected)
{
double constexpr kEpsilon = 1e-5;
TEST_EQUAL(tested.m_source, expected.m_source, ());
- TEST(my::AlmostEqualAbs(tested.m_latitude, expected.m_latitude, kEpsilon), ());
- TEST(my::AlmostEqualAbs(tested.m_longitude, expected.m_longitude, kEpsilon), ());
- TEST(my::AlmostEqualAbs(tested.m_horizontalAccuracy, expected.m_horizontalAccuracy, kEpsilon),
+ TEST(base::AlmostEqualAbs(tested.m_latitude, expected.m_latitude, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_longitude, expected.m_longitude, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_horizontalAccuracy, expected.m_horizontalAccuracy, kEpsilon),
());
- TEST(my::AlmostEqualAbs(tested.m_altitude, expected.m_altitude, kEpsilon), ());
- TEST(my::AlmostEqualAbs(tested.m_verticalAccuracy, expected.m_verticalAccuracy, kEpsilon), ());
- TEST(my::AlmostEqualAbs(tested.m_bearing, expected.m_bearing, kEpsilon), ());
- TEST(my::AlmostEqualAbs(tested.m_speedMpS, expected.m_speedMpS, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_altitude, expected.m_altitude, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_verticalAccuracy, expected.m_verticalAccuracy, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_bearing, expected.m_bearing, kEpsilon), ());
+ TEST(base::AlmostEqualAbs(tested.m_speedMpS, expected.m_speedMpS, kEpsilon), ());
}
GpsInfo GetGpsInfo(double timestampS, double lat, double lon, double altitude, double speed)
diff --git a/map/map_tests/gps_track_storage_test.cpp b/map/map_tests/gps_track_storage_test.cpp
index 9da8e2e07d..dd70cb17e3 100644
--- a/map/map_tests/gps_track_storage_test.cpp
+++ b/map/map_tests/gps_track_storage_test.cpp
@@ -30,7 +30,7 @@ location::GpsInfo Make(double timestamp, ms::LatLon const & ll, double speed)
inline string GetGpsTrackFilePath()
{
- return my::JoinFoldersToPath(GetPlatform().WritableDir(), "gpstrack_test.bin");
+ return base::JoinFoldersToPath(GetPlatform().WritableDir(), "gpstrack_test.bin");
}
} // namespace
diff --git a/map/map_tests/gps_track_test.cpp b/map/map_tests/gps_track_test.cpp
index 206264f3a6..93d3a754f2 100644
--- a/map/map_tests/gps_track_test.cpp
+++ b/map/map_tests/gps_track_test.cpp
@@ -32,7 +32,7 @@ inline location::GpsInfo Make(double timestamp, ms::LatLon const & ll, double sp
inline string GetGpsTrackFilePath()
{
- return my::JoinFoldersToPath(GetPlatform().WritableDir(), "gpstrack_test.bin");
+ return base::JoinFoldersToPath(GetPlatform().WritableDir(), "gpstrack_test.bin");
}
class GpsTrackCallback
diff --git a/map/map_tests/mwm_set_test.cpp b/map/map_tests/mwm_set_test.cpp
index 436d560949..b8e7fd0a92 100644
--- a/map/map_tests/mwm_set_test.cpp
+++ b/map/map_tests/mwm_set_test.cpp
@@ -11,9 +11,8 @@
#include <sys/stat.h>
#endif
-
+using namespace base;
using namespace platform;
-using namespace my;
/*
* This test is useless because of we don't build offsets index from now.
diff --git a/map/map_tests/mwm_url_tests.cpp b/map/map_tests/mwm_url_tests.cpp
index 9477fff791..965beec614 100644
--- a/map/map_tests/mwm_url_tests.cpp
+++ b/map/map_tests/mwm_url_tests.cpp
@@ -64,7 +64,7 @@ public:
bool TestLatLon(int index, double lat, double lon) const
{
ms::LatLon const ll = GetMark(index)->GetLatLon();
- return my::AlmostEqualULPs(ll.lat, lat) && my::AlmostEqualULPs(ll.lon, lon);
+ return base::AlmostEqualULPs(ll.lat, lat) && base::AlmostEqualULPs(ll.lon, lon);
}
bool TestRoutePoint(int index, double lat, double lon, string const & name)
diff --git a/map/map_tests/tips_tests.cpp b/map/map_tests/tips_tests.cpp
index 3885f999ca..e280a638a3 100644
--- a/map/map_tests/tips_tests.cpp
+++ b/map/map_tests/tips_tests.cpp
@@ -177,10 +177,10 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, ShowTipAndGotitClicked_Test)
UNIT_CLASS_TEST(ScopedEyeForTesting, ShowTipAfterWarmStart)
{
TipsApiDelegate d;
- d.SetLastBackgroundTime(my::Timer::LocalTime());
+ d.SetLastBackgroundTime(base::Timer::LocalTime());
auto tip = GetTipForTesting({}, TipsApi::GetShowSameTipPeriod(), d);
TEST(!tip.is_initialized(), ());
- d.SetLastBackgroundTime(my::Timer::LocalTime() - TipsApi::ShowTipAfterCollapsingPeriod().count());
+ d.SetLastBackgroundTime(base::Timer::LocalTime() - TipsApi::ShowTipAfterCollapsingPeriod().count());
tip = GetTipForTesting({}, TipsApi::GetShowSameTipPeriod(), d);
TEST(tip.is_initialized(), ());
}
diff --git a/map/osm_opening_hours.hpp b/map/osm_opening_hours.hpp
index c173dbd7ba..800954e8a3 100644
--- a/map/osm_opening_hours.hpp
+++ b/map/osm_opening_hours.hpp
@@ -4,7 +4,9 @@
#include "base/assert.hpp"
-#include "std/chrono.hpp"
+#include <chrono>
+#include <ctime>
+#include <string>
namespace osm
{
@@ -16,7 +18,7 @@ enum class EPlaceState
CloseSoon
};
-inline string DebugPrint(EPlaceState state)
+inline std::string DebugPrint(EPlaceState state)
{
switch (state)
{
@@ -32,12 +34,12 @@ inline string DebugPrint(EPlaceState state)
CHECK_SWITCH();
}
-inline EPlaceState PlaceStateCheck(string const & openingHours, time_t timestamp)
+inline EPlaceState PlaceStateCheck(std::string const & openingHours, time_t timestamp)
{
osmoh::OpeningHours oh(openingHours);
- auto future = system_clock::from_time_t(timestamp);
- future += minutes(15);
+ auto future = std::chrono::system_clock::from_time_t(timestamp);
+ future += std::chrono::minutes(15);
enum {OPEN = 0, CLOSED = 1};
@@ -49,7 +51,7 @@ inline EPlaceState PlaceStateCheck(string const & openingHours, time_t timestamp
if (oh.IsValid())
{
nowState = oh.IsOpen(timestamp) ? OPEN : CLOSED;
- futureState = oh.IsOpen(system_clock::to_time_t(future)) ? OPEN : CLOSED;
+ futureState = oh.IsOpen(std::chrono::system_clock::to_time_t(future)) ? OPEN : CLOSED;
}
EPlaceState state[2][2] = {{EPlaceState::Open, EPlaceState::CloseSoon},
diff --git a/map/routing_manager.cpp b/map/routing_manager.cpp
index 4dd5af1d88..511feab3b4 100644
--- a/map/routing_manager.cpp
+++ b/map/routing_manager.cpp
@@ -143,10 +143,10 @@ RouteMarkData DeserializeRoutePoint(json_t * node)
string SerializeRoutePoints(vector<RouteMarkData> const & points)
{
ASSERT_GREATER_OR_EQUAL(points.size(), 2, ());
- auto pointsNode = my::NewJSONArray();
+ auto pointsNode = base::NewJSONArray();
for (auto const & p : points)
{
- auto pointNode = my::NewJSONObject();
+ auto pointNode = base::NewJSONObject();
SerializeRoutePoint(pointNode.get(), p);
json_array_append_new(pointsNode.get(), pointNode.release());
}
@@ -159,7 +159,7 @@ vector<RouteMarkData> DeserializeRoutePoints(string const & data)
{
try
{
- my::Json root(data.c_str());
+ base::Json root(data.c_str());
if (root.get() == nullptr || !json_is_array(root.get()))
return {};
@@ -188,7 +188,7 @@ vector<RouteMarkData> DeserializeRoutePoints(string const & data)
return result;
}
- catch (my::Json::Exception const &)
+ catch (base::Json::Exception const &)
{
return {};
}
diff --git a/map/search_api.cpp b/map/search_api.cpp
index a28a3e978f..f9d52b34c8 100644
--- a/map/search_api.cpp
+++ b/map/search_api.cpp
@@ -181,7 +181,7 @@ bool SearchAPI::SearchEverywhere(EverywhereSearchParams const & params)
m_delegate.OnBookingFilterParamsUpdate(params.m_bookingFilterTasks);
LOG(LINFO, ("Search everywhere started."));
- my::Timer timer;
+ base::Timer timer;
MY_SCOPE_GUARD(printDuration, [&timer]() {
LOG(LINFO, ("Search everywhere ended. Time:", timer.ElapsedSeconds(), "seconds."));
});
diff --git a/map/search_mark.cpp b/map/search_mark.cpp
index 9e7f16800e..920b521bca 100644
--- a/map/search_mark.cpp
+++ b/map/search_mark.cpp
@@ -47,8 +47,8 @@ inline bool HasNoRating(float rating)
float CalculateAggregateMetric(float rating, int pricing)
{
- float const p1 = my::clamp(rating, 0.0f, 10.0f) / 10.0f;
- float const p2 = (3 - my::clamp(pricing, 0, 3)) / 3.0f;
+ float const p1 = base::clamp(rating, 0.0f, 10.0f) / 10.0f;
+ float const p2 = (3 - base::clamp(pricing, 0, 3)) / 3.0f;
float const s = p1 + p2;
if (fabs(s) < 1e-5)
return 0.0f;
diff --git a/map/tips_api.cpp b/map/tips_api.cpp
index 07a3a16941..40c938cf28 100644
--- a/map/tips_api.cpp
+++ b/map/tips_api.cpp
@@ -41,7 +41,7 @@ boost::optional<eye::Tip::Type> GetTipImpl(TipsApi::Duration showAnyTipPeriod,
if (lastBackgroundTime != 0.0)
{
auto const timeInBackground =
- static_cast<uint64_t>(my::Timer::LocalTime() - lastBackgroundTime);
+ static_cast<uint64_t>(base::Timer::LocalTime() - lastBackgroundTime);
if (timeInBackground < kShowTipAfterCollapsingPeriod.count())
return {};
}
diff --git a/map/user.cpp b/map/user.cpp
index 6465e044ba..8b32e25a96 100644
--- a/map/user.cpp
+++ b/map/user.cpp
@@ -107,7 +107,7 @@ std::string ReviewReceiverUrl()
std::string ParseAccessToken(std::string const & src)
{
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
std::string tokenStr;
FromJSONObject(root.get(), "access_token", tokenStr);
return tokenStr;
@@ -120,7 +120,7 @@ std::string BuildAuthorizationToken(std::string const & accessToken)
std::vector<uint64_t> DeserializeReviewIds(std::string const & reviewIdsSrc)
{
- my::Json root(reviewIdsSrc.c_str());
+ base::Json root(reviewIdsSrc.c_str());
if (json_array_size(root.get()) == 0)
return {};
@@ -134,7 +134,7 @@ std::vector<uint64_t> DeserializeReviewIds(std::string const & reviewIdsSrc)
FromJSON(item, result[i]);
}
}
- catch(my::Json::Exception const & ex)
+ catch(base::Json::Exception const & ex)
{
LOG(LWARNING, ("Review ids deserialization failed."));
return {};
diff --git a/metrics/eye_serdes.cpp b/metrics/eye_serdes.cpp
index 2851f13b53..c3a1b2f1e0 100644
--- a/metrics/eye_serdes.cpp
+++ b/metrics/eye_serdes.cpp
@@ -42,7 +42,7 @@ void Serdes::Deserialize(std::vector<int8_t> const & bytes, Info & result)
coding::DeserializerJson des(source);
des(result);
}
- catch (my::Json::Exception & ex)
+ catch (base::Json::Exception & ex)
{
LOG(LERROR, ("Cannot deserialize eye file. Exception:", ex.Msg(), "Version:", version,
"File content:", bytes));
diff --git a/metrics/eye_storage.cpp b/metrics/eye_storage.cpp
index e195fb15a6..b791ba1083 100644
--- a/metrics/eye_storage.cpp
+++ b/metrics/eye_storage.cpp
@@ -22,7 +22,7 @@ std::string Storage::GetEyeFilePath()
// static
bool Storage::Save(std::string const & filePath, std::vector<int8_t> const & src)
{
- return my::WriteToTempAndRenameToFile(filePath, [&src](string const & fileName)
+ return base::WriteToTempAndRenameToFile(filePath, [&src](string const & fileName)
{
try
{
diff --git a/metrics/metrics_tests_support/eye_for_testing.cpp b/metrics/metrics_tests_support/eye_for_testing.cpp
index 97c294ead1..782b15e142 100644
--- a/metrics/metrics_tests_support/eye_for_testing.cpp
+++ b/metrics/metrics_tests_support/eye_for_testing.cpp
@@ -16,8 +16,8 @@ void EyeForTesting::ResetEye()
auto const path = Storage::GetEyeFilePath();
uint64_t unused;
- if (my::GetFileSize(path, unused))
- my::DeleteFileX(path);
+ if (base::GetFileSize(path, unused))
+ base::DeleteFileX(path);
}
// static
diff --git a/openlr/candidate_paths_getter.cpp b/openlr/candidate_paths_getter.cpp
index 2f4ead930b..1c52021fd1 100644
--- a/openlr/candidate_paths_getter.cpp
+++ b/openlr/candidate_paths_getter.cpp
@@ -41,10 +41,10 @@ m2::PointD PointAtSegmentM(m2::PointD const & p1, m2::PointD const & p2, double
uint32_t Bearing(m2::PointD const & a, m2::PointD const & b)
{
- auto const angle = location::AngleToBearing(my::RadToDeg(ang::AngleTo(a, b)));
+ auto const angle = location::AngleToBearing(base::RadToDeg(ang::AngleTo(a, b)));
CHECK_LESS_OR_EQUAL(angle, 360, ("Angle should be less than or equal to 360."));
CHECK_GREATER_OR_EQUAL(angle, 0, ("Angle should be greater than or equal to 0"));
- return my::clamp(angle / kAnglesInBucket, 0.0, 255.0);
+ return base::clamp(angle / kAnglesInBucket, 0.0, 255.0);
}
// This class is used to get correct points for further bearing calculations.
diff --git a/openlr/openlr_decoder.cpp b/openlr/openlr_decoder.cpp
index 455b0ba829..c294ce94cb 100644
--- a/openlr/openlr_decoder.cpp
+++ b/openlr/openlr_decoder.cpp
@@ -345,10 +345,10 @@ size_t constexpr GetOptimalBatchSize()
{
// This code computes the most optimal (in the sense of cache lines
// occupancy) batch size.
- size_t constexpr a = my::LCM(sizeof(LinearSegment), kCacheLineSize) / sizeof(LinearSegment);
+ size_t constexpr a = base::LCM(sizeof(LinearSegment), kCacheLineSize) / sizeof(LinearSegment);
size_t constexpr b =
- my::LCM(sizeof(IRoadGraph::TEdgeVector), kCacheLineSize) / sizeof(IRoadGraph::TEdgeVector);
- return my::LCM(a, b);
+ base::LCM(sizeof(IRoadGraph::TEdgeVector), kCacheLineSize) / sizeof(IRoadGraph::TEdgeVector);
+ return base::LCM(a, b);
}
} // namespace
@@ -408,7 +408,7 @@ void OpenLRDecoder::Decode(vector<LinearSegment> const & segments,
size_t const numSegments = segments.size();
Decoder decoder(dataSource, make_unique<CarModelFactory>(m_countryParentNameGetter));
- my::Timer timer;
+ base::Timer timer;
for (size_t i = threadNum * kBatchSize; i < numSegments; i += numThreads * kBatchSize)
{
for (size_t j = i; j < numSegments && j < i + kBatchSize; ++j)
diff --git a/openlr/openlr_model_xml.cpp b/openlr/openlr_model_xml.cpp
index 9570becffb..ae7f9eecab 100644
--- a/openlr/openlr_model_xml.cpp
+++ b/openlr/openlr_model_xml.cpp
@@ -88,8 +88,8 @@ bool FirstCoordinateFromXML(pugi::xml_node const & node, ms::LatLon & latLon)
if (!GetLatLon(node.child("olr:coordinate"), lat, lon))
return false;
- latLon.lat = ((lat - my::Sign(lat) * 0.5) * 360) / (1 << 24);
- latLon.lon = ((lon - my::Sign(lon) * 0.5) * 360) / (1 << 24);
+ latLon.lat = ((lat - base::Sign(lat) * 0.5) * 360) / (1 << 24);
+ latLon.lon = ((lon - base::Sign(lon) * 0.5) * 360) / (1 << 24);
return true;
}
diff --git a/openlr/openlr_stat/openlr_stat.cpp b/openlr/openlr_stat/openlr_stat.cpp
index 4a94bd63db..3374402c20 100644
--- a/openlr/openlr_stat/openlr_stat.cpp
+++ b/openlr/openlr_stat/openlr_stat.cpp
@@ -73,10 +73,10 @@ void LoadDataSources(std::string const & pathToMWMFolder,
for (auto const & fileName : files)
{
- auto const fullFileName = my::JoinFoldersToPath({pathToMWMFolder}, fileName);
+ auto const fullFileName = base::JoinFoldersToPath({pathToMWMFolder}, fileName);
ModelReaderPtr reader(GetPlatform().GetReader(fullFileName, "f"));
platform::LocalCountryFile localFile(pathToMWMFolder,
- platform::CountryFile(my::FilenameWithoutExt(fileName)),
+ platform::CountryFile(base::FilenameWithoutExt(fileName)),
version::ReadVersionDate(reader));
LOG(LINFO, ("Found mwm:", fullFileName));
diff --git a/openlr/openlr_tests/decoded_path_test.cpp b/openlr/openlr_tests/decoded_path_test.cpp
index 7407064600..3a07f68a4f 100644
--- a/openlr/openlr_tests/decoded_path_test.cpp
+++ b/openlr/openlr_tests/decoded_path_test.cpp
@@ -121,11 +121,11 @@ void WithRoad(vector<m2::PointD> const & points, Func && fn)
classificator::Load();
auto & platform = GetPlatform();
- auto const mwmPath = my::JoinPath(platform.WritableDir(), kTestDir);
+ auto const mwmPath = base::JoinPath(platform.WritableDir(), kTestDir);
LocalCountryFile country(mwmPath, CountryFile(kTestMwm), 0 /* version */);
ScopedDir testScopedDir(kTestDir);
- ScopedFile testScopedMwm(my::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION),
+ ScopedFile testScopedMwm(base::JoinPath(kTestDir, kTestMwm + DATA_FILE_EXTENSION),
ScopedFile::Mode::Create);
{
diff --git a/openlr/router.cpp b/openlr/router.cpp
index b3e4095d58..5ec0c648fe 100644
--- a/openlr/router.cpp
+++ b/openlr/router.cpp
@@ -35,10 +35,10 @@ double const kAnglesInBucket = 360.0 / kNumBuckets;
uint32_t Bearing(m2::PointD const & a, m2::PointD const & b)
{
- auto const angle = location::AngleToBearing(my::RadToDeg(ang::AngleTo(a, b)));
+ auto const angle = location::AngleToBearing(base::RadToDeg(ang::AngleTo(a, b)));
CHECK_LESS_OR_EQUAL(angle, 360, ("Angle should be less than or equal to 360."));
CHECK_GREATER_OR_EQUAL(angle, 0, ("Angle should be greater than or equal to 0"));
- return my::clamp(angle / kAnglesInBucket, 0.0, 255.0);
+ return base::clamp(angle / kAnglesInBucket, 0.0, 255.0);
}
class Score final
@@ -80,7 +80,7 @@ public:
ASSERT_GREATER_OR_EQUAL(actual, 0, ());
int const diff = abs(expected - actual);
- double angle = my::DegToRad(min(diff, kNumBuckets - diff) * kAnglesInBucket);
+ double angle = base::DegToRad(min(diff, kNumBuckets - diff) * kAnglesInBucket);
m_penalty += kBearingErrorCoeff * angle * kBearingDist;
}
@@ -586,8 +586,8 @@ double Router::GetCoverage(m2::PointD const & u, m2::PointD const & v, It b, It
double const sp = DotProduct(uv, s - u) / sqlen;
double const tp = DotProduct(uv, t - u) / sqlen;
- double const start = my::clamp(min(sp, tp), 0.0, 1.0);
- double const finish = my::clamp(max(sp, tp), 0.0, 1.0);
+ double const start = base::clamp(min(sp, tp), 0.0, 1.0);
+ double const finish = base::clamp(max(sp, tp), 0.0, 1.0);
covs.emplace_back(start, finish);
}
@@ -645,7 +645,7 @@ double Router::GetMatchingScore(m2::PointD const & u, m2::PointD const & v, It b
cov += MercatorBounds::DistanceOnEarth(s, t);
}
- return len == 0 ? 0 : my::clamp(cov / len, 0.0, 1.0);
+ return len == 0 ? 0 : base::clamp(cov / len, 0.0, 1.0);
}
template <typename It, typename Fn>
diff --git a/partners_api/booking_api.cpp b/partners_api/booking_api.cpp
index ad94437cf3..56583812f5 100644
--- a/partners_api/booking_api.cpp
+++ b/partners_api/booking_api.cpp
@@ -210,7 +210,7 @@ vector<HotelReview> ParseReviews(json_t const * reviewsArray)
void FillHotelInfo(string const & src, HotelInfo & info)
{
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
FromJSONObjectOptionalField(root.get(), "description", info.m_description);
double score;
@@ -267,7 +267,7 @@ BlockInfo MakeBlock(json_t * src, string const & currency)
auto minPriceRoot = json_object_get(src, "min_price");
if (!json_is_object(minPriceRoot))
- MYTHROW(my::Json::Exception, ("The min_price must contain a json object."));
+ MYTHROW(base::Json::Exception, ("The min_price must contain a json object."));
FillPriceAndCurrency(minPriceRoot, currency, result);
@@ -317,13 +317,13 @@ BlockInfo MakeBlock(json_t * src, string const & currency)
void FillBlocks(string const & src, string const & currency, Blocks & blocks)
{
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
if (!json_is_object(root.get()))
- MYTHROW(my::Json::Exception, ("The answer must contain a json object."));
+ MYTHROW(base::Json::Exception, ("The answer must contain a json object."));
auto rootArray = json_object_get(root.get(), "result");
if (!json_is_array(rootArray))
- MYTHROW(my::Json::Exception, ("The \"result\" field must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The \"result\" field must contain a json array."));
size_t const rootSize = json_array_size(rootArray);
ASSERT_LESS(rootSize, 2, ("Several hotels is not supported in this method"));
@@ -332,11 +332,11 @@ void FillBlocks(string const & src, string const & currency, Blocks & blocks)
auto rootItem = json_array_get(rootArray, 0);
if (!json_is_object(rootItem))
- MYTHROW(my::Json::Exception, ("The root item must contain a json object."));
+ MYTHROW(base::Json::Exception, ("The root item must contain a json object."));
auto blocksArray = json_object_get(rootItem, "block");
if (!json_is_array(blocksArray))
- MYTHROW(my::Json::Exception, ("The \"block\" field must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The \"block\" field must contain a json array."));
size_t const blocksSize = json_array_size(blocksArray);
for (size_t i = 0; i < blocksSize; ++i)
@@ -344,7 +344,7 @@ void FillBlocks(string const & src, string const & currency, Blocks & blocks)
auto block = json_array_get(blocksArray, i);
if (!json_is_object(block))
- MYTHROW(my::Json::Exception, ("The block item must contain a json object."));
+ MYTHROW(base::Json::Exception, ("The block item must contain a json object."));
blocks.Add(MakeBlock(block, currency));
}
@@ -352,7 +352,7 @@ void FillBlocks(string const & src, string const & currency, Blocks & blocks)
void FillHotelIds(string const & src, vector<std::string> & ids)
{
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
auto const resultsArray = json_object_get(root.get(), "result");
auto const size = json_array_size(resultsArray);
@@ -512,7 +512,7 @@ void Api::GetBlockAvailability(BlockParams && params,
{
FillBlocks(httpResult, params.m_currency, blocks);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
blocks = {};
@@ -540,7 +540,7 @@ void Api::GetHotelInfo(string const & hotelId, string const & lang,
{
FillHotelInfo(result, info);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LINFO, ("Failed to parse json:", hotelId, result, e.what()));
ClearHotelInfo(info);
@@ -567,7 +567,7 @@ void Api::GetHotelAvailability(AvailabilityParams const & params,
{
FillHotelIds(httpResult, result);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
result.clear();
diff --git a/partners_api/locals_api.cpp b/partners_api/locals_api.cpp
index fd06b22dbd..f8bce6e258 100644
--- a/partners_api/locals_api.cpp
+++ b/partners_api/locals_api.cpp
@@ -24,7 +24,7 @@ void ParseError(std::string const & src, int & errorCode, std::string & message)
{
message.clear();
errorCode = 0;
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
FromJSONObject(root.get(), "code", errorCode);
FromJSONObject(root.get(), "message", message);
}
@@ -33,9 +33,9 @@ void ParseLocals(std::string const & src, std::vector<LocalExpert> & locals,
bool & hasPrevious, bool & hasNext)
{
locals.clear();
- my::Json root(src.c_str());
- auto previousField = my::GetJSONOptionalField(root.get(), "previous");
- auto nextField = my::GetJSONOptionalField(root.get(), "next");
+ base::Json root(src.c_str());
+ auto previousField = base::GetJSONOptionalField(root.get(), "previous");
+ auto nextField = base::GetJSONOptionalField(root.get(), "next");
hasPrevious = json_is_number(previousField);
hasNext = json_is_number(nextField);
auto const results = json_object_get(root.get(), "results");
@@ -117,7 +117,7 @@ uint64_t Api::GetLocals(double lat, double lon, std::string const & lang,
LOG(LWARNING, ("Locals request failed:", errorCode, errorMessage));
return errorFn(id, errorCode, errorMessage);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LWARNING, ("Unknown error:", e.Msg(), ", response:", result));
return errorFn(id, kUnknownErrorCode, "Unknown error: " + e.Msg());
@@ -131,7 +131,7 @@ uint64_t Api::GetLocals(double lat, double lon, std::string const & lang,
{
ParseLocals(result, locals, hasPreviousPage, hasNextPage);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LWARNING, ("Locals response parsing failed:", e.Msg(), ", response:", result));
errorFn(id, kUnknownErrorCode, "Response parsing failed: " + e.Msg());
diff --git a/partners_api/maxim_api.cpp b/partners_api/maxim_api.cpp
index ec7e05f2c1..68488b0c2a 100644
--- a/partners_api/maxim_api.cpp
+++ b/partners_api/maxim_api.cpp
@@ -78,7 +78,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
{
MakeFromJson(result, products);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.what(), result));
products.clear();
@@ -116,7 +116,7 @@ void MakeFromJson(std::string const & src, std::vector<taxi::Product> & products
{
products.clear();
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
if (!json_is_object(root.get()))
return;
diff --git a/partners_api/partners_api_tests/rutaxi_tests.cpp b/partners_api/partners_api_tests/rutaxi_tests.cpp
index aca011d121..1bce6e6f9b 100644
--- a/partners_api/partners_api_tests/rutaxi_tests.cpp
+++ b/partners_api/partners_api_tests/rutaxi_tests.cpp
@@ -45,7 +45,7 @@ UNIT_TEST(RuTaxi_GetNearObject)
TEST(!result.empty(), ());
LOG(LINFO, (result));
- my::Json root(result.c_str());
+ base::Json root(result.c_str());
TEST(json_is_object(root.get()), ());
@@ -64,7 +64,7 @@ UNIT_TEST(RuTaxi_GetCost)
TEST(!result.empty(), ());
LOG(LINFO, (result));
- my::Json root(result.c_str());
+ base::Json root(result.c_str());
TEST(json_is_object(root.get()), ());
diff --git a/partners_api/partners_api_tests/uber_tests.cpp b/partners_api/partners_api_tests/uber_tests.cpp
index d7ddf11471..51cdc9919a 100644
--- a/partners_api/partners_api_tests/uber_tests.cpp
+++ b/partners_api/partners_api_tests/uber_tests.cpp
@@ -41,7 +41,7 @@ UNIT_TEST(Uber_GetTimes)
TEST(uber::RawApi::GetEstimatedTime(pos, result), ());
TEST(!result.empty(), ());
- my::Json timeRoot(result.c_str());
+ base::Json timeRoot(result.c_str());
auto const timesArray = json_object_get(timeRoot.get(), "times");
TEST(json_is_array(timesArray), ());
@@ -59,7 +59,7 @@ UNIT_TEST(Uber_GetTimes)
FromJSONObject(item, "display_name", name);
FromJSONObject(item, "estimate", estimatedTime);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
TEST(false, (e.Msg()));
}
@@ -80,7 +80,7 @@ UNIT_TEST(Uber_GetPrices)
TEST(uber::RawApi::GetEstimatedPrice(from, to, result), ());
TEST(!result.empty(), ());
- my::Json priceRoot(result.c_str());
+ base::Json priceRoot(result.c_str());
auto const pricesArray = json_object_get(priceRoot.get(), "prices");
TEST(json_is_array(pricesArray), ());
@@ -109,7 +109,7 @@ UNIT_TEST(Uber_GetPrices)
currency = "null";
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
TEST(false, (e.Msg()));
}
diff --git a/partners_api/rutaxi_api.cpp b/partners_api/rutaxi_api.cpp
index fc617c7349..e9a65c2b04 100644
--- a/partners_api/rutaxi_api.cpp
+++ b/partners_api/rutaxi_api.cpp
@@ -120,7 +120,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
{
MakeNearObject(httpResult, dst);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
errorFn(ErrorCode::NoProducts);
LOG(LERROR, (e.what(), httpResult));
@@ -148,7 +148,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
{
MakeProducts(result, fromObj, toObj, city, products);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.what(), result));
products.clear();
@@ -170,7 +170,7 @@ RideRequestLinks Api::GetRideRequestLinks(std::string const & productId, ms::Lat
void MakeNearObject(std::string const & src, Object & dst)
{
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
auto const data = json_object_get(root.get(), "data");
auto const objects = json_object_get(data, "objects");
@@ -186,7 +186,7 @@ void MakeProducts(std::string const & src, Object const & from, Object const & t
{
products.clear();
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
std::ostringstream productStream;
productStream << "city=" << city.m_id << "&title1=" << UrlEncode(from.m_title)
@@ -231,7 +231,7 @@ CityMapping LoadCityMapping()
try
{
- my::Json root(fileData.c_str());
+ base::Json root(fileData.c_str());
auto const count = json_array_size(root.get());
std::string osmName;
@@ -248,7 +248,7 @@ CityMapping LoadCityMapping()
result.emplace(osmName, city);
}
}
- catch (my::Json::Exception const & ex)
+ catch (base::Json::Exception const & ex)
{
LOG(LWARNING, ("Exception while parsing file:", kMappingFilepath, "reason:", ex.what(),
"json:", fileData));
diff --git a/partners_api/taxi_places_loader.cpp b/partners_api/taxi_places_loader.cpp
index 07f40d5db0..f51d7bedc0 100644
--- a/partners_api/taxi_places_loader.cpp
+++ b/partners_api/taxi_places_loader.cpp
@@ -36,7 +36,7 @@ SupportedPlaces Loader::LoadFor(Provider::Type const type)
coding::DeserializerJson des(fileData);
des(places);
}
- catch (my::Json::Exception const & ex)
+ catch (base::Json::Exception const & ex)
{
LOG(LWARNING,
("Exception while parsing file:", filename, "reason:", ex.what(), "json:", fileData));
diff --git a/partners_api/uber_api.cpp b/partners_api/uber_api.cpp
index 11dbb3ca16..a90d7e5887 100644
--- a/partners_api/uber_api.cpp
+++ b/partners_api/uber_api.cpp
@@ -100,8 +100,8 @@ void MakeFromJson(char const * times, char const * prices, vector<taxi::Product>
products.clear();
try
{
- my::Json timesRoot(times);
- my::Json pricesRoot(prices);
+ base::Json timesRoot(times);
+ base::Json pricesRoot(prices);
auto const timesArray = json_object_get(timesRoot.get(), "times");
auto const pricesArray = json_object_get(pricesRoot.get(), "prices");
if (CheckUberResponse(timesArray) && CheckUberResponse(pricesArray))
@@ -109,7 +109,7 @@ void MakeFromJson(char const * times, char const * prices, vector<taxi::Product>
FillProducts(timesArray, pricesArray, products);
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
products.clear();
diff --git a/partners_api/viator_api.cpp b/partners_api/viator_api.cpp
index ee6e208bd0..26a0d66897 100644
--- a/partners_api/viator_api.cpp
+++ b/partners_api/viator_api.cpp
@@ -123,7 +123,7 @@ std::string MakeUrl(std::string const & apiMethod)
return os.str();
}
-bool CheckAnswer(my::Json const & root)
+bool CheckAnswer(base::Json const & root)
{
bool success;
FromJSONObjectOptionalField(root.get(), "success", success);
@@ -146,7 +146,7 @@ void MakeProducts(std::string const & src, std::vector<Product> & products)
{
products.clear();
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
auto const data = json_object_get(root.get(), "data");
if (!CheckAnswer(root) || !json_array_size(data))
return;
@@ -214,7 +214,7 @@ void Api::GetTop5Products(std::string const & destId, std::string const & curren
{
MakeProducts(result, products);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
products.clear();
diff --git a/partners_api/yandex_api.cpp b/partners_api/yandex_api.cpp
index 1fdbdd0c15..0cec103a17 100644
--- a/partners_api/yandex_api.cpp
+++ b/partners_api/yandex_api.cpp
@@ -97,7 +97,7 @@ void Api::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const & to,
{
MakeFromJson(result, products);
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
products.clear();
@@ -135,7 +135,7 @@ void MakeFromJson(std::string const & src, std::vector<taxi::Product> & products
{
products.clear();
- my::Json root(src.c_str());
+ base::Json root(src.c_str());
auto const productsArray = json_object_get(root.get(), "options");
if (!CheckYandexResponse(productsArray))
return;
diff --git a/platform/file_logging.cpp b/platform/file_logging.cpp
index 04a57f0b0e..2c91137f13 100644
--- a/platform/file_logging.cpp
+++ b/platform/file_logging.cpp
@@ -20,7 +20,7 @@ namespace
}
}
-void LogMessageFile(my::LogLevel level, my::SrcPoint const & srcPoint, string const & msg)
+void LogMessageFile(base::LogLevel level, base::SrcPoint const & srcPoint, string const & msg)
{
static mutex mtx;
static unique_ptr<FileWriter> file;
diff --git a/platform/file_logging.hpp b/platform/file_logging.hpp
index df716ae16d..3465332ae4 100644
--- a/platform/file_logging.hpp
+++ b/platform/file_logging.hpp
@@ -19,7 +19,7 @@
// # define OMIM_ENABLE_LOG_MEMORY_INFO
// #endif
-void LogMessageFile(my::LogLevel level, my::SrcPoint const & srcPoint, string const & msg);
+void LogMessageFile(base::LogLevel level, base::SrcPoint const & srcPoint, string const & msg);
void LogMemoryInfo();
#ifdef OMIM_ENABLE_LOG_MEMORY_INFO
diff --git a/platform/get_text_by_id.cpp b/platform/get_text_by_id.cpp
index 68d1709aa1..4d5e44053c 100644
--- a/platform/get_text_by_id.cpp
+++ b/platform/get_text_by_id.cpp
@@ -34,7 +34,7 @@ namespace platform
{
bool GetJsonBuffer(platform::TextSource textSource, string const & localeName, string & jsonBuffer)
{
- string const pathToJson = my::JoinFoldersToPath(
+ string const pathToJson = base::JoinFoldersToPath(
{GetTextSourceString(textSource), localeName + ".json"}, "localize.json");
try
@@ -94,7 +94,7 @@ void GetTextById::InitFromJson(string const & jsonBuffer)
return;
}
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
if (root.get() == nullptr)
{
ASSERT(false, ("Cannot parse the json file."));
diff --git a/platform/http_request.cpp b/platform/http_request.cpp
index 6ad7bd893f..f1895c05f1 100644
--- a/platform/http_request.cpp
+++ b/platform/http_request.cpp
@@ -269,12 +269,12 @@ class FileHttpRequest : public HttpRequest, public IHttpThreadCallback
// 3. Clean up resume file with chunks range on success
if (m_status == Status::Completed)
{
- my::DeleteFileX(m_filePath + RESUME_FILE_EXTENSION);
+ base::DeleteFileX(m_filePath + RESUME_FILE_EXTENSION);
// Rename finished file to it's original name.
if (Platform::IsFileExistsByFullPath(m_filePath))
- my::DeleteFileX(m_filePath);
- CHECK(my::RenameFileX(m_filePath + DOWNLOADING_FILE_EXTENSION, m_filePath),
+ base::DeleteFileX(m_filePath);
+ CHECK(base::RenameFileX(m_filePath + DOWNLOADING_FILE_EXTENSION, m_filePath),
(m_filePath, strerror(errno)));
Platform::DisableBackupForFile(m_filePath);
@@ -317,7 +317,7 @@ public:
{
// Check that resume information is correct with existing file.
uint64_t size;
- if (my::GetFileSize(filePath + DOWNLOADING_FILE_EXTENSION, size) &&
+ if (base::GetFileSize(filePath + DOWNLOADING_FILE_EXTENSION, size) &&
size <= static_cast<uint64_t>(fileSize))
openMode = FileWriter::OP_WRITE_EXISTING;
else
@@ -353,8 +353,8 @@ public:
if (m_doCleanProgressFiles)
{
- my::DeleteFileX(m_filePath + DOWNLOADING_FILE_EXTENSION);
- my::DeleteFileX(m_filePath + RESUME_FILE_EXTENSION);
+ base::DeleteFileX(m_filePath + DOWNLOADING_FILE_EXTENSION);
+ base::DeleteFileX(m_filePath + RESUME_FILE_EXTENSION);
}
}
}
diff --git a/platform/local_country_file.cpp b/platform/local_country_file.cpp
index 40a63fe105..44a7505196 100644
--- a/platform/local_country_file.cpp
+++ b/platform/local_country_file.cpp
@@ -65,7 +65,7 @@ void LocalCountryFile::DeleteFromDisk(MapOptions files) const
{
if (OnDisk(file) && HasOptions(files, file))
{
- if (!my::DeleteFileX(GetPath(file)))
+ if (!base::DeleteFileX(GetPath(file)))
LOG(LERROR, (file, "from", *this, "wasn't deleted from disk."));
}
}
@@ -73,7 +73,7 @@ void LocalCountryFile::DeleteFromDisk(MapOptions files) const
string LocalCountryFile::GetPath(MapOptions file) const
{
- return my::JoinFoldersToPath(m_directory, GetFileName(m_countryFile.GetName(), file, GetVersion()));
+ return base::JoinFoldersToPath(m_directory, GetFileName(m_countryFile.GetName(), file, GetVersion()));
}
uint64_t LocalCountryFile::GetSize(MapOptions filesMask) const
@@ -119,10 +119,10 @@ LocalCountryFile LocalCountryFile::MakeForTesting(string const & countryFileName
LocalCountryFile LocalCountryFile::MakeTemporary(string const & fullPath)
{
string name = fullPath;
- my::GetNameFromFullPath(name);
- my::GetNameWithoutExt(name);
+ base::GetNameFromFullPath(name);
+ base::GetNameWithoutExt(name);
- return LocalCountryFile(my::GetDirectory(fullPath), CountryFile(name), 0 /* version */);
+ return LocalCountryFile(base::GetDirectory(fullPath), CountryFile(name), 0 /* version */);
}
diff --git a/platform/local_country_file_utils.cpp b/platform/local_country_file_utils.cpp
index 2afaf2f204..a7d11b8104 100644
--- a/platform/local_country_file_utils.cpp
+++ b/platform/local_country_file_utils.cpp
@@ -105,7 +105,7 @@ inline string GetDataDirFullPath(string const & dataDir)
{
Platform & platform = GetPlatform();
return dataDir.empty() ? platform.WritableDir()
- : my::JoinFoldersToPath(platform.WritableDir(), dataDir);
+ : base::JoinFoldersToPath(platform.WritableDir(), dataDir);
}
void FindAllDiffsInDirectory(string const & dir, vector<LocalCountryFile> & diffs)
@@ -126,10 +126,10 @@ void FindAllDiffsInDirectory(string const & dir, vector<LocalCountryFile> & diff
if (!isDiff && !isDiffReady)
continue;
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
if (isDiffReady)
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
LocalCountryFile localDiff(dir, CountryFile(name), 0 /* version */);
@@ -150,9 +150,9 @@ void DeleteDownloaderFilesForCountry(int64_t version, string const & dataDir,
{
string const path = GetFileDownloadPath(version, dataDir, countryFile, file);
ASSERT(strings::EndsWith(path, READY_FILE_EXTENSION), ());
- my::DeleteFileX(path);
- my::DeleteFileX(path + RESUME_FILE_EXTENSION);
- my::DeleteFileX(path + DOWNLOADING_FILE_EXTENSION);
+ base::DeleteFileX(path);
+ base::DeleteFileX(path + RESUME_FILE_EXTENSION);
+ base::DeleteFileX(path + DOWNLOADING_FILE_EXTENSION);
}
}
@@ -177,7 +177,7 @@ void FindAllLocalMapsInDirectoryAndCleanup(string const & directory, int64_t ver
// Remove downloader and diff files for old version directories.
if (version < latestVersion && (IsDownloaderFile(name) || IsDiffFile(name)))
{
- my::DeleteFileX(my::JoinFoldersToPath(directory, name));
+ base::DeleteFileX(base::JoinFoldersToPath(directory, name));
continue;
}
@@ -185,7 +185,7 @@ void FindAllLocalMapsInDirectoryAndCleanup(string const & directory, int64_t ver
continue;
// Remove DATA_FILE_EXTENSION and use base name as a country file name.
- my::GetNameWithoutExt(name);
+ base::GetNameWithoutExt(name);
names.insert(name);
LocalCountryFile localFile(directory, CountryFile(name), version);
@@ -211,7 +211,7 @@ void FindAllLocalMapsInDirectoryAndCleanup(string const & directory, int64_t ver
if (IsSpecialName(name))
continue;
- if (names.count(name) == 0 && DirectoryHasIndexesOnly(my::JoinFoldersToPath(directory, name)))
+ if (names.count(name) == 0 && DirectoryHasIndexesOnly(base::JoinFoldersToPath(directory, name)))
{
// Directory which looks like a directory with indexes for absent country. It's OK to remove
// it.
@@ -230,7 +230,7 @@ void FindAllDiffs(string const & dataDir, vector<LocalCountryFile> & diffs)
Platform::GetFilesByType(dir, Platform::FILE_TYPE_DIRECTORY, fwts);
for (auto const & fwt : fwts)
- FindAllDiffsInDirectory(my::JoinFoldersToPath(dir, fwt.first /* subdir */), diffs);
+ FindAllDiffsInDirectory(base::JoinFoldersToPath(dir, fwt.first /* subdir */), diffs);
}
void FindAllLocalMapsAndCleanup(int64_t latestVersion, vector<LocalCountryFile> & localFiles)
@@ -253,7 +253,7 @@ void FindAllLocalMapsAndCleanup(int64_t latestVersion, string const & dataDir,
if (!ParseVersion(subdir, version) || version > latestVersion)
continue;
- string const fullPath = my::JoinFoldersToPath(dir, subdir);
+ string const fullPath = base::JoinFoldersToPath(dir, subdir);
FindAllLocalMapsInDirectoryAndCleanup(fullPath, version, latestVersion, localFiles);
Platform::EError err = Platform::RmDir(fullPath);
if (err != Platform::ERR_OK && err != Platform::ERR_DIRECTORY_NOT_EMPTY)
@@ -334,7 +334,7 @@ shared_ptr<LocalCountryFile> PreparePlaceForCountryFiles(int64_t version, string
string const dir = GetDataDirFullPath(dataDir);
if (version == 0)
return make_shared<LocalCountryFile>(dir, countryFile, version);
- string const directory = my::JoinFoldersToPath(dir, strings::to_string(version));
+ string const directory = base::JoinFoldersToPath(dir, strings::to_string(version));
if (!Platform::MkDirChecked(directory))
return shared_ptr<LocalCountryFile>();
return make_shared<LocalCountryFile>(directory, countryFile, version);
@@ -351,8 +351,8 @@ string GetFileDownloadPath(int64_t version, string const & dataDir,
string const readyFile = GetFileName(countryFile.GetName(), options, version) + READY_FILE_EXTENSION;
string const dir = GetDataDirFullPath(dataDir);
if (version == 0)
- return my::JoinFoldersToPath(dir, readyFile);
- return my::JoinFoldersToPath({dir, strings::to_string(version)}, readyFile);
+ return base::JoinFoldersToPath(dir, readyFile);
+ return base::JoinFoldersToPath({dir, strings::to_string(version)}, readyFile);
}
unique_ptr<ModelReader> GetCountryReader(platform::LocalCountryFile const & file, MapOptions options)
@@ -384,7 +384,7 @@ bool CountryIndexes::DeleteFromDisk(LocalCountryFile const & localFile)
for (auto index : {Index::Bits, Index::Nodes, Index::Offsets})
{
string const path = GetPath(localFile, index);
- if (Platform::IsFileExistsByFullPath(path) && !my::DeleteFileX(path))
+ if (Platform::IsFileExistsByFullPath(path) && !base::DeleteFileX(path))
{
LOG(LWARNING, ("Can't remove country index:", path));
ok = false;
@@ -416,7 +416,7 @@ string CountryIndexes::GetPath(LocalCountryFile const & localFile, Index index)
ext = kOffsetsExt;
break;
}
- return my::JoinFoldersToPath(IndexesDir(localFile), localFile.GetCountryName() + ext);
+ return base::JoinFoldersToPath(IndexesDir(localFile), localFile.GetCountryName() + ext);
}
// static
@@ -448,12 +448,12 @@ string CountryIndexes::IndexesDir(LocalCountryFile const & localFile)
int64_t const version = localFile.GetVersion();
ASSERT_GREATER(version, 0, ());
- dir = my::JoinFoldersToPath(GetPlatform().WritableDir(), strings::to_string(version));
+ dir = base::JoinFoldersToPath(GetPlatform().WritableDir(), strings::to_string(version));
if (!Platform::MkDirChecked(dir))
MYTHROW(FileSystemException, ("Can't create directory", dir));
}
- return my::JoinFoldersToPath(dir, file.GetName());
+ return base::JoinFoldersToPath(dir, file.GetName());
}
string DebugPrint(CountryIndexes::Index index)
diff --git a/platform/measurement_utils.cpp b/platform/measurement_utils.cpp
index 9e5934fec1..8c7b70ca73 100644
--- a/platform/measurement_utils.cpp
+++ b/platform/measurement_utils.cpp
@@ -69,7 +69,7 @@ bool FormatDistance(double m, string & res)
string FormatLatLonAsDMSImpl(double value, char positive, char negative, int dac)
{
- using namespace my;
+ using namespace base;
ostringstream sstream;
sstream << setfill('0');
@@ -97,7 +97,7 @@ string FormatLatLonAsDMSImpl(double value, char positive, char negative, int dac
sstream << "″";
// This condition is too heavy for production purposes (but more correct).
- //if (my::rounds(value * 3600.0 * pow(10, dac)) != 0)
+ //if (base::rounds(value * 3600.0 * pow(10, dac)) != 0)
if (!AlmostEqualULPs(value, 0.0))
{
char postfix = positive;
diff --git a/platform/mwm_version.cpp b/platform/mwm_version.cpp
index 47f3391382..bf49d38cd8 100644
--- a/platform/mwm_version.cpp
+++ b/platform/mwm_version.cpp
@@ -45,7 +45,7 @@ uint64_t VersionToSecondsSinceEpoch(uint64_t version)
tm.tm_mon = parts[1] - 1;
tm.tm_mday = parts[2];
- return my::TimeTToSecondsSinceEpoch(base::TimeGM(tm));
+ return base::TimeTToSecondsSinceEpoch(base::TimeGM(tm));
}
char const MWM_PROLOG[] = "MWM";
@@ -76,13 +76,13 @@ void ReadVersionT(TSource & src, MwmVersion & version)
uint32_t MwmVersion::GetVersion() const
{
- auto const tm = my::GmTime(my::SecondsSinceEpochToTimeT(m_secondsSinceEpoch));
- return my::GenerateYYMMDD(tm.tm_year, tm.tm_mon, tm.tm_mday);
+ auto const tm = base::GmTime(base::SecondsSinceEpochToTimeT(m_secondsSinceEpoch));
+ return base::GenerateYYMMDD(tm.tm_year, tm.tm_mon, tm.tm_mday);
}
bool MwmVersion::IsEditableMap() const
{
- return m_secondsSinceEpoch + kMaxSecondsTillNoEdits > my::SecondsSinceEpoch();
+ return m_secondsSinceEpoch + kMaxSecondsTillNoEdits > base::SecondsSinceEpoch();
}
string DebugPrint(Format f)
diff --git a/platform/platform.cpp b/platform/platform.cpp
index 3f2edf3d36..516acf0808 100644
--- a/platform/platform.cpp
+++ b/platform/platform.cpp
@@ -77,7 +77,7 @@ bool Platform::RmDirRecursively(string const & dirName)
GetFilesByRegExp(dirName, ".*", allFiles);
for (string const & file : allFiles)
{
- string const path = my::JoinFoldersToPath(dirName, file);
+ string const path = base::JoinFoldersToPath(dirName, file);
EFileType type;
if (GetFileType(path, type) != ERR_OK)
@@ -90,7 +90,7 @@ bool Platform::RmDirRecursively(string const & dirName)
}
else
{
- if (!my::DeleteFileX(path))
+ if (!base::DeleteFileX(path))
res = false;
}
}
@@ -103,7 +103,7 @@ bool Platform::RmDirRecursively(string const & dirName)
void Platform::SetSettingsDir(string const & path)
{
- m_settingsDir = my::AddSlashIfNeeded(path);
+ m_settingsDir = base::AddSlashIfNeeded(path);
}
string Platform::ReadPathForFile(string const & file, string searchScope) const
@@ -186,7 +186,7 @@ void Platform::GetFilesByType(string const & directory, unsigned typeMask,
for (string const & file : allFiles)
{
EFileType type;
- if (GetFileType(my::JoinFoldersToPath(directory, file), type) != ERR_OK)
+ if (GetFileType(base::JoinFoldersToPath(directory, file), type) != ERR_OK)
continue;
if (typeMask & type)
outFiles.emplace_back(file, type);
@@ -212,7 +212,7 @@ void Platform::GetFilesRecursively(string const & directory, FilesList & filesLi
{
auto const & file = p.first;
CHECK_EQUAL(p.second, Platform::FILE_TYPE_REGULAR, ("dir:", directory, "file:", file));
- filesList.push_back(my::JoinPath(directory, file));
+ filesList.push_back(base::JoinPath(directory, file));
}
TFilesWithType subdirs;
@@ -225,18 +225,18 @@ void Platform::GetFilesRecursively(string const & directory, FilesList & filesLi
if (subdir == "." || subdir == "..")
continue;
- GetFilesRecursively(my::JoinPath(directory, subdir), filesList);
+ GetFilesRecursively(base::JoinPath(directory, subdir), filesList);
}
}
void Platform::SetWritableDirForTests(string const & path)
{
- m_writableDir = my::AddSlashIfNeeded(path);
+ m_writableDir = base::AddSlashIfNeeded(path);
}
void Platform::SetResourceDir(string const & path)
{
- m_resourcesDir = my::AddSlashIfNeeded(path);
+ m_resourcesDir = base::AddSlashIfNeeded(path);
}
// static
diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp
index dc19c31d78..659a450f4e 100644
--- a/platform/platform_android.cpp
+++ b/platform/platform_android.cpp
@@ -94,7 +94,7 @@ public:
unique_ptr<ModelReader> Platform::GetReader(string const & file, string const & searchScope) const
{
- string const ext = my::GetFileExtension(file);
+ string const ext = base::GetFileExtension(file);
ASSERT(!ext.empty(), ());
uint32_t const logPageSize = (ext == DATA_FILE_EXTENSION) ? READER_CHUNK_LOG_SIZE : 10;
diff --git a/platform/platform_linux.cpp b/platform/platform_linux.cpp
index 91895da355..0949ba598a 100644
--- a/platform/platform_linux.cpp
+++ b/platform/platform_linux.cpp
@@ -43,10 +43,10 @@ bool GetBinaryDir(string & outPath)
// Returns true if EULA file exists in directory.
bool IsEulaExist(string const & directory)
{
- return Platform::IsFileExistsByFullPath(my::JoinPath(directory, "eula.html"));
+ return Platform::IsFileExistsByFullPath(base::JoinPath(directory, "eula.html"));
}
-// Makes my::JoinPath(path, dirs) and all intermediate dirs.
+// Makes base::JoinPath(path, dirs) and all intermediate dirs.
// The directory |path| is assumed to exist already.
bool MkDirsChecked(string path, initializer_list<string> const & dirs)
{
@@ -56,7 +56,7 @@ bool MkDirsChecked(string path, initializer_list<string> const & dirs)
bool ok = true;
for (auto const & dir : dirs)
{
- accumulatedDirs = my::JoinPath(accumulatedDirs, dir);
+ accumulatedDirs = base::JoinPath(accumulatedDirs, dir);
auto const result = Platform::MkDir(accumulatedDirs);
switch (result)
{
@@ -97,7 +97,7 @@ string HomeDir()
string DefaultWritableDir()
{
initializer_list<string> dirs = {".local", "share", "MapsWithMe"};
- auto const result = my::JoinFoldersToPath(dirs, "" /* file */);
+ auto const result = base::JoinFoldersToPath(dirs, "" /* file */);
auto const home = HomeDir();
if (!MkDirsChecked(home, dirs))
MYTHROW(FileSystemException, ("Cannot create directory:", result));
@@ -119,11 +119,11 @@ Platform::Platform()
string path;
CHECK(GetBinaryDir(path), ("Can't retrieve path to executable"));
- m_settingsDir = my::JoinPath(HomeDir(), ".config", "MapsWithMe");
+ m_settingsDir = base::JoinPath(HomeDir(), ".config", "MapsWithMe");
- if (!IsFileExistsByFullPath(my::JoinPath(m_settingsDir, SETTINGS_FILE_NAME)))
+ if (!IsFileExistsByFullPath(base::JoinPath(m_settingsDir, SETTINGS_FILE_NAME)))
{
- auto const configDir = my::JoinPath(HomeDir(), ".config");
+ auto const configDir = base::JoinPath(HomeDir(), ".config");
if (!MkDirChecked(configDir))
MYTHROW(FileSystemException, ("Can't create directory", configDir));
if (!MkDirChecked(m_settingsDir))
@@ -144,10 +144,10 @@ Platform::Platform()
}
else
{
- string const devBuildWithSymlink = my::JoinPath(path, "..", "..", "data");
- string const devBuildWithoutSymlink = my::JoinPath(path, "..", "..", "..", "omim", "data");
- string const installedVersionWithPackages = my::JoinPath(path, "..", "share");
- string const installedVersionWithoutPackages = my::JoinPath(path, "..", "MapsWithMe");
+ string const devBuildWithSymlink = base::JoinPath(path, "..", "..", "data");
+ string const devBuildWithoutSymlink = base::JoinPath(path, "..", "..", "..", "omim", "data");
+ string const installedVersionWithPackages = base::JoinPath(path, "..", "share");
+ string const installedVersionWithoutPackages = base::JoinPath(path, "..", "MapsWithMe");
string const customInstall = path;
if (IsEulaExist(devBuildWithSymlink))
diff --git a/platform/platform_mac.mm b/platform/platform_mac.mm
index 40bd2c614c..9171086562 100644
--- a/platform/platform_mac.mm
+++ b/platform/platform_mac.mm
@@ -92,8 +92,8 @@ Platform::Platform()
if (m_resourcesDir.empty())
m_resourcesDir = ".";
- m_resourcesDir = my::AddSlashIfNeeded(m_resourcesDir);
- m_writableDir = my::AddSlashIfNeeded(m_writableDir);
+ m_resourcesDir = base::AddSlashIfNeeded(m_resourcesDir);
+ m_writableDir = base::AddSlashIfNeeded(m_writableDir);
m_settingsDir = m_writableDir;
m_privateDir = m_writableDir;
diff --git a/platform/platform_tests/apk_test.cpp b/platform/platform_tests/apk_test.cpp
index 7e21aa34e5..6305aa9dba 100644
--- a/platform/platform_tests/apk_test.cpp
+++ b/platform/platform_tests/apk_test.cpp
@@ -94,7 +94,7 @@ UNIT_TEST(ApkReader_Multithreaded)
string const path = GetPlatform().WritableDir() + "../android/MapsWithMePro/bin/MapsWithMePro-production.apk";
uint64_t size;
- if (!my::GetFileSize(path, size))
+ if (!base::GetFileSize(path, size))
{
LOG(LINFO, ("Apk not found"));
return;
diff --git a/platform/platform_tests/downloader_tests/downloader_test.cpp b/platform/platform_tests/downloader_tests/downloader_test.cpp
index bf55bc9e8a..796c3b372c 100644
--- a/platform/platform_tests/downloader_tests/downloader_test.cpp
+++ b/platform/platform_tests/downloader_tests/downloader_test.cpp
@@ -35,7 +35,7 @@ class DownloadObserver
vector<HttpRequest::Status> m_statuses;
// Interrupt download after this number of chunks
int m_chunksToFail;
- my::ScopedLogLevelChanger const m_debugLogLevel;
+ base::ScopedLogLevelChanger const m_debugLogLevel;
public:
DownloadObserver() : m_chunksToFail(-1), m_debugLogLevel(LDEBUG)
@@ -354,21 +354,21 @@ namespace
void FinishDownloadSuccess(string const & file)
{
- TEST(my::DeleteFileX(file), ("Result file should present on success"));
+ TEST(base::DeleteFileX(file), ("Result file should present on success"));
uint64_t size;
- TEST(!my::GetFileSize(file + DOWNLOADING_FILE_EXTENSION, size), ("No downloading file on success"));
- TEST(!my::GetFileSize(file + RESUME_FILE_EXTENSION, size), ("No resume file on success"));
+ TEST(!base::GetFileSize(file + DOWNLOADING_FILE_EXTENSION, size), ("No downloading file on success"));
+ TEST(!base::GetFileSize(file + RESUME_FILE_EXTENSION, size), ("No resume file on success"));
}
void FinishDownloadFail(string const & file)
{
uint64_t size;
- TEST(!my::GetFileSize(file, size), ("No result file on fail"));
+ TEST(!base::GetFileSize(file, size), ("No result file on fail"));
- (void)my::DeleteFileX(file + DOWNLOADING_FILE_EXTENSION);
+ (void)base::DeleteFileX(file + DOWNLOADING_FILE_EXTENSION);
- TEST(my::DeleteFileX(file + RESUME_FILE_EXTENSION), ("Resume file should present on fail"));
+ TEST(base::DeleteFileX(file + RESUME_FILE_EXTENSION), ("Resume file should present on fail"));
}
}
@@ -561,13 +561,13 @@ UNIT_TEST(DownloadResumeChunks)
observer.TestOk();
uint64_t size;
- TEST(!my::GetFileSize(RESUME_FILENAME, size), ("No resume file on success"));
+ TEST(!base::GetFileSize(RESUME_FILENAME, size), ("No resume file on success"));
}
// 2nd step - mark some file blocks as not downloaded
{
// to substitute temporary not fully downloaded file
- TEST(my::RenameFileX(FILENAME, DOWNLOADING_FILENAME), ());
+ TEST(base::RenameFileX(FILENAME, DOWNLOADING_FILENAME), ());
FileWriter f(DOWNLOADING_FILENAME, FileWriter::OP_WRITE_EXISTING);
f.Seek(beg1);
diff --git a/platform/platform_tests/jansson_test.cpp b/platform/platform_tests/jansson_test.cpp
index 827d2f2879..ff18e644a9 100644
--- a/platform/platform_tests/jansson_test.cpp
+++ b/platform/platform_tests/jansson_test.cpp
@@ -12,7 +12,7 @@ UNIT_TEST(Jansson_Smoke)
char const * str = "{\"location\":{\"latitude\":47.3345141,\"longitude\":8.5312839,"
"\"accuracy\":22.0},\"access_token\":\"2:vC65Xv0mxMtsNVf4:hY5YSIkuFfnAU77z\"}";
- my::Json root(str);
+ base::Json root(str);
TEST(json_is_object(root.get()), ());
json_t * location = json_object_get(root.get(), "location");
TEST(json_is_object(location), ());
@@ -32,9 +32,9 @@ UNIT_TEST(Jansson_Smoke)
bool wasException = false;
try
{
- my::Json invalid("{asd]");
+ base::Json invalid("{asd]");
}
- catch (my::Json::Exception const &)
+ catch (base::Json::Exception const &)
{
wasException = true;
}
diff --git a/platform/platform_tests/language_test.cpp b/platform/platform_tests/language_test.cpp
index a8b8609dce..e176b7a5ce 100644
--- a/platform/platform_tests/language_test.cpp
+++ b/platform/platform_tests/language_test.cpp
@@ -2,8 +2,10 @@
#include "platform/preferred_languages.hpp"
-#include "std/string.hpp"
+#include "base/logging.hpp"
+#include <cstddef>
+#include <string>
UNIT_TEST(LangNormalize_Smoke)
{
@@ -17,15 +19,15 @@ UNIT_TEST(LangNormalize_Smoke)
UNIT_TEST(PrefLanguages_Smoke)
{
- string s = languages::GetPreferred();
+ std::string s = languages::GetPreferred();
TEST(!s.empty(), ());
- cout << "Preferred langs: " << s << endl;
+ LOG(LINFO, ("Preferred langs:", s));
s = languages::GetCurrentOrig();
TEST(!s.empty(), ());
- cout << "Current original lang: " << s << endl;
+ LOG(LINFO, ("Current original lang:", s));
s = languages::GetCurrentNorm();
TEST(!s.empty(), ());
- cout << "Current normalized lang: " << s << endl;
+ LOG(LINFO, ("Current normalized lang:", s));
}
diff --git a/platform/platform_tests/local_country_file_tests.cpp b/platform/platform_tests/local_country_file_tests.cpp
index 03c758a0eb..f32dffb62c 100644
--- a/platform/platform_tests/local_country_file_tests.cpp
+++ b/platform/platform_tests/local_country_file_tests.cpp
@@ -212,13 +212,13 @@ UNIT_TEST(LocalCountryFile_CleanupPartiallyDownloadedFiles)
{"Netherlands.mwm.routing.downloading2", ScopedFile::Mode::Create},
{"Germany.mwm.ready3", ScopedFile::Mode::Create},
{"UK_England.mwm.resume4", ScopedFile::Mode::Create},
- {my::JoinFoldersToPath(oldDir.GetRelativePath(), "Russia_Central.mwm.downloading"),
+ {base::JoinFoldersToPath(oldDir.GetRelativePath(), "Russia_Central.mwm.downloading"),
ScopedFile::Mode::Create}};
ScopedFile toBeKept[] = {
{"Italy.mwm", ScopedFile::Mode::Create},
{"Spain.mwm", ScopedFile::Mode::Create},
{"Spain.mwm.routing", ScopedFile::Mode::Create},
- {my::JoinFoldersToPath(latestDir.GetRelativePath(), "Russia_Southern.mwm.downloading"),
+ {base::JoinFoldersToPath(latestDir.GetRelativePath(), "Russia_Southern.mwm.downloading"),
ScopedFile::Mode::Create}};
CleanupMapsDirectory(101010 /* latestVersion */);
@@ -348,7 +348,7 @@ UNIT_TEST(LocalCountryFile_CountryIndexes)
CountryFile germanyFile("Germany");
LocalCountryFile germanyLocalFile(testDir.GetFullPath(), germanyFile, 101010 /* version */);
TEST_EQUAL(
- my::JoinFoldersToPath(germanyLocalFile.GetDirectory(), germanyFile.GetName()),
+ base::JoinFoldersToPath(germanyLocalFile.GetDirectory(), germanyFile.GetName()),
CountryIndexes::IndexesDir(germanyLocalFile), ());
CountryIndexes::PreparePlaceOnDisk(germanyLocalFile);
@@ -369,7 +369,7 @@ UNIT_TEST(LocalCountryFile_CountryIndexes)
UNIT_TEST(LocalCountryFile_DoNotDeleteUserFiles)
{
- my::ScopedLogLevelChanger const criticalLogLevel(LCRITICAL);
+ base::ScopedLogLevelChanger const criticalLogLevel(LCRITICAL);
ScopedDir testDir("101010");
@@ -378,7 +378,7 @@ UNIT_TEST(LocalCountryFile_DoNotDeleteUserFiles)
CountryIndexes::PreparePlaceOnDisk(germanyLocalFile);
string const userFilePath =
- my::JoinFoldersToPath(CountryIndexes::IndexesDir(germanyLocalFile), "user-data.txt");
+ base::JoinFoldersToPath(CountryIndexes::IndexesDir(germanyLocalFile), "user-data.txt");
{
FileWriter writer(userFilePath);
string const data = "user data";
@@ -387,7 +387,7 @@ UNIT_TEST(LocalCountryFile_DoNotDeleteUserFiles)
TEST(!CountryIndexes::DeleteFromDisk(germanyLocalFile),
("Indexes dir should not be deleted for:", germanyLocalFile));
- TEST(my::DeleteFileX(userFilePath), ("Can't delete test file:", userFilePath));
+ TEST(base::DeleteFileX(userFilePath), ("Can't delete test file:", userFilePath));
TEST(CountryIndexes::DeleteFromDisk(germanyLocalFile),
("Can't delete indexes for:", germanyLocalFile));
}
diff --git a/platform/platform_tests/platform_test.cpp b/platform/platform_tests/platform_test.cpp
index 2c2dead580..b5ae2511d8 100644
--- a/platform/platform_tests/platform_test.cpp
+++ b/platform/platform_tests/platform_test.cpp
@@ -41,7 +41,7 @@ UNIT_TEST(WritableDir)
try
{
- my::FileData f(path, my::FileData::OP_WRITE_TRUNCATE);
+ base::FileData f(path, base::FileData::OP_WRITE_TRUNCATE);
}
catch (Writer::OpenException const &)
{
@@ -49,7 +49,7 @@ UNIT_TEST(WritableDir)
return;
}
- my::DeleteFileX(path);
+ base::DeleteFileX(path);
}
UNIT_TEST(WritablePathForFile)
@@ -109,8 +109,8 @@ UNIT_TEST(GetFilesInDir_Smoke)
UNIT_TEST(DirsRoutines)
{
string const baseDir = GetPlatform().WritableDir();
- string const testDir = my::JoinFoldersToPath(baseDir, "test-dir");
- string const testFile = my::JoinFoldersToPath(testDir, "test-file");
+ string const testDir = base::JoinFoldersToPath(baseDir, "test-dir");
+ string const testFile = base::JoinFoldersToPath(testDir, "test-file");
TEST(!Platform::IsFileExistsByFullPath(testDir), ());
TEST_EQUAL(Platform::MkDir(testDir), Platform::ERR_OK, ());
@@ -136,11 +136,11 @@ UNIT_TEST(GetFilesByType)
string const baseDir = GetPlatform().WritableDir();
- string const testDir = my::JoinFoldersToPath(baseDir, kTestDirBaseName);
+ string const testDir = base::JoinFoldersToPath(baseDir, kTestDirBaseName);
TEST_EQUAL(Platform::MkDir(testDir), Platform::ERR_OK, ());
MY_SCOPE_GUARD(removeTestDir, bind(&Platform::RmDir, testDir));
- string const testFile = my::JoinFoldersToPath(baseDir, kTestFileBaseName);
+ string const testFile = base::JoinFoldersToPath(baseDir, kTestFileBaseName);
TEST(!Platform::IsFileExistsByFullPath(testFile), ());
{
FileWriter writer(testFile);
@@ -215,20 +215,20 @@ UNIT_TEST(GetWritableStorageStatus)
UNIT_TEST(RmDirRecursively)
{
- string const testDir1 = my::JoinFoldersToPath(GetPlatform().WritableDir(), "test_dir1");
+ string const testDir1 = base::JoinFoldersToPath(GetPlatform().WritableDir(), "test_dir1");
TEST_EQUAL(Platform::MkDir(testDir1), Platform::ERR_OK, ());
MY_SCOPE_GUARD(removeTestDir1, bind(&Platform::RmDir, testDir1));
- string const testDir2 = my::JoinFoldersToPath(testDir1, "test_dir2");
+ string const testDir2 = base::JoinFoldersToPath(testDir1, "test_dir2");
TEST_EQUAL(Platform::MkDir(testDir2), Platform::ERR_OK, ());
MY_SCOPE_GUARD(removeTestDir2, bind(&Platform::RmDir, testDir2));
- string const filePath = my::JoinFoldersToPath(testDir2, "test_file");
+ string const filePath = base::JoinFoldersToPath(testDir2, "test_file");
{
FileWriter testFile(filePath);
testFile.Write("HOHOHO", 6);
}
- MY_SCOPE_GUARD(removeTestFile, bind(&my::DeleteFileX, filePath));
+ MY_SCOPE_GUARD(removeTestFile, bind(&base::DeleteFileX, filePath));
TEST(Platform::IsFileExistsByFullPath(filePath), ());
TEST(Platform::IsFileExistsByFullPath(testDir1), ());
diff --git a/platform/platform_tests_support/scoped_dir.cpp b/platform/platform_tests_support/scoped_dir.cpp
index 824f418161..4f23ff312e 100644
--- a/platform/platform_tests_support/scoped_dir.cpp
+++ b/platform/platform_tests_support/scoped_dir.cpp
@@ -13,7 +13,7 @@ namespace platform
namespace tests_support
{
ScopedDir::ScopedDir(string const & relativePath)
- : m_fullPath(my::JoinFoldersToPath(GetPlatform().WritableDir(), relativePath)),
+ : m_fullPath(base::JoinFoldersToPath(GetPlatform().WritableDir(), relativePath)),
m_relativePath(relativePath),
m_reset(false)
{
@@ -34,7 +34,7 @@ ScopedDir::ScopedDir(string const & relativePath)
}
ScopedDir::ScopedDir(ScopedDir const & parent, string const & name)
- : ScopedDir(my::JoinFoldersToPath(parent.GetRelativePath(), name))
+ : ScopedDir(base::JoinFoldersToPath(parent.GetRelativePath(), name))
{
}
diff --git a/platform/platform_tests_support/scoped_file.cpp b/platform/platform_tests_support/scoped_file.cpp
index d083dfc446..25ccf5be3c 100644
--- a/platform/platform_tests_support/scoped_file.cpp
+++ b/platform/platform_tests_support/scoped_file.cpp
@@ -33,14 +33,14 @@ ScopedFile::ScopedFile(string const & relativePath, string const & contents)
ScopedFile::ScopedFile(ScopedDir const & dir, CountryFile const & countryFile,
MapOptions mapOptions)
: ScopedFile(
- my::JoinPath(dir.GetRelativePath(), GetFileName(countryFile.GetName(), mapOptions,
- version::FOR_TESTING_TWO_COMPONENT_MWM1)),
+ base::JoinPath(dir.GetRelativePath(), GetFileName(countryFile.GetName(), mapOptions,
+ version::FOR_TESTING_TWO_COMPONENT_MWM1)),
Mode::Create)
{
}
ScopedFile::ScopedFile(string const & relativePath, string const & contents, Mode mode)
- : m_fullPath(my::JoinFoldersToPath(GetPlatform().WritableDir(), relativePath))
+ : m_fullPath(base::JoinFoldersToPath(GetPlatform().WritableDir(), relativePath))
{
if (mode == Mode::DoNotCreate)
return;
@@ -67,7 +67,7 @@ ScopedFile::~ScopedFile()
LOG(LERROR, ("File", GetFullPath(), "did not exist or was deleted before dtor of ScopedFile."));
return;
}
- if (!my::DeleteFileX(GetFullPath()))
+ if (!base::DeleteFileX(GetFullPath()))
LOG(LERROR, ("Can't remove test file:", GetFullPath()));
}
diff --git a/platform/platform_tests_support/scoped_mwm.cpp b/platform/platform_tests_support/scoped_mwm.cpp
index 01fc5b6dad..16f6a1eb62 100644
--- a/platform/platform_tests_support/scoped_mwm.cpp
+++ b/platform/platform_tests_support/scoped_mwm.cpp
@@ -26,7 +26,7 @@ ScopedMwm::ScopedMwm(string const & relativePath) : m_file(relativePath, ScopedF
// Each writer must be in it's own scope to avoid conflicts on the final write.
{
FileWriter versionWriter = container.GetWriter(VERSION_FILE_TAG);
- version::WriteVersion(versionWriter, my::SecondsSinceEpoch());
+ version::WriteVersion(versionWriter, base::SecondsSinceEpoch());
}
FileWriter w = container.GetWriter(HEADER_FILE_TAG);
diff --git a/platform/servers_list.cpp b/platform/servers_list.cpp
index 9fad565b20..762ed17382 100644
--- a/platform/servers_list.cpp
+++ b/platform/servers_list.cpp
@@ -17,7 +17,7 @@ bool ParseServerList(string const & jsonStr, vector<string> & outUrls)
outUrls.clear();
try
{
- my::Json root(jsonStr.c_str());
+ base::Json root(jsonStr.c_str());
for (size_t i = 0; i < json_array_size(root.get()); ++i)
{
char const * url = json_string_value(json_array_get(root.get(), i));
@@ -25,7 +25,7 @@ bool ParseServerList(string const & jsonStr, vector<string> & outUrls)
outUrls.push_back(url);
}
}
- catch (my::Json::Exception const & ex)
+ catch (base::Json::Exception const & ex)
{
LOG(LERROR, ("Can't parse server list json:", ex.Msg(), jsonStr));
}
diff --git a/platform/wifi_location_service.cpp b/platform/wifi_location_service.cpp
index 143c528c4b..7f80c38add 100644
--- a/platform/wifi_location_service.cpp
+++ b/platform/wifi_location_service.cpp
@@ -28,7 +28,7 @@ namespace location
try
{
bool success = false;
- my::Json root(response.GetData().c_str());
+ base::Json root(response.GetData().c_str());
if (json_is_object(root.get()))
{
json_t * location = json_object_get(root.get(), "location");
@@ -57,7 +57,7 @@ namespace location
if (!success)
LOG(LWARNING, ("Invalid reply from location server:", response.GetData()));
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LWARNING, ("Invalid reply from location server:", e.what(), response.GetData()));
}
diff --git a/qt/main.cpp b/qt/main.cpp
index d41c72aa19..a4a1d50217 100644
--- a/qt/main.cpp
+++ b/qt/main.cpp
@@ -26,7 +26,7 @@
#include <QtWidgets/QFileDialog>
DEFINE_string(data_path, "", "Path to data directory");
-DEFINE_string(log_abort_level, my::ToString(my::GetDefaultLogAbortLevel()),
+DEFINE_string(log_abort_level, base::ToString(base::GetDefaultLogAbortLevel()),
"Log messages severity that causes termination.");
DEFINE_string(resources_path, "", "Path to resources directory");
@@ -34,11 +34,11 @@ namespace
{
bool ValidateLogAbortLevel(char const * flagname, string const & value)
{
- my::LogLevel level;
- if (!my::FromString(value, level))
+ base::LogLevel level;
+ if (!base::FromString(value, level))
{
ostringstream os;
- auto const & names = my::GetLogLevelNames();
+ auto const & names = base::GetLogLevelNames();
for (size_t i = 0; i < names.size(); ++i)
{
if (i != 0)
@@ -71,7 +71,7 @@ public:
class InitializeFinalize : public FinalizeBase
{
FILE * m_errFile;
- my::ScopedLogLevelChanger const m_debugLog;
+ base::ScopedLogLevelChanger const m_debugLog;
public:
InitializeFinalize() : m_debugLog(LDEBUG)
{
@@ -102,9 +102,9 @@ int main(int argc, char * argv[])
if (!FLAGS_data_path.empty())
platform.SetWritableDirForTests(FLAGS_data_path);
- my::LogLevel level;
- CHECK(my::FromString(FLAGS_log_abort_level, level), ());
- my::g_LogAbortLevel = level;
+ base::LogLevel level;
+ CHECK(base::FromString(FLAGS_log_abort_level, level), ());
+ base::g_LogAbortLevel = level;
Q_INIT_RESOURCE(resources_common);
diff --git a/qt/qt_common/qtoglcontext.cpp b/qt/qt_common/qtoglcontext.cpp
index 69bb449787..d9db07aef0 100644
--- a/qt/qt_common/qtoglcontext.cpp
+++ b/qt/qt_common/qtoglcontext.cpp
@@ -59,7 +59,7 @@ void QtRenderOGLContext::Resize(int w, int h)
LockFrame();
m_resizeLock = true;
- QSize size(my::NextPowOf2(w), my::NextPowOf2(h));
+ QSize size(base::NextPowOf2(w), base::NextPowOf2(h));
m_texRect =
QRectF(0.0, 0.0, w / static_cast<float>(size.width()), h / static_cast<float>(size.height()));
diff --git a/qt/qt_common/scale_slider.cpp b/qt/qt_common/scale_slider.cpp
index 50c69f9e5b..b0199f72ac 100644
--- a/qt/qt_common/scale_slider.cpp
+++ b/qt/qt_common/scale_slider.cpp
@@ -67,7 +67,7 @@ void ScaleSlider::SetPosWithBlockedSignals(double pos)
{
bool const blocked = signalsBlocked();
blockSignals(true);
- setSliderPosition(my::rounds(pos * m_factor));
+ setSliderPosition(base::rounds(pos * m_factor));
blockSignals(blocked);
}
diff --git a/routing/async_router.cpp b/routing/async_router.cpp
index 0ed3dfb2d8..9929568c81 100644
--- a/routing/async_router.cpp
+++ b/routing/async_router.cpp
@@ -366,7 +366,7 @@ void AsyncRouter::CalculateRoute()
auto route = make_shared<Route>(router->GetName(), routeId);
RouterResultCode code;
- my::Timer timer;
+ base::Timer timer;
double elapsedSec = 0.0;
try
diff --git a/routing/base/astar_progress.hpp b/routing/base/astar_progress.hpp
index f1447de34b..c932b5ced6 100644
--- a/routing/base/astar_progress.hpp
+++ b/routing/base/astar_progress.hpp
@@ -45,7 +45,7 @@ private:
float CheckConstraints(float const & roadPart)
{
float mappedValue = m_startValue + (m_stopValue - m_startValue) * roadPart;
- mappedValue = my::clamp(mappedValue, m_startValue, m_stopValue);
+ mappedValue = base::clamp(mappedValue, m_startValue, m_stopValue);
if (mappedValue > m_lastValue)
m_lastValue = mappedValue;
return m_lastValue;
diff --git a/routing/bicycle_directions.cpp b/routing/bicycle_directions.cpp
index d8b6e1b4f4..cb91c090c2 100644
--- a/routing/bicycle_directions.cpp
+++ b/routing/bicycle_directions.cpp
@@ -274,7 +274,7 @@ void BicycleDirectionsEngine::GetSegmentRangeAndAdjacentEdges(
ASSERT_LESS(MercatorBounds::DistanceOnEarth(junctionPoint, edge.GetStartJunction().GetPoint()),
turns::kFeaturesNearTurnMeters, ());
m2::PointD const & outgoingPoint = edge.GetEndJunction().GetPoint();
- angle = my::RadToDeg(turns::PiMinusTwoVectorsAngle(junctionPoint, ingoingPoint, outgoingPoint));
+ angle = base::RadToDeg(turns::PiMinusTwoVectorsAngle(junctionPoint, ingoingPoint, outgoingPoint));
}
else
{
diff --git a/routing/cross_mwm_graph.cpp b/routing/cross_mwm_graph.cpp
index 4db5357235..e1174f6356 100644
--- a/routing/cross_mwm_graph.cpp
+++ b/routing/cross_mwm_graph.cpp
@@ -107,7 +107,7 @@ void CrossMwmGraph::FindBestTwins(NumMwmId sMwmId, bool isOutgoing, FeatureType
double const distM = MercatorBounds::DistanceOnEarth(point, tp);
ClosestSegment & closestSegment = minDistSegs[numMwmId];
double constexpr kEpsMeters = 2.0;
- if (my::AlmostEqualAbs(distM, 0.0, kEpsMeters))
+ if (base::AlmostEqualAbs(distM, 0.0, kEpsMeters))
{
twins.push_back(tc);
closestSegment.m_exactMatchFound = true;
diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp
index 05bedd79fc..2ae9fc61a4 100644
--- a/routing/edge_estimator.cpp
+++ b/routing/edge_estimator.cpp
@@ -73,7 +73,7 @@ double CalcClimbSegment(Purpose purpose, Segment const & segment, RoadGeometry c
CHECK_GREATER(speedMpS, 0.0, ());
double const timeSec = distance / speedMpS;
- if (my::AlmostEqualAbs(distance, 0.0, 0.1))
+ if (base::AlmostEqualAbs(distance, 0.0, 0.1))
return timeSec;
double const altitudeDiff =
diff --git a/routing/fake_ending.cpp b/routing/fake_ending.cpp
index 349c740fc1..c3806b8986 100644
--- a/routing/fake_ending.cpp
+++ b/routing/fake_ending.cpp
@@ -24,7 +24,7 @@ Junction CalcProjectionToSegment(Junction const & begin, Junction const & end,
auto const distBeginToEnd = MercatorBounds::DistanceOnEarth(begin.GetPoint(), end.GetPoint());
double constexpr kEpsMeters = 2.0;
- if (my::AlmostEqualAbs(distBeginToEnd, 0.0, kEpsMeters))
+ if (base::AlmostEqualAbs(distBeginToEnd, 0.0, kEpsMeters))
return Junction(projectedPoint, begin.GetAltitude());
auto const distBeginToProjection =
diff --git a/routing/features_road_graph.cpp b/routing/features_road_graph.cpp
index 52591a3ee9..fd872fef23 100644
--- a/routing/features_road_graph.cpp
+++ b/routing/features_road_graph.cpp
@@ -218,7 +218,7 @@ void FeaturesRoadGraph::GetJunctionTypes(Junction const & junction, feature::Typ
if (ft.GetFeatureType() != feature::GEOM_POINT)
return;
- if (!my::AlmostEqualAbs(ft.GetCenter(), cross, routing::kPointsEqualEpsilon))
+ if (!base::AlmostEqualAbs(ft.GetCenter(), cross, routing::kPointsEqualEpsilon))
return;
feature::TypesHolder typesHolder(ft);
diff --git a/routing/features_road_graph.hpp b/routing/features_road_graph.hpp
index 89badacf0b..0708566315 100644
--- a/routing/features_road_graph.hpp
+++ b/routing/features_road_graph.hpp
@@ -57,7 +57,7 @@ private:
void Clear();
private:
- using TMwmFeatureCache = my::Cache<uint32_t, RoadInfo>;
+ using TMwmFeatureCache = base::Cache<uint32_t, RoadInfo>;
map<MwmSet::MwmId, TMwmFeatureCache> m_cache;
};
diff --git a/routing/index_graph_loader.cpp b/routing/index_graph_loader.cpp
index d6b0b0030b..67ad451542 100644
--- a/routing/index_graph_loader.cpp
+++ b/routing/index_graph_loader.cpp
@@ -160,7 +160,7 @@ vector<RouteSegment::SpeedCamera> IndexGraphLoaderImpl::GetSpeedCameraInfo(Segme
for (size_t i = 1; i < camerasTmp.size(); ++i)
{
static constexpr auto kEps = 1e-5;
- if (!my::AlmostEqualAbs(camerasTmp[i - 1].m_coef, camerasTmp[i].m_coef, kEps))
+ if (!base::AlmostEqualAbs(camerasTmp[i - 1].m_coef, camerasTmp[i].m_coef, kEps))
cameras.emplace_back(camerasTmp[i - 1]);
}
// Cameras stored from beginning to ending of segment. So if we go at segment in backward direction,
@@ -197,7 +197,7 @@ IndexGraphLoaderImpl::GeometryIndexGraph & IndexGraphLoaderImpl::CreateIndexGrap
MYTHROW(RoutingException, ("Can't get mwm handle for", file));
graph.m_indexGraph = make_unique<IndexGraph>(graph.m_geometry, m_estimator);
- my::Timer timer;
+ base::Timer timer;
MwmValue const & mwmValue = *handle.GetValue<MwmValue>();
DeserializeIndexGraph(mwmValue, m_vehicleType, *graph.m_indexGraph);
LOG(LINFO, (ROUTING_FILE_TAG, "section for", file.GetName(), "loaded in", timer.ElapsedSeconds(),
diff --git a/routing/index_router.cpp b/routing/index_router.cpp
index 8aeb19663f..7fdd0a38b6 100644
--- a/routing/index_router.cpp
+++ b/routing/index_router.cpp
@@ -556,7 +556,7 @@ RouterResultCode IndexRouter::AdjustRoute(Checkpoints const & checkpoints,
m2::PointD const & startDirection,
RouterDelegate const & delegate, Route & route)
{
- my::Timer timer;
+ base::Timer timer;
TrafficStash::Guard guard(m_trafficStash);
auto graph = MakeWorldGraph();
graph->SetMode(WorldGraph::Mode::NoLeaps);
diff --git a/routing/online_cross_fetcher.cpp b/routing/online_cross_fetcher.cpp
index 17efb9bbe9..1b9ee52a68 100644
--- a/routing/online_cross_fetcher.cpp
+++ b/routing/online_cross_fetcher.cpp
@@ -26,7 +26,7 @@ bool ParseResponse(string const & serverResponse, vector<m2::PointD> & outPoints
{
try
{
- my::Json parser(serverResponse.c_str());
+ base::Json parser(serverResponse.c_str());
json_t const * countries = json_object_get(parser.get(), "used_mwms");
size_t const pointsCount = json_array_size(countries);
@@ -38,7 +38,7 @@ bool ParseResponse(string const & serverResponse, vector<m2::PointD> & outPoints
}
return pointsCount > 0;
}
- catch (my::Json::Exception const & exception)
+ catch (base::Json::Exception const & exception)
{
LOG(LWARNING, ("Can't parse server response:", exception.what()));
LOG(LWARNING, ("Response body:", serverResponse));
diff --git a/routing/road_graph.hpp b/routing/road_graph.hpp
index 13e06f14bd..15ad6e19ea 100644
--- a/routing/road_graph.hpp
+++ b/routing/road_graph.hpp
@@ -48,7 +48,7 @@ inline Junction MakeJunctionForTesting(m2::PointD const & point)
inline bool AlmostEqualAbs(Junction const & lhs, Junction const & rhs)
{
- return my::AlmostEqualAbs(lhs.GetPoint(), rhs.GetPoint(), kPointsEqualEpsilon);
+ return base::AlmostEqualAbs(lhs.GetPoint(), rhs.GetPoint(), kPointsEqualEpsilon);
}
/// The Edge class represents an edge description on a road network graph
@@ -203,7 +203,7 @@ public:
{
for (size_t i = 0; i < roadInfo.m_junctions.size(); ++i)
{
- if (!my::AlmostEqualAbs(m_cross.GetPoint(), roadInfo.m_junctions[i].GetPoint(),
+ if (!base::AlmostEqualAbs(m_cross.GetPoint(), roadInfo.m_junctions[i].GetPoint(),
kPointsEqualEpsilon))
{
continue;
diff --git a/routing/route.cpp b/routing/route.cpp
index f2f2501660..0e0a83d6bd 100644
--- a/routing/route.cpp
+++ b/routing/route.cpp
@@ -107,7 +107,7 @@ double Route::GetCurrentTimeToEndSec() const
double const totalTimeS = GetTotalTimeSec();
// Note. If a segment is short it does not make any sense to take into account time needed
// to path its part.
- if (my::AlmostEqualAbs(curSegLenMeters, 0.0, 1.0 /* meters */))
+ if (base::AlmostEqualAbs(curSegLenMeters, 0.0, 1.0 /* meters */))
return totalTimeS - etaToLastPassedPointS;
double const curSegTimeS = GetTimeToPassSegSec(curIter.m_ind);
@@ -259,7 +259,7 @@ double Route::GetPolySegAngle(size_t ind) const
p2 = m_poly.GetPolyline().GetPoint(i);
}
while (m2::AlmostEqualULPs(p1, p2) && ++i < polySz);
- return (i == polySz) ? 0 : my::RadToDeg(ang::AngleTo(p1, p2));
+ return (i == polySz) ? 0 : base::RadToDeg(ang::AngleTo(p1, p2));
}
void Route::MatchLocationToRoute(location::GpsInfo & location, location::RouteMatchingInfo & routeMatchingInfo) const
diff --git a/routing/route.hpp b/routing/route.hpp
index cff3d43403..cdd06b472e 100644
--- a/routing/route.hpp
+++ b/routing/route.hpp
@@ -50,7 +50,7 @@ public:
friend bool operator<(SpeedCamera const & lhs, SpeedCamera const & rhs)
{
static auto constexpr kCoefEps = 1e-5;
- if (!my::AlmostEqualAbs(lhs.m_coef, rhs.m_coef, kCoefEps))
+ if (!base::AlmostEqualAbs(lhs.m_coef, rhs.m_coef, kCoefEps))
return lhs.m_coef < rhs.m_coef;
// Cameras with same position on segment should be sorted in speed decrease order.
diff --git a/routing/route_weight.hpp b/routing/route_weight.hpp
index 66c1587b29..9621d76d6e 100644
--- a/routing/route_weight.hpp
+++ b/routing/route_weight.hpp
@@ -79,8 +79,8 @@ public:
{
return m_numPassThroughChanges == rhs.m_numPassThroughChanges &&
m_numAccessChanges == rhs.m_numAccessChanges &&
- my::AlmostEqualAbs(m_weight, rhs.m_weight, epsilon) &&
- my::AlmostEqualAbs(m_transitTime, rhs.m_transitTime, epsilon);
+ base::AlmostEqualAbs(m_weight, rhs.m_weight, epsilon) &&
+ base::AlmostEqualAbs(m_transitTime, rhs.m_transitTime, epsilon);
}
private:
diff --git a/routing/router_delegate.hpp b/routing/router_delegate.hpp
index 313e74c068..09a231f170 100644
--- a/routing/router_delegate.hpp
+++ b/routing/router_delegate.hpp
@@ -24,7 +24,7 @@ public:
void Reset() override;
private:
- my::Timer m_timer;
+ base::Timer m_timer;
uint32_t m_timeoutSec;
};
diff --git a/routing/routing_benchmarks/helpers.cpp b/routing/routing_benchmarks/helpers.cpp
index cd902c0fbd..44ed2fbd85 100644
--- a/routing/routing_benchmarks/helpers.cpp
+++ b/routing/routing_benchmarks/helpers.cpp
@@ -34,7 +34,7 @@ void TestRouter(routing::IRouter & router, m2::PointD const & startPos,
{
routing::RouterDelegate delegate;
LOG(LINFO, ("Calculating routing ...", router.GetName()));
- my::Timer timer;
+ base::Timer timer;
auto const resultCode = router.CalculateRoute(routing::Checkpoints(startPos, finalPos),
m2::PointD::Zero() /* startDirection */,
false /* adjust */, delegate, route);
@@ -42,8 +42,8 @@ void TestRouter(routing::IRouter & router, m2::PointD const & startPos,
TEST_EQUAL(routing::RouterResultCode::NoError, resultCode, ());
TEST(route.IsValid(), ());
m2::PolylineD const & poly = route.GetPoly();
- TEST(my::AlmostEqualAbs(poly.Front(), startPos, routing::kPointsEqualEpsilon), ());
- TEST(my::AlmostEqualAbs(poly.Back(), finalPos, routing::kPointsEqualEpsilon), ());
+ TEST(base::AlmostEqualAbs(poly.Front(), startPos, routing::kPointsEqualEpsilon), ());
+ TEST(base::AlmostEqualAbs(poly.Back(), finalPos, routing::kPointsEqualEpsilon), ());
LOG(LINFO, ("Route polyline size:", route.GetPoly().GetSize()));
LOG(LINFO, ("Route distance, meters:", route.GetTotalDistanceMeters()));
LOG(LINFO, ("Elapsed, seconds:", elapsedSec));
@@ -117,7 +117,7 @@ void RoutingTest::TestRouters(m2::PointD const & startPos, m2::PointD const & fi
}
double constexpr kEpsilon = 1e-6;
- TEST(my::AlmostEqualAbs(routeFoundByAstar.GetTotalDistanceMeters(),
+ TEST(base::AlmostEqualAbs(routeFoundByAstar.GetTotalDistanceMeters(),
routeFoundByAstarBidirectional.GetTotalDistanceMeters(), kEpsilon),
());
}
diff --git a/routing/routing_consistency_tests/routing_consistency_tests.cpp b/routing/routing_consistency_tests/routing_consistency_tests.cpp
index b6901a3ef4..3c18c1aea0 100644
--- a/routing/routing_consistency_tests/routing_consistency_tests.cpp
+++ b/routing/routing_consistency_tests/routing_consistency_tests.cpp
@@ -11,12 +11,15 @@
#include "base/logging.hpp"
-#include "std/string.hpp"
-#include "std/fstream.hpp"
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <string>
#include "3party/gflags/src/gflags/gflags.h"
using namespace routing;
+using namespace std;
using storage::CountryInfo;
double constexpr kMinimumRouteDistanceM = 10000.;
diff --git a/routing/routing_integration_tests/bicycle_route_test.cpp b/routing/routing_integration_tests/bicycle_route_test.cpp
index 9fbd08d6d7..9954a12601 100644
--- a/routing/routing_integration_tests/bicycle_route_test.cpp
+++ b/routing/routing_integration_tests/bicycle_route_test.cpp
@@ -64,7 +64,7 @@ UNIT_TEST(NetherlandsAmsterdamBicycleYes)
Route const & route = *routeResult.first;
RouterResultCode const result = routeResult.second;
TEST_EQUAL(result, RouterResultCode::NoError, ());
- TEST(my::AlmostEqualAbs(route.GetTotalTimeSec(), 357.0, 1.0), ());
+ TEST(base::AlmostEqualAbs(route.GetTotalTimeSec(), 357.0, 1.0), ());
}
// This test on tag cycleway=opposite for a streets which have oneway=yes.
diff --git a/routing/routing_integration_tests/get_altitude_test.cpp b/routing/routing_integration_tests/get_altitude_test.cpp
index 44a76063fd..bddbb7c4af 100644
--- a/routing/routing_integration_tests/get_altitude_test.cpp
+++ b/routing/routing_integration_tests/get_altitude_test.cpp
@@ -74,7 +74,7 @@ void TestAltitudeOfAllMwmFeatures(string const & countryId, TAltitude const alti
for (auto const altitude : altitudes)
{
- TEST_EQUAL(my::clamp(altitude, altitudeLowerBoundMeters, altitudeUpperBoundMeters), altitude,
+ TEST_EQUAL(base::clamp(altitude, altitudeLowerBoundMeters, altitudeUpperBoundMeters), altitude,
("Unexpected altitude. MWM:", countryId, ", feature id:", id, ", altitudes:", altitudes));
}
});
diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp
index 737c28bf7d..8faa8f8389 100644
--- a/routing/routing_integration_tests/routing_test_tools.cpp
+++ b/routing/routing_integration_tests/routing_test_tools.cpp
@@ -202,29 +202,30 @@ namespace integration
TEST_EQUAL(streetName, expectedStreetName, ());
}
- void TestRouteLength(Route const & route, double expectedRouteMeters,
- double relativeError)
+ void TestRouteLength(Route const & route, double expectedRouteMeters, double relativeError)
{
double const delta = max(expectedRouteMeters * relativeError, kErrorMeters);
double const routeMeters = route.GetTotalDistanceMeters();
- TEST(my::AlmostEqualAbs(routeMeters, expectedRouteMeters, delta),
- ("Route length test failed. Expected:", expectedRouteMeters, "have:", routeMeters, "delta:", delta));
+ TEST(base::AlmostEqualAbs(routeMeters, expectedRouteMeters, delta),
+ ("Route length test failed. Expected:", expectedRouteMeters, "have:", routeMeters,
+ "delta:", delta));
}
void TestRouteTime(Route const & route, double expectedRouteSeconds, double relativeError)
{
double const delta = max(expectedRouteSeconds * relativeError, kErrorSeconds);
double const routeSeconds = route.GetTotalTimeSec();
- TEST(my::AlmostEqualAbs(routeSeconds, expectedRouteSeconds, delta),
- ("Route time test failed. Expected:", expectedRouteSeconds, "have:", routeSeconds, "delta:", delta));
+ TEST(base::AlmostEqualAbs(routeSeconds, expectedRouteSeconds, delta),
+ ("Route time test failed. Expected:", expectedRouteSeconds, "have:", routeSeconds,
+ "delta:", delta));
}
void TestRoutePointsNumber(Route const & route, size_t expectedPointsNumber, double relativeError)
{
CHECK_GREATER_OR_EQUAL(relativeError, 0.0, ());
size_t const routePoints = route.GetPoly().GetSize();
- TEST(my::AlmostEqualRel(static_cast<double>(routePoints),
- static_cast<double>(expectedPointsNumber), relativeError),
+ TEST(base::AlmostEqualRel(static_cast<double>(routePoints),
+ static_cast<double>(expectedPointsNumber), relativeError),
("Route points test failed. Expected:", expectedPointsNumber, "have:", routePoints,
"relative error:", relativeError));
}
diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp
index 3699abbf37..89cbb22460 100644
--- a/routing/routing_session.cpp
+++ b/routing/routing_session.cpp
@@ -305,8 +305,8 @@ RoutingSession::State RoutingSession::OnLocationPositionChanged(GpsInfo const &
auto const & lastGoodPoint = m_route->GetFollowedPolyline().GetCurrentIter().m_pt;
double const dist = MercatorBounds::DistanceOnEarth(lastGoodPoint,
MercatorBounds::FromLatLon(info.m_latitude, info.m_longitude));
- if (my::AlmostEqualAbs(dist, m_lastDistance, kRunawayDistanceSensitivityMeters))
- return m_state;
+ if (base::AlmostEqualAbs(dist, m_lastDistance, kRunawayDistanceSensitivityMeters))
+ return m_state;
if (dist > m_lastDistance)
{
++m_moveAwayCounter;
diff --git a/routing/routing_tests/astar_router_test.cpp b/routing/routing_tests/astar_router_test.cpp
index dfcd46e7f9..bc4b20f1d3 100644
--- a/routing/routing_tests/astar_router_test.cpp
+++ b/routing/routing_tests/astar_router_test.cpp
@@ -241,7 +241,7 @@ UNIT_TEST(AStarRouter_SimpleGraph_PickTheFasterRoad1)
MakeJunctionForTesting(m2::PointD(8, 3)), MakeJunctionForTesting(m2::PointD(10, 3)),
MakeJunctionForTesting(m2::PointD(10, 2))}),
());
- TEST(my::AlmostEqualAbs(result.m_distance, 800451., 1.), ("Distance error:", result.m_distance));
+ TEST(base::AlmostEqualAbs(result.m_distance, 800451., 1.), ("Distance error:", result.m_distance));
}
UNIT_TEST(AStarRouter_SimpleGraph_PickTheFasterRoad2)
@@ -272,7 +272,7 @@ UNIT_TEST(AStarRouter_SimpleGraph_PickTheFasterRoad2)
MakeJunctionForTesting(m2::PointD(6, 2)),
MakeJunctionForTesting(m2::PointD(10, 2))}),
());
- TEST(my::AlmostEqualAbs(result.m_distance, 781458., 1.), ("Distance error:", result.m_distance));
+ TEST(base::AlmostEqualAbs(result.m_distance, 781458., 1.), ("Distance error:", result.m_distance));
}
UNIT_TEST(AStarRouter_SimpleGraph_PickTheFasterRoad3)
@@ -304,5 +304,5 @@ UNIT_TEST(AStarRouter_SimpleGraph_PickTheFasterRoad3)
{MakeJunctionForTesting(m2::PointD(2, 2)), MakeJunctionForTesting(m2::PointD(2, 1)),
MakeJunctionForTesting(m2::PointD(10, 1)), MakeJunctionForTesting(m2::PointD(10, 2))}),
());
- TEST(my::AlmostEqualAbs(result.m_distance, 814412., 1.), ("Distance error:", result.m_distance));
+ TEST(base::AlmostEqualAbs(result.m_distance, 814412., 1.), ("Distance error:", result.m_distance));
}
diff --git a/routing/routing_tests/checkpoint_predictor_test.cpp b/routing/routing_tests/checkpoint_predictor_test.cpp
index d8160b9936..e5cd8a8417 100644
--- a/routing/routing_tests/checkpoint_predictor_test.cpp
+++ b/routing/routing_tests/checkpoint_predictor_test.cpp
@@ -15,7 +15,7 @@ namespace
void TestAlmostEqual(double v1, double v2)
{
double constexpr kEpsMeters = 1.0;
- TEST(my::AlmostEqualAbs(v1, v2, kEpsMeters), (v1, v2));
+ TEST(base::AlmostEqualAbs(v1, v2, kEpsMeters), (v1, v2));
}
} // namespace
diff --git a/routing/routing_tests/index_graph_test.cpp b/routing/routing_tests/index_graph_test.cpp
index daaeb92395..b39e17ed5b 100644
--- a/routing/routing_tests/index_graph_test.cpp
+++ b/routing/routing_tests/index_graph_test.cpp
@@ -66,7 +66,7 @@ void TestRoute(FakeEnding const & start, FakeEnding const & finish, size_t expec
if (expectedWeight != kUnknownWeight)
{
double constexpr kEpsilon = 0.01;
- TEST(my::AlmostEqualRel(timeSec, expectedWeight, kEpsilon),
+ TEST(base::AlmostEqualRel(timeSec, expectedWeight, kEpsilon),
("Expected weight:", expectedWeight, "got:", timeSec));
}
diff --git a/routing/routing_tests/index_graph_tools.cpp b/routing/routing_tests/index_graph_tools.cpp
index 5e5f31e366..8bb1d5a689 100644
--- a/routing/routing_tests/index_graph_tools.cpp
+++ b/routing/routing_tests/index_graph_tools.cpp
@@ -459,7 +459,7 @@ void TestTopologyGraph(TestIndexGraphTopology const & graph, TestIndexGraphTopol
if (!pathFound)
return;
- TEST(my::AlmostEqualAbs(pathWeight, expectedWeight, kEpsilon),
+ TEST(base::AlmostEqualAbs(pathWeight, expectedWeight, kEpsilon),
(pathWeight, expectedWeight, pathEdges));
TEST_EQUAL(pathEdges, expectedEdges, ());
}
diff --git a/routing/routing_tests/route_tests.cpp b/routing/routing_tests/route_tests.cpp
index 77066a24bf..b16facdb69 100644
--- a/routing/routing_tests/route_tests.cpp
+++ b/routing/routing_tests/route_tests.cpp
@@ -102,27 +102,27 @@ UNIT_TEST(DistanceToCurrentTurnTest)
turns::TurnItem turn;
route.GetCurrentTurn(distance, turn);
- TEST(my::AlmostEqualAbs(distance,
- MercatorBounds::DistanceOnEarth(kTestGeometry[0], kTestGeometry[1]), 0.1),
- ());
+ TEST(base::AlmostEqualAbs(distance,
+ MercatorBounds::DistanceOnEarth(kTestGeometry[0], kTestGeometry[1]), 0.1),
+ ());
TEST_EQUAL(turn, kTestTurns[0], ());
route.MoveIterator(GetGps(0, 0.5));
route.GetCurrentTurn(distance, turn);
- TEST(my::AlmostEqualAbs(distance,
- MercatorBounds::DistanceOnEarth({0, 0.5}, kTestGeometry[1]), 0.1), ());
+ TEST(base::AlmostEqualAbs(distance,
+ MercatorBounds::DistanceOnEarth({0, 0.5}, kTestGeometry[1]), 0.1), ());
TEST_EQUAL(turn, kTestTurns[0], ());
route.MoveIterator(GetGps(1, 1.5));
route.GetCurrentTurn(distance, turn);
- TEST(my::AlmostEqualAbs(distance,
- MercatorBounds::DistanceOnEarth({1, 1.5}, kTestGeometry[4]), 0.1), ());
+ TEST(base::AlmostEqualAbs(distance,
+ MercatorBounds::DistanceOnEarth({1, 1.5}, kTestGeometry[4]), 0.1), ());
TEST_EQUAL(turn, kTestTurns[2], ());
route.MoveIterator(GetGps(1, 2.5));
route.GetCurrentTurn(distance, turn);
- TEST(my::AlmostEqualAbs(distance,
- MercatorBounds::DistanceOnEarth({1, 2.5}, kTestGeometry[4]), 0.1), ());
+ TEST(base::AlmostEqualAbs(distance,
+ MercatorBounds::DistanceOnEarth({1, 2.5}, kTestGeometry[4]), 0.1), ());
TEST_EQUAL(turn, kTestTurns[2], ());
}
@@ -172,8 +172,8 @@ UNIT_TEST(NextTurnsTest)
TEST_EQUAL(turnsDist.size(), 2, ());
double const firstSegLenM = MercatorBounds::DistanceOnEarth(kTestGeometry[0], kTestGeometry[1]);
double const secondSegLenM = MercatorBounds::DistanceOnEarth(kTestGeometry[1], kTestGeometry[2]);
- TEST(my::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
- TEST(my::AlmostEqualAbs(turnsDist[1].m_distMeters, firstSegLenM + secondSegLenM, 0.1), ());
+ TEST(base::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
+ TEST(base::AlmostEqualAbs(turnsDist[1].m_distMeters, firstSegLenM + secondSegLenM, 0.1), ());
TEST_EQUAL(turnsDist[0].m_turnItem, kTestTurns[0], ());
TEST_EQUAL(turnsDist[1].m_turnItem, kTestTurns[1], ());
}
@@ -185,8 +185,8 @@ UNIT_TEST(NextTurnsTest)
TEST_EQUAL(turnsDist.size(), 2, ());
double const firstSegLenM = MercatorBounds::DistanceOnEarth({x, y}, kTestGeometry[1]);
double const secondSegLenM = MercatorBounds::DistanceOnEarth(kTestGeometry[1], kTestGeometry[2]);
- TEST(my::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
- TEST(my::AlmostEqualAbs(turnsDist[1].m_distMeters, firstSegLenM + secondSegLenM, 0.1), ());
+ TEST(base::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
+ TEST(base::AlmostEqualAbs(turnsDist[1].m_distMeters, firstSegLenM + secondSegLenM, 0.1), ());
TEST_EQUAL(turnsDist[0].m_turnItem, kTestTurns[0], ());
TEST_EQUAL(turnsDist[1].m_turnItem, kTestTurns[1], ());
}
@@ -197,7 +197,7 @@ UNIT_TEST(NextTurnsTest)
TEST(route.GetNextTurns(turnsDist), ());
TEST_EQUAL(turnsDist.size(), 1, ());
double const firstSegLenM = MercatorBounds::DistanceOnEarth({x, y}, kTestGeometry[4]);
- TEST(my::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
+ TEST(base::AlmostEqualAbs(turnsDist[0].m_distMeters, firstSegLenM, 0.1), ());
TEST_EQUAL(turnsDist[0].m_turnItem, kTestTurns[2], ());
}
{
diff --git a/routing/routing_tests/routing_session_test.cpp b/routing/routing_tests/routing_session_test.cpp
index a8f8ab511d..6cdbdbe419 100644
--- a/routing/routing_tests/routing_session_test.cpp
+++ b/routing/routing_tests/routing_session_test.cpp
@@ -318,25 +318,25 @@ UNIT_CLASS_TEST(AsyncGuiThreadTestWithRoutingSession, TestFollowRoutePercentTest
info.m_longitude = 0.;
info.m_latitude = 1.;
m_session->OnLocationPositionChanged(info);
- TEST(my::AlmostEqualAbs(m_session->GetCompletionPercent(), 0., 0.5),
+ TEST(base::AlmostEqualAbs(m_session->GetCompletionPercent(), 0., 0.5),
(m_session->GetCompletionPercent()));
info.m_longitude = 0.;
info.m_latitude = 2.;
m_session->OnLocationPositionChanged(info);
- TEST(my::AlmostEqualAbs(m_session->GetCompletionPercent(), 33.3, 0.5),
+ TEST(base::AlmostEqualAbs(m_session->GetCompletionPercent(), 33.3, 0.5),
(m_session->GetCompletionPercent()));
info.m_longitude = 0.;
info.m_latitude = 3.;
m_session->OnLocationPositionChanged(info);
- TEST(my::AlmostEqualAbs(m_session->GetCompletionPercent(), 66.6, 0.5),
+ TEST(base::AlmostEqualAbs(m_session->GetCompletionPercent(), 66.6, 0.5),
(m_session->GetCompletionPercent()));
info.m_longitude = 0.;
info.m_latitude = 3.99;
m_session->OnLocationPositionChanged(info);
- TEST(my::AlmostEqualAbs(m_session->GetCompletionPercent(), 100., 0.5),
+ TEST(base::AlmostEqualAbs(m_session->GetCompletionPercent(), 100., 0.5),
(m_session->GetCompletionPercent()));
checkTimedSignal.Signal();
});
diff --git a/routing/routing_tests/speed_cameras_tests.cpp b/routing/routing_tests/speed_cameras_tests.cpp
index 63d310bbe5..cdc98adcc4 100644
--- a/routing/routing_tests/speed_cameras_tests.cpp
+++ b/routing/routing_tests/speed_cameras_tests.cpp
@@ -94,10 +94,10 @@ bool TestSerDesSpeedCamera(std::vector<SpeedCameraMetadata> const & speedCameras
}
ScopedDir scopedDir(kTestDir);
- auto const testFile = my::JoinPath(kTestDir, kTestFileForCamera);
+ auto const testFile = base::JoinPath(kTestDir, kTestFileForCamera);
ScopedFile scopedFile(testFile, "");
auto const & writableDir = GetPlatform().WritableDir();
- auto const & filePath = my::JoinPath(writableDir, testFile);
+ auto const & filePath = base::JoinPath(writableDir, testFile);
{
FileWriter writer(filePath);
@@ -118,7 +118,7 @@ bool TestSerDesSpeedCamera(std::vector<SpeedCameraMetadata> const & speedCameras
std::tie(segment, speedCamera) = DeserializeSpeedCamera(src, prevFeatureId);
TEST_EQUAL(segment.m_featureId, way.m_featureId, ());
TEST_EQUAL(segment.m_segmentId, way.m_segmentId, ());
- TEST(my::AlmostEqualAbs(speedCamera.m_coef, way.m_coef, 1e-5), ());
+ TEST(base::AlmostEqualAbs(speedCamera.m_coef, way.m_coef, 1e-5), ());
TEST_EQUAL(speedCamera.m_maxSpeedKmPH, metadata.m_maxSpeedKmPH, ());
}
}
diff --git a/routing/routing_tests/turns_sound_test.cpp b/routing/routing_tests/turns_sound_test.cpp
index 34ae25872b..a98e75e7f5 100644
--- a/routing/routing_tests/turns_sound_test.cpp
+++ b/routing/routing_tests/turns_sound_test.cpp
@@ -29,11 +29,11 @@ UNIT_TEST(TurnNotificationSettingsMetersTest)
measurement_utils::Units::Metric /* lengthUnits */);
TEST(settings.IsValid(), ());
- TEST(my::AlmostEqualAbs(
+ TEST(base::AlmostEqualAbs(
settings.ConvertMetersPerSecondToUnitsPerSecond(20.), 20., kEps), ());
- TEST(my::AlmostEqualAbs(
+ TEST(base::AlmostEqualAbs(
settings.ConvertMetersPerSecondToUnitsPerSecond(0.), 0., kEps), ());
- TEST(my::AlmostEqualAbs(settings.ConvertUnitsToMeters(300. /* distanceInUnits */), 300., kEps), ());
+ TEST(base::AlmostEqualAbs(settings.ConvertUnitsToMeters(300. /* distanceInUnits */), 300., kEps), ());
TEST_EQUAL(settings.RoundByPresetSoundedDistancesUnits(300 /* distanceInUnits */), 300, ());
TEST_EQUAL(settings.RoundByPresetSoundedDistancesUnits(0 /* distanceInUnits */), 100, ());
@@ -60,11 +60,11 @@ UNIT_TEST(TurnNotificationSettingsFeetTest)
measurement_utils::Units::Imperial /* lengthUnits */);
TEST(settings.IsValid(), ());
- TEST(my::AlmostEqualAbs(
+ TEST(base::AlmostEqualAbs(
settings.ConvertMetersPerSecondToUnitsPerSecond(20.), 65., kEps), ());
- TEST(my::AlmostEqualAbs(
+ TEST(base::AlmostEqualAbs(
settings.ConvertMetersPerSecondToUnitsPerSecond(0.), 0., kEps), ());
- TEST(my::AlmostEqualAbs(settings.ConvertUnitsToMeters(300. /* distanceInUnits */), 91., kEps), ());
+ TEST(base::AlmostEqualAbs(settings.ConvertUnitsToMeters(300. /* distanceInUnits */), 91., kEps), ());
TEST_EQUAL(settings.RoundByPresetSoundedDistancesUnits(500 /* distanceInUnits */), 600, ());
TEST_EQUAL(settings.RoundByPresetSoundedDistancesUnits(0 /* distanceInUnits */), 200, ());
}
diff --git a/routing/transit_graph_loader.cpp b/routing/transit_graph_loader.cpp
index bff8182869..bd3d4eab99 100644
--- a/routing/transit_graph_loader.cpp
+++ b/routing/transit_graph_loader.cpp
@@ -73,7 +73,7 @@ unique_ptr<TransitGraph> TransitGraphLoaderImpl::CreateTransitGraph(NumMwmId num
if (!handle.IsAlive())
MYTHROW(RoutingException, ("Can't get mwm handle for", file));
- my::Timer timer;
+ base::Timer timer;
auto graph = make_unique<TransitGraph>(numMwmId, m_estimator);
MwmValue const & mwmValue = *handle.GetValue<MwmValue>();
if (!mwmValue.m_cont.IsExist(TRANSIT_FILE_TAG))
diff --git a/routing/turn_candidate.hpp b/routing/turn_candidate.hpp
index e6bc8c528e..44af1c338f 100644
--- a/routing/turn_candidate.hpp
+++ b/routing/turn_candidate.hpp
@@ -44,7 +44,7 @@ struct TurnCandidate
bool IsAlmostEqual(TurnCandidate const & rhs) const
{
double constexpr kEpsilon = 0.01;
- return my::AlmostEqualAbs(m_angle, rhs.m_angle, kEpsilon) && m_segment == rhs.m_segment &&
+ return base::AlmostEqualAbs(m_angle, rhs.m_angle, kEpsilon) && m_segment == rhs.m_segment &&
m_highwayClass == rhs.m_highwayClass && m_isLink == rhs.m_isLink;
}
};
diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp
index 1f6e1277c4..bc3b29c80f 100644
--- a/routing/turns_generator.cpp
+++ b/routing/turns_generator.cpp
@@ -228,7 +228,7 @@ bool KeepTurnByIngoingEdges(m2::PointD const & junctionPoint,
size_t const turnEdgesCount)
{
double const turnAngle =
- my::RadToDeg(PiMinusTwoVectorsAngle(junctionPoint, ingoingPointOneSegment, outgoingPoint));
+ base::RadToDeg(PiMinusTwoVectorsAngle(junctionPoint, ingoingPointOneSegment, outgoingPoint));
bool const isGoStraightOrSlightTurn = IsGoStraightOrSlightTurn(IntermediateDirection(turnAngle));
// The code below is responsible for cases when there is only one way to leave the junction.
@@ -418,7 +418,7 @@ bool GetNextCrossSegmentRoutePoint(IRoutingResult const & result, RoutePointInde
ASSERT_GREATER_OR_EQUAL(turnInfo.m_ingoing.m_path.size(), 2, ());
ASSERT_GREATER_OR_EQUAL(turnInfo.m_outgoing.m_path.size(), 2, ());
- double const oneSegmentTurnAngle = my::RadToDeg(
+ double const oneSegmentTurnAngle = base::RadToDeg(
PiMinusTwoVectorsAngle(turnInfo.m_ingoing.m_path.back().GetPoint(),
turnInfo.m_ingoing.m_path[turnInfo.m_ingoing.m_path.size() - 2].GetPoint(),
turnInfo.m_outgoing.m_path[1].GetPoint()));
@@ -838,7 +838,7 @@ void GetTurnDirection(IRoutingResult const & result, size_t outgoingSegmentIndex
GetPointForTurn(result, outgoingSegmentIndex, numMwmIds, kMaxOutgoingPointsCount,
kMinOutgoingDistMeters, true /* forward */);
- double const turnAngle = my::RadToDeg(PiMinusTwoVectorsAngle(junctionPoint, ingoingPoint, outgoingPoint));
+ double const turnAngle = base::RadToDeg(PiMinusTwoVectorsAngle(junctionPoint, ingoingPoint, outgoingPoint));
CarDirection const intermediateDirection = IntermediateDirection(turnAngle);
turn.m_keepAnyway = (!turnInfo.m_ingoing.m_isLink && turnInfo.m_outgoing.m_isLink);
@@ -1012,7 +1012,7 @@ size_t CheckUTurnOnRoute(IRoutingResult const & result, size_t outgoingSegmentIn
auto angle = ang::TwoVectorsAngle(m2::PointD::Zero(), v1, v2);
- if (!my::AlmostEqualAbs(angle, math::pi, kUTurnHeadingSensitivity))
+ if (!base::AlmostEqualAbs(angle, math::pi, kUTurnHeadingSensitivity))
return 0;
// Determine turn direction.
diff --git a/routing/turns_sound_settings.cpp b/routing/turns_sound_settings.cpp
index a88f90e120..a753f325e1 100644
--- a/routing/turns_sound_settings.cpp
+++ b/routing/turns_sound_settings.cpp
@@ -38,9 +38,9 @@ uint32_t Settings::ComputeTurnDistanceM(double speedMetersPerSecond) const
ASSERT(IsValid(), ());
double const turnNotificationDistanceM = m_timeSeconds * speedMetersPerSecond;
- return static_cast<uint32_t>(my::clamp(turnNotificationDistanceM,
- ConvertUnitsToMeters(m_minDistanceUnits),
- ConvertUnitsToMeters(m_maxDistanceUnits)));
+ return static_cast<uint32_t>(base::clamp(turnNotificationDistanceM,
+ ConvertUnitsToMeters(m_minDistanceUnits),
+ ConvertUnitsToMeters(m_maxDistanceUnits)));
}
bool Settings::TooCloseForFisrtNotification(double distToTurnMeters) const
@@ -103,7 +103,7 @@ uint32_t Settings::ComputeDistToPronounceDistM(double speedMetersPerSecond) cons
ASSERT_LESS_OR_EQUAL(0, speedMetersPerSecond, ());
uint32_t const startBeforeMeters =
static_cast<uint32_t>(speedMetersPerSecond * m_startBeforeSeconds);
- return my::clamp(startBeforeMeters, m_minStartBeforeMeters, m_maxStartBeforeMeters);
+ return base::clamp(startBeforeMeters, m_minStartBeforeMeters, m_maxStartBeforeMeters);
}
string DebugPrint(Notification const & notification)
diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp
index 9c3bfdb50c..e9dd00108f 100644
--- a/routing_common/vehicle_model.cpp
+++ b/routing_common/vehicle_model.cpp
@@ -61,8 +61,8 @@ VehicleModel::VehicleModel(Classificator const & c, LimitsInitList const & featu
CHECK_LESS_OR_EQUAL(speedFactor.m_eta, 1.0, ());
CHECK_GREATER_OR_EQUAL(speedFactor.m_weight, 0.0, ());
CHECK_GREATER_OR_EQUAL(speedFactor.m_eta, 0.0, ());
- double const weightFactor = my::clamp(speedFactor.m_weight, 0.0, 1.0);
- double const etaFactor = my::clamp(speedFactor.m_eta, 0.0, 1.0);
+ double const weightFactor = base::clamp(speedFactor.m_weight, 0.0, 1.0);
+ double const etaFactor = base::clamp(speedFactor.m_eta, 0.0, 1.0);
m_surfaceFactors[i++] = {c.GetTypeByPath(vector<string>(v.m_types, v.m_types + 2)),
{weightFactor, etaFactor}};
diff --git a/search/bookmarks/processor.hpp b/search/bookmarks/processor.hpp
index cc09a2dbf8..a2c670ccf4 100644
--- a/search/bookmarks/processor.hpp
+++ b/search/bookmarks/processor.hpp
@@ -15,7 +15,7 @@
#include <utility>
#include <vector>
-namespace my
+namespace base
{
class Cancellable;
}
diff --git a/search/cbv.cpp b/search/cbv.cpp
index 437abe7c36..3e94ac5a32 100644
--- a/search/cbv.cpp
+++ b/search/cbv.cpp
@@ -1,9 +1,9 @@
#include "search/cbv.hpp"
-#include "std/limits.hpp"
-#include "std/vector.hpp"
+#include <limits>
+#include <vector>
-using namespace my;
+using namespace std;
namespace search
{
diff --git a/search/cbv.hpp b/search/cbv.hpp
index b52ff839f6..6fc6d4c381 100644
--- a/search/cbv.hpp
+++ b/search/cbv.hpp
@@ -4,8 +4,9 @@
#include "base/ref_counted.hpp"
-#include "std/function.hpp"
-#include "std/utility.hpp"
+#include <cstdint>
+#include <memory>
+#include <utility>
namespace search
{
@@ -16,12 +17,12 @@ class CBV
{
public:
CBV() = default;
- explicit CBV(unique_ptr<coding::CompressedBitVector> p);
+ explicit CBV(std::unique_ptr<coding::CompressedBitVector> p);
CBV(CBV const & cbv) = default;
CBV(CBV && cbv);
inline operator bool() const { return !IsEmpty(); }
- CBV & operator=(unique_ptr<coding::CompressedBitVector> p);
+ CBV & operator=(std::unique_ptr<coding::CompressedBitVector> p);
CBV & operator=(CBV const & rhs) = default;
CBV & operator=(CBV && rhs);
@@ -34,12 +35,12 @@ public:
bool HasBit(uint64_t id) const;
uint64_t PopCount() const;
- template <class TFn>
- void ForEach(TFn && fn) const
+ template <typename Fn>
+ void ForEach(Fn && fn) const
{
ASSERT(!m_isFull, ());
if (!IsEmpty())
- coding::CompressedBitVectorEnumerator::ForEach(*m_p, forward<TFn>(fn));
+ coding::CompressedBitVectorEnumerator::ForEach(*m_p, std::forward<Fn>(fn));
}
CBV Union(CBV const & rhs) const;
@@ -51,7 +52,7 @@ public:
uint64_t Hash() const;
private:
- my::RefCountPtr<coding::CompressedBitVector> m_p;
+ base::RefCountPtr<coding::CompressedBitVector> m_p;
// True iff all bits are set to one.
bool m_isFull = false;
diff --git a/search/features_layer_path_finder.hpp b/search/features_layer_path_finder.hpp
index b6dfb440be..6ccf082d2a 100644
--- a/search/features_layer_path_finder.hpp
+++ b/search/features_layer_path_finder.hpp
@@ -60,7 +60,7 @@ public:
#if defined(DEBUG)
for (auto const * layer : layers)
LOG(LINFO, (DebugPrint(*layer)));
- my::Timer timer;
+ base::Timer timer;
#endif // defined(DEBUG)
std::vector<IntersectionResult> results;
diff --git a/search/geocoder.cpp b/search/geocoder.cpp
index 50aef21ca9..9feea7e816 100644
--- a/search/geocoder.cpp
+++ b/search/geocoder.cpp
@@ -404,7 +404,7 @@ void Geocoder::GoEverywhere()
// TODO (@y): remove following code as soon as Geocoder::Go() will
// work fast for most cases (significantly less than 1 second).
#if defined(DEBUG)
- my::Timer timer;
+ base::Timer timer;
MY_SCOPE_GUARD(printDuration, [&timer]()
{
LOG(LINFO, ("Total geocoding time:", timer.ElapsedSeconds(), "seconds"));
diff --git a/search/house_detector.cpp b/search/house_detector.cpp
index d98be7eec2..81741604b4 100644
--- a/search/house_detector.cpp
+++ b/search/house_detector.cpp
@@ -856,8 +856,8 @@ int HouseDetector::LoadStreets(vector<FeatureID> const & ids)
// Check if the cache is obsolete and need to be cleared.
if (!m_id2st.empty())
{
- typedef pair<FeatureID, Street *> ValueT;
- function<ValueT::first_type const &(ValueT const &)> f = bind(&ValueT::first, _1);
+ using Value = pair<FeatureID, Street *>;
+ function<Value::first_type const &(Value const &)> f = bind(&Value::first, _1);
// Do clear cache if we have elements that are present in the one set,
// but not in the other one (set's order is irrelevant).
@@ -1050,8 +1050,8 @@ void MergedStreet::FinishReadingHouses()
HouseProjection const * MergedStreet::GetHousePivot(bool isOdd, bool & sign) const
{
- typedef my::limited_priority_queue<HouseProjection const *, HouseProjection::LessDistance> QueueT;
- QueueT q(HN_COUNT_FOR_ODD_TEST);
+ using Queue = base::limited_priority_queue<HouseProjection const *, HouseProjection::LessDistance>;
+ Queue q(HN_COUNT_FOR_ODD_TEST);
// Get some most closest houses.
for (MergedStreet::Index i = Begin(); !IsEnd(i); Inc(i))
@@ -1060,7 +1060,7 @@ HouseProjection const * MergedStreet::GetHousePivot(bool isOdd, bool & sign) con
// Calculate all probabilities.
// even-left, odd-left, even-right, odd-right
double counter[4] = {0, 0, 0, 0};
- for (QueueT::const_iterator i = q.begin(); i != q.end(); ++i)
+ for (Queue::const_iterator i = q.begin(); i != q.end(); ++i)
{
size_t ind = (*i)->m_house->GetIntNumber() % 2;
if ((*i)->m_projSign)
diff --git a/search/intermediate_result.cpp b/search/intermediate_result.cpp
index b53f2a2ab0..face3131b2 100644
--- a/search/intermediate_result.cpp
+++ b/search/intermediate_result.cpp
@@ -209,7 +209,7 @@ void ProcessMetadata(FeatureType & ft, Result::Metadata & meta)
}
if (strings::to_int(src.Get(feature::Metadata::FMD_STARS), meta.m_stars))
- meta.m_stars = my::clamp(meta.m_stars, 0, 5);
+ meta.m_stars = base::clamp(meta.m_stars, 0, 5);
else
meta.m_stars = 0;
diff --git a/search/interval_set.hpp b/search/interval_set.hpp
index a6db719bbb..775112c48a 100644
--- a/search/interval_set.hpp
+++ b/search/interval_set.hpp
@@ -5,59 +5,60 @@
#include "std/utility.hpp"
#include "std/vector.hpp"
-namespace my
+// todo(@m) Move to search/base?
+namespace search
{
// This class represents a set of disjoint intervals in the form
// [begin, end). Note that neighbour intervals are always coalesced,
// so while [0, 1), [1, 2) and [2, 3) are disjoint, after addition to
// the set they will be stored as a single [0, 3).
-template <typename TElem>
+template <typename Elem>
class IntervalSet
{
public:
- using TInterval = pair<TElem, TElem>;
+ using Interval = pair<Elem, Elem>;
// Adds an |interval| to the set, coalescing adjacent intervals if needed.
//
// Complexity: O(num of intervals intersecting with |interval| +
// log(total number of intervals)).
- void Add(TInterval const & interval);
+ void Add(Interval const & interval);
// Subtracts set from an |interval| and appends result to
// |difference|.
//
// Complexity: O(num of intervals intersecting with |interval| +
// log(total number of intervals)).
- void SubtractFrom(TInterval const & interval, vector<TInterval> & difference) const;
+ void SubtractFrom(Interval const & interval, vector<Interval> & difference) const;
// Returns all elements of the set as a set of intervals.
//
// Complexity: O(1).
- inline set<TInterval> const & Elems() const { return m_intervals; }
+ inline set<Interval> const & Elems() const { return m_intervals; }
private:
- using TIterator = typename set<TInterval>::iterator;
+ using Iterator = typename set<Interval>::iterator;
// Calculates range of intervals that have non-empty intersection with a given |interval|.
- void Cover(TInterval const & interval, TIterator & begin, TIterator & end) const;
+ void Cover(Interval const & interval, Iterator & begin, Iterator & end) const;
// This is a set of disjoint intervals.
- set<TInterval> m_intervals;
+ set<Interval> m_intervals;
};
-template <typename TElem>
-void IntervalSet<TElem>::Add(TInterval const & interval)
+template <typename Elem>
+void IntervalSet<Elem>::Add(Interval const & interval)
{
// Skips empty intervals.
if (interval.first == interval.second)
return;
- TIterator begin;
- TIterator end;
+ Iterator begin;
+ Iterator end;
Cover(interval, begin, end);
- TElem from = interval.first;
- TElem to = interval.second;
+ Elem from = interval.first;
+ Elem to = interval.second;
// Updates |from| and |to| in accordance with corner intervals (if any).
if (begin != end)
@@ -95,17 +96,17 @@ void IntervalSet<TElem>::Add(TInterval const & interval)
m_intervals.emplace(from, to);
}
-template <typename TElem>
-void IntervalSet<TElem>::SubtractFrom(TInterval const & interval,
- vector<TInterval> & difference) const
+template <typename Elem>
+void IntervalSet<Elem>::SubtractFrom(Interval const & interval,
+ vector<Interval> & difference) const
{
- TIterator begin;
- TIterator end;
+ Iterator begin;
+ Iterator end;
Cover(interval, begin, end);
- TElem from = interval.first;
- TElem const to = interval.second;
+ Elem from = interval.first;
+ Elem const to = interval.second;
for (auto it = begin; it != end && from < to; ++it)
{
@@ -124,11 +125,11 @@ void IntervalSet<TElem>::SubtractFrom(TInterval const & interval,
difference.emplace_back(from, to);
}
-template <typename TElem>
-void IntervalSet<TElem>::Cover(TInterval const & interval, TIterator & begin, TIterator & end) const
+template <typename Elem>
+void IntervalSet<Elem>::Cover(Interval const & interval, Iterator & begin, Iterator & end) const
{
- TElem const & from = interval.first;
- TElem const & to = interval.second;
+ Elem const & from = interval.first;
+ Elem const & to = interval.second;
begin = m_intervals.lower_bound(make_pair(from, from));
if (begin != m_intervals.begin())
@@ -141,4 +142,4 @@ void IntervalSet<TElem>::Cover(TInterval const & interval, TIterator & begin, TI
end = m_intervals.lower_bound(make_pair(to, to));
}
-} // namespace my
+} // namespace search
diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp
index 315b167c74..1d07bac79f 100644
--- a/search/pre_ranker.cpp
+++ b/search/pre_ranker.cpp
@@ -267,10 +267,10 @@ void PreRanker::FilterForViewportSearch()
{
auto const & p = m_results[i].GetInfo().m_center;
int dx = static_cast<int>((p.x - viewport.minX()) / sizeX * kNumXSlots);
- dx = my::clamp(dx, 0, static_cast<int>(kNumXSlots) - 1);
+ dx = base::clamp(dx, 0, static_cast<int>(kNumXSlots) - 1);
int dy = static_cast<int>((p.y - viewport.minY()) / sizeY * kNumYSlots);
- dy = my::clamp(dy, 0, static_cast<int>(kNumYSlots) - 1);
+ dy = base::clamp(dy, 0, static_cast<int>(kNumYSlots) - 1);
buckets[dx * kNumYSlots + dy].push_back(i);
}
diff --git a/search/pysearch/bindings.cpp b/search/pysearch/bindings.cpp
index e61f90808c..d8fe78b85e 100644
--- a/search/pysearch/bindings.cpp
+++ b/search/pysearch/bindings.cpp
@@ -66,7 +66,7 @@ void Init(string const & resource_path, string const & mwm_path)
if (!resource_path.empty())
{
platform.SetResourceDir(resource_path);
- countriesFile = my::JoinFoldersToPath(resource_path, COUNTRIES_FILE);
+ countriesFile = base::JoinFoldersToPath(resource_path, COUNTRIES_FILE);
}
if (!mwm_path.empty())
diff --git a/search/result.cpp b/search/result.cpp
index 1289dd6732..13689c6d0c 100644
--- a/search/result.cpp
+++ b/search/result.cpp
@@ -276,7 +276,7 @@ void Results::InsertResult(vector<Result>::iterator where, Result && result)
string DebugPrint(search::Results const & results)
{
- return ::my::impl::DebugPrintSequence(results.begin(), results.end());
+ return DebugPrintSequence(results.begin(), results.end());
}
// AddressInfo -------------------------------------------------------------------------------------
diff --git a/search/search_integration_tests/pre_ranker_test.cpp b/search/search_integration_tests/pre_ranker_test.cpp
index de63a4029d..1bd90d291b 100644
--- a/search/search_integration_tests/pre_ranker_test.cpp
+++ b/search/search_integration_tests/pre_ranker_test.cpp
@@ -164,7 +164,7 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke)
TEST_LESS(index, pois.size(), ());
TEST(!checked[index], (index));
- TEST(my::AlmostEqualAbs(distances[index], results[i].GetDistance(), 1e-3),
+ TEST(base::AlmostEqualAbs(distances[index], results[i].GetDistance(), 1e-3),
(distances[index], results[i].GetDistance()));
checked[index] = true;
}
diff --git a/search/search_quality/features_collector_tool/features_collector_tool.cpp b/search/search_quality/features_collector_tool/features_collector_tool.cpp
index ba4f7b9f09..a8da701662 100644
--- a/search/search_quality/features_collector_tool/features_collector_tool.cpp
+++ b/search/search_quality/features_collector_tool/features_collector_tool.cpp
@@ -114,7 +114,7 @@ int main(int argc, char * argv[])
if (!FLAGS_data_path.empty())
{
platform.SetResourceDir(FLAGS_data_path);
- countriesFile = my::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE);
+ countriesFile = base::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE);
}
if (!FLAGS_mwm_path.empty())
diff --git a/search/search_quality/helpers.cpp b/search/search_quality/helpers.cpp
index a0aa3e4031..f030c5c04f 100644
--- a/search/search_quality/helpers.cpp
+++ b/search/search_quality/helpers.cpp
@@ -32,7 +32,7 @@ namespace m2
{
void FromJSONObject(json_t * root, string const & field, RectD & rect)
{
- json_t * r = my::GetJSONObligatoryField(root, field);
+ json_t * r = base::GetJSONObligatoryField(root, field);
double minX, minY, maxX, maxY;
FromJSONObject(r, "minx", minX);
FromJSONObject(r, "miny", minY);
@@ -46,7 +46,7 @@ void FromJSONObject(json_t * root, string const & field, RectD & rect)
void ToJSONObject(json_t & root, string const & field, RectD const & rect)
{
- auto json = my::NewJSONObject();
+ auto json = base::NewJSONObject();
ToJSONObject(*json, "minx", rect.minX());
ToJSONObject(*json, "miny", rect.minY());
ToJSONObject(*json, "maxx", rect.maxX());
@@ -56,14 +56,14 @@ void ToJSONObject(json_t & root, string const & field, RectD const & rect)
void FromJSONObject(json_t * root, string const & field, PointD & point)
{
- json_t * p = my::GetJSONObligatoryField(root, field);
+ json_t * p = base::GetJSONObligatoryField(root, field);
ParsePoint(p, point);
}
bool FromJSONObjectOptional(json_t * root, std::string const & field, PointD & point)
{
- json_t * p = my::GetJSONOptionalField(root, field);
- if (!p || my::JSONIsNull(p))
+ json_t * p = base::GetJSONOptionalField(root, field);
+ if (!p || base::JSONIsNull(p))
return false;
ParsePoint(p, point);
@@ -72,7 +72,7 @@ bool FromJSONObjectOptional(json_t * root, std::string const & field, PointD & p
void ToJSONObject(json_t & root, string const & field, PointD const & point)
{
- auto json = my::NewJSONObject();
+ auto json = base::NewJSONObject();
ToJSONObject(*json, "x", point.x);
ToJSONObject(*json, "y", point.y);
json_object_set_new(&root, field.c_str(), json.release());
diff --git a/search/search_quality/sample.cpp b/search/search_quality/sample.cpp
index be9fa5ae44..693ed8f44b 100644
--- a/search/search_quality/sample.cpp
+++ b/search/search_quality/sample.cpp
@@ -16,7 +16,7 @@
#include <sstream>
#include <string>
-using namespace my;
+using namespace base;
using namespace std;
namespace
@@ -93,20 +93,20 @@ bool Sample::DeserializeFromJSON(string const & jsonStr)
{
try
{
- my::Json root(jsonStr.c_str());
+ base::Json root(jsonStr.c_str());
DeserializeFromJSONImpl(root.get());
return true;
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LWARNING, ("Can't parse sample:", e.Msg(), jsonStr));
}
return false;
}
-my::JSONPtr Sample::SerializeToJSON() const
+base::JSONPtr Sample::SerializeToJSON() const
{
- auto json = my::NewJSONObject();
+ auto json = base::NewJSONObject();
SerializeToJSONImpl(*json);
return json;
}
@@ -238,9 +238,9 @@ void FromJSON(json_t * root, Sample::Result & result)
FromJSONObject(root, "relevancy", result.m_relevance);
}
-my::JSONPtr ToJSON(Sample::Result const & result)
+base::JSONPtr ToJSON(Sample::Result const & result)
{
- auto root = my::NewJSONObject();
+ auto root = base::NewJSONObject();
ToJSONObject(*root, "position", result.m_pos);
ToJSONObject(*root, "name", result.m_name);
ToJSONObject(*root, "houseNumber", result.m_houseNumber);
diff --git a/search/search_quality/sample.hpp b/search/search_quality/sample.hpp
index 0532edf093..d63ed37d89 100644
--- a/search/search_quality/sample.hpp
+++ b/search/search_quality/sample.hpp
@@ -42,7 +42,7 @@ struct Sample
};
bool DeserializeFromJSON(std::string const & jsonStr);
- my::JSONPtr SerializeToJSON() const;
+ base::JSONPtr SerializeToJSON() const;
static bool DeserializeFromJSONLines(std::string const & lines, std::vector<Sample> & samples);
static void SerializeToJSONLines(std::vector<Sample> const & samples, std::string & lines);
@@ -70,7 +70,7 @@ void FromJSONObject(json_t * root, std::string const & field,
void ToJSONObject(json_t & root, std::string const & field, Sample::Result::Relevance relevance);
void FromJSON(json_t * root, Sample::Result & result);
-my::JSONPtr ToJSON(Sample::Result const & result);
+base::JSONPtr ToJSON(Sample::Result const & result);
std::string DebugPrint(Sample::Result::Relevance r);
diff --git a/search/search_quality/search_quality_tool/search_quality_tool.cpp b/search/search_quality/search_quality_tool/search_quality_tool.cpp
index 4b08a69260..6f09d47b7c 100644
--- a/search/search_quality/search_quality_tool/search_quality_tool.cpp
+++ b/search/search_quality/search_quality_tool/search_quality_tool.cpp
@@ -217,7 +217,7 @@ int FindResult(DataSource & dataSource, string const & mwmName, uint32_t const f
{
auto const & r = results[i];
if (r.HasPoint() &&
- my::AlmostEqualAbs(r.GetFeatureCenter(), MercatorBounds::FromLatLon(lat, lon), kEps))
+ base::AlmostEqualAbs(r.GetFeatureCenter(), MercatorBounds::FromLatLon(lat, lon), kEps))
{
double const dist = MercatorBounds::DistanceOnEarth(r.GetFeatureCenter(),
MercatorBounds::FromLatLon(lat, lon));
@@ -282,12 +282,12 @@ void ParseCompletenessQuery(string & s, CompletenessQuery & q)
void CheckCompleteness(string const & path, m2::RectD const & viewport, DataSource & dataSource,
TestSearchEngine & engine)
{
- my::ScopedLogAbortLevelChanger const logAbortLevel(LCRITICAL);
+ base::ScopedLogAbortLevelChanger const logAbortLevel(LCRITICAL);
ifstream stream(path.c_str());
CHECK(stream.is_open(), ("Can't open", path));
- my::Timer timer;
+ base::Timer timer;
uint32_t totalQueries = 0;
uint32_t malformedQueries = 0;
@@ -359,7 +359,7 @@ int main(int argc, char * argv[])
if (!FLAGS_data_path.empty())
{
platform.SetResourceDir(FLAGS_data_path);
- countriesFile = my::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE);
+ countriesFile = base::JoinFoldersToPath(FLAGS_data_path, COUNTRIES_FILE);
}
if (!FLAGS_mwm_path.empty())
@@ -432,7 +432,7 @@ int main(int argc, char * argv[])
vector<string> queries;
string queriesPath = FLAGS_queries_path;
if (queriesPath.empty())
- queriesPath = my::JoinFoldersToPath(platform.WritableDir(), kDefaultQueriesPathSuffix);
+ queriesPath = base::JoinFoldersToPath(platform.WritableDir(), kDefaultQueriesPathSuffix);
ReadStringsFromFile(queriesPath, queries);
vector<unique_ptr<TestSearchRequest>> requests;
diff --git a/search/search_tests/interval_set_test.cpp b/search/search_tests/interval_set_test.cpp
index b22f73c1ce..d0d7907384 100644
--- a/search/search_tests/interval_set_test.cpp
+++ b/search/search_tests/interval_set_test.cpp
@@ -2,124 +2,126 @@
#include "search/interval_set.hpp"
-#include "std/initializer_list.hpp"
+#include <initializer_list>
+#include <set>
+#include <vector>
-using namespace my;
+using namespace base;
namespace
{
-template <typename TElem>
-using TInterval = typename IntervalSet<TElem>::TInterval;
+template <typename Elem>
+using Interval = typename search::IntervalSet<Elem>::Interval;
-template <typename TElem>
-void CheckSet(IntervalSet<TElem> const & actual, initializer_list<TInterval<TElem>> intervals)
+template <typename Elem>
+void CheckSet(search::IntervalSet<Elem> const & actual, std::initializer_list<Interval<Elem>> intervals)
{
- set<TInterval<TElem>> expected(intervals);
+ std::set<Interval<Elem>> expected(intervals);
TEST_EQUAL(actual.Elems(), expected, ());
}
} // namespace
UNIT_TEST(IntervalSet_Add)
{
- IntervalSet<int> set;
+ search::IntervalSet<int> set;
TEST(set.Elems().empty(), ());
- set.Add(TInterval<int>(0, 2));
- CheckSet(set, {TInterval<int>(0, 2)});
+ set.Add(Interval<int>(0, 2));
+ CheckSet(set, {Interval<int>(0, 2)});
- set.Add(TInterval<int>(1, 3));
- CheckSet(set, {TInterval<int>(0, 3)});
+ set.Add(Interval<int>(1, 3));
+ CheckSet(set, {Interval<int>(0, 3)});
- set.Add(TInterval<int>(-2, 0));
- CheckSet(set, {TInterval<int>(-2, 3)});
+ set.Add(Interval<int>(-2, 0));
+ CheckSet(set, {Interval<int>(-2, 3)});
- set.Add(TInterval<int>(-4, -3));
- CheckSet(set, {TInterval<int>(-4, -3), TInterval<int>(-2, 3)});
+ set.Add(Interval<int>(-4, -3));
+ CheckSet(set, {Interval<int>(-4, -3), Interval<int>(-2, 3)});
- set.Add(TInterval<int>(7, 10));
- CheckSet(set, {TInterval<int>(-4, -3), TInterval<int>(-2, 3), TInterval<int>(7, 10)});
+ set.Add(Interval<int>(7, 10));
+ CheckSet(set, {Interval<int>(-4, -3), Interval<int>(-2, 3), Interval<int>(7, 10)});
- set.Add(TInterval<int>(-3, -2));
- CheckSet(set, {TInterval<int>(-4, 3), TInterval<int>(7, 10)});
+ set.Add(Interval<int>(-3, -2));
+ CheckSet(set, {Interval<int>(-4, 3), Interval<int>(7, 10)});
- set.Add(TInterval<int>(2, 8));
- CheckSet(set, {TInterval<int>(-4, 10)});
+ set.Add(Interval<int>(2, 8));
+ CheckSet(set, {Interval<int>(-4, 10)});
- set.Add(TInterval<int>(2, 3));
- CheckSet(set, {TInterval<int>(-4, 10)});
+ set.Add(Interval<int>(2, 3));
+ CheckSet(set, {Interval<int>(-4, 10)});
}
UNIT_TEST(IntervalSet_AdjacentIntervalAdd)
{
- IntervalSet<int> set;
+ search::IntervalSet<int> set;
TEST(set.Elems().empty(), ());
- set.Add(TInterval<int>(100, 106));
- CheckSet(set, {TInterval<int>(100, 106)});
+ set.Add(Interval<int>(100, 106));
+ CheckSet(set, {Interval<int>(100, 106)});
- set.Add(TInterval<int>(106, 110));
- CheckSet(set, {TInterval<int>(100, 110)});
+ set.Add(Interval<int>(106, 110));
+ CheckSet(set, {Interval<int>(100, 110)});
- set.Add(TInterval<int>(90, 100));
- CheckSet(set, {TInterval<int>(90, 110)});
+ set.Add(Interval<int>(90, 100));
+ CheckSet(set, {Interval<int>(90, 110)});
}
UNIT_TEST(IntervalSet_SubtractFrom)
{
- IntervalSet<int> set;
+ search::IntervalSet<int> set;
TEST(set.Elems().empty(), ());
- set.Add(TInterval<int>(0, 2));
- set.Add(TInterval<int>(4, 7));
- set.Add(TInterval<int>(10, 11));
+ set.Add(Interval<int>(0, 2));
+ set.Add(Interval<int>(4, 7));
+ set.Add(Interval<int>(10, 11));
- CheckSet(set, {TInterval<int>(0, 2), TInterval<int>(4, 7), TInterval<int>(10, 11)});
+ CheckSet(set, {Interval<int>(0, 2), Interval<int>(4, 7), Interval<int>(10, 11)});
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(1, 5), difference);
- vector<TInterval<int>> expected{TInterval<int>(2, 4)};
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(1, 5), difference);
+ std::vector<Interval<int>> expected{Interval<int>(2, 4)};
TEST_EQUAL(difference, expected, ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(-10, -5), difference);
- vector<TInterval<int>> expected{TInterval<int>(-10, -5)};
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(-10, -5), difference);
+ std::vector<Interval<int>> expected{Interval<int>(-10, -5)};
TEST_EQUAL(difference, expected, ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(0, 11), difference);
- vector<TInterval<int>> expected{TInterval<int>(2, 4), TInterval<int>(7, 10)};
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(0, 11), difference);
+ std::vector<Interval<int>> expected{Interval<int>(2, 4), Interval<int>(7, 10)};
TEST_EQUAL(difference, expected, ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(-1, 11), difference);
- vector<TInterval<int>> expected{TInterval<int>(-1, 0), TInterval<int>(2, 4),
- TInterval<int>(7, 10)};
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(-1, 11), difference);
+ std::vector<Interval<int>> expected{Interval<int>(-1, 0), Interval<int>(2, 4),
+ Interval<int>(7, 10)};
TEST_EQUAL(difference, expected, ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(5, 7), difference);
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(5, 7), difference);
TEST(difference.empty(), ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(4, 7), difference);
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(4, 7), difference);
TEST(difference.empty(), ());
}
{
- vector<TInterval<int>> difference;
- set.SubtractFrom(TInterval<int>(3, 7), difference);
- vector<TInterval<int>> expected{TInterval<int>(3, 4)};
+ std::vector<Interval<int>> difference;
+ set.SubtractFrom(Interval<int>(3, 7), difference);
+ std::vector<Interval<int>> expected{Interval<int>(3, 4)};
TEST_EQUAL(difference, expected, ());
}
}
diff --git a/search/search_tests/keyword_matcher_test.cpp b/search/search_tests/keyword_matcher_test.cpp
index 0132f1f4ac..f6655b6a44 100644
--- a/search/search_tests/keyword_matcher_test.cpp
+++ b/search/search_tests/keyword_matcher_test.cpp
@@ -9,12 +9,14 @@
#include "base/buffer_vector.hpp"
#include "base/stl_helpers.hpp"
-#include "std/sstream.hpp"
-#include "std/vector.hpp"
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
namespace
{
-
using search::KeywordMatcher;
using search::kMaxNumTokens;
@@ -131,9 +133,7 @@ void TestKeywordMatcher(char const * const query, KeywordMatcherTestCase const (
prevScore = testScore;
}
}
-
-} // unnamed namespace
-
+} // namespace
UNIT_TEST(KeywordMatcher_Prefix)
{
@@ -246,7 +246,6 @@ UNIT_TEST(KeywordMatcher_KeywordAndKeyword)
namespace
{
-
string GetManyTokens(string tokenPrefix, int tokenCount, bool countForward = true)
{
ostringstream out;
diff --git a/search/search_tests/latlon_match_test.cpp b/search/search_tests/latlon_match_test.cpp
index d91df5379f..2f59288668 100644
--- a/search/search_tests/latlon_match_test.cpp
+++ b/search/search_tests/latlon_match_test.cpp
@@ -13,7 +13,7 @@ double const kEps = 1e-12;
void TestAlmostEqual(double actual, double expected)
{
- TEST(my::AlmostEqualAbsOrRel(actual, expected, kEps), (actual, expected));
+ TEST(base::AlmostEqualAbsOrRel(actual, expected, kEps), (actual, expected));
}
UNIT_TEST(LatLon_Degree_Match)
diff --git a/search/search_tests_support/helpers.hpp b/search/search_tests_support/helpers.hpp
index a14996c91b..7580bb5874 100644
--- a/search/search_tests_support/helpers.hpp
+++ b/search/search_tests_support/helpers.hpp
@@ -51,7 +51,7 @@ public:
protected:
void OnMwmBuilt(MwmInfo const & /* info */) override;
- my::ScopedLogLevelChanger m_scopedLog;
+ base::ScopedLogLevelChanger m_scopedLog;
tests_support::TestSearchEngine m_engine;
diff --git a/search/search_tests_support/test_search_request.hpp b/search/search_tests_support/test_search_request.hpp
index 8895098287..9f686cf8be 100644
--- a/search/search_tests_support/test_search_request.hpp
+++ b/search/search_tests_support/test_search_request.hpp
@@ -62,7 +62,7 @@ protected:
vector<search::Result> m_results;
bool m_done = false;
- my::Timer m_timer;
+ base::Timer m_timer;
steady_clock::duration m_startTime;
steady_clock::duration m_endTime;
diff --git a/search/street_vicinity_loader.cpp b/search/street_vicinity_loader.cpp
index f33244277d..55bf2eca98 100644
--- a/search/street_vicinity_loader.cpp
+++ b/search/street_vicinity_loader.cpp
@@ -25,7 +25,7 @@ void StreetVicinityLoader::SetContext(MwmContext * context)
m_context = context;
auto const scaleRange = m_context->m_value.GetHeader().GetScaleRange();
- m_scale = my::clamp(m_scale, scaleRange.first, scaleRange.second);
+ m_scale = base::clamp(m_scale, scaleRange.first, scaleRange.second);
}
void StreetVicinityLoader::OnQueryFinished() { m_cache.ClearIfNeeded(); }
diff --git a/search/token_range.hpp b/search/token_range.hpp
index 03865fca5f..4ea26a967e 100644
--- a/search/token_range.hpp
+++ b/search/token_range.hpp
@@ -62,11 +62,11 @@ public:
inline size_t Begin() const { return m_begin; }
inline size_t End() const { return m_end; }
- inline my::RangeIterator<size_t> begin() const { return my::RangeIterator<size_t>(m_begin); }
- inline my::RangeIterator<size_t> end() const { return my::RangeIterator<size_t>(m_end); }
+ inline base::RangeIterator<size_t> begin() const { return base::RangeIterator<size_t>(m_begin); }
+ inline base::RangeIterator<size_t> end() const { return base::RangeIterator<size_t>(m_end); }
- inline my::RangeIterator<size_t> cbegin() const { return my::RangeIterator<size_t>(m_begin); }
- inline my::RangeIterator<size_t> cend() const { return my::RangeIterator<size_t>(m_end); }
+ inline base::RangeIterator<size_t> cbegin() const { return base::RangeIterator<size_t>(m_begin); }
+ inline base::RangeIterator<size_t> cend() const { return base::RangeIterator<size_t>(m_end); }
private:
friend std::string DebugPrint(TokenRange const & tokenRange);
diff --git a/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp b/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp
index 433ba485ee..a3d06af0b6 100644
--- a/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp
+++ b/shaders/shaders_tests/gl_shaders_mobile_compile_test.cpp
@@ -120,14 +120,14 @@ void TestShaders(dp::ApiVersion apiVersion, std::string const & defines,
std::string GetCompilerPath(std::string const & compilerName)
{
Platform & platform = GetPlatform();
- std::string compilerPath = my::JoinFoldersToPath(kCompilersDir, compilerName);
+ std::string compilerPath = base::JoinFoldersToPath(kCompilersDir, compilerName);
if (platform.IsFileExistsByFullPath(compilerPath))
return compilerPath;
- compilerPath = my::JoinFoldersToPath({platform.ResourcesDir(), kCompilersDir}, compilerName);
+ compilerPath = base::JoinFoldersToPath({platform.ResourcesDir(), kCompilersDir}, compilerName);
if (!platform.IsFileExistsByFullPath(compilerPath))
{
- compilerPath = my::JoinFoldersToPath({platform.WritableDir(), kCompilersDir}, compilerName);
+ compilerPath = base::JoinFoldersToPath({platform.WritableDir(), kCompilersDir}, compilerName);
TEST(platform.IsFileExistsByFullPath(compilerPath), ("GLSL compiler not found"));
}
return compilerPath;
diff --git a/skin_generator/generator.cpp b/skin_generator/generator.cpp
index 4262327f10..c75c5e3226 100644
--- a/skin_generator/generator.cpp
+++ b/skin_generator/generator.cpp
@@ -78,7 +78,7 @@ void correctColors(gil::bgra8_image_t & image)
{
gil::bgra8_pixel_t pixel = view(x, y);
auto color = static_cast<unsigned char>(
- my::clamp(0.07 * pixel[0] + 0.5 * pixel[1] + 0.22 * pixel[2], 0.0, 255.0));
+ base::clamp(0.07 * pixel[0] + 0.5 * pixel[1] + 0.22 * pixel[2], 0.0, 255.0));
view(x, y)[0] = color;
view(x, y)[1] = color;
diff --git a/software_renderer/circle_info.hpp b/software_renderer/circle_info.hpp
index f31d2ea4ed..df7d5e9d7a 100644
--- a/software_renderer/circle_info.hpp
+++ b/software_renderer/circle_info.hpp
@@ -19,10 +19,10 @@ struct CircleInfo
bool isOutlined = false,
double outlineWidth = 1,
dp::Color const & outlineColor = dp::Color(255, 255, 255, 255))
- : m_radius(my::rounds(radius))
+ : m_radius(base::rounds(radius))
, m_color(color)
, m_isOutlined(isOutlined)
- , m_outlineWidth(my::rounds(outlineWidth))
+ , m_outlineWidth(base::rounds(outlineWidth))
, m_outlineColor(outlineColor)
{
if (!m_isOutlined)
diff --git a/software_renderer/cpu_drawer.cpp b/software_renderer/cpu_drawer.cpp
index d77f2c0974..3309a6042d 100644
--- a/software_renderer/cpu_drawer.cpp
+++ b/software_renderer/cpu_drawer.cpp
@@ -289,7 +289,7 @@ void CPUDrawer::DrawSearchArrow(double azimut)
}
double cosa = cos(azIn2Pi);
- if (!my::AlmostEqualULPs(cosa, 0.0))
+ if (!base::AlmostEqualULPs(cosa, 0.0))
length = length / fabs(cosa);
m2::PointD offsetPoint(length - 0.65 * symbolRect.SizeY(), 0.0);
@@ -691,7 +691,7 @@ ScreenBase CPUDrawer::CalculateScreen(m2::PointD const & center, int zoomModifie
int baseZoom = df::GetDrawTileScale(rect, tileSize, m_visualScale);
resultZoom = baseZoom + zoomModifier;
int const minZoom = symbols.m_bottomZoom == -1 ? resultZoom : symbols.m_bottomZoom;
- resultZoom = my::clamp(resultZoom, minZoom, scales::GetUpperScale());
+ resultZoom = base::clamp(resultZoom, minZoom, scales::GetUpperScale());
rect = df::GetRectForDrawScale(resultZoom, rect.Center(), tileSize, m_visualScale);
df::CheckMinGlobalRect(rect, tileSize, m_visualScale);
diff --git a/software_renderer/feature_styler.cpp b/software_renderer/feature_styler.cpp
index f744dd07c0..78537da09f 100644
--- a/software_renderer/feature_styler.cpp
+++ b/software_renderer/feature_styler.cpp
@@ -34,7 +34,7 @@ namespace software_renderer
{
DrawRule::DrawRule(drule::BaseRule const * p, double depth)
: m_rule(p)
- , m_depth(my::clamp(depth, static_cast<double>(minDepth), static_cast<double>(maxDepth)))
+ , m_depth(base::clamp(depth, static_cast<double>(minDepth), static_cast<double>(maxDepth)))
{
}
diff --git a/software_renderer/geometry_processors.cpp b/software_renderer/geometry_processors.cpp
index 2486dc2d52..21251a1c3c 100644
--- a/software_renderer/geometry_processors.cpp
+++ b/software_renderer/geometry_processors.cpp
@@ -53,7 +53,7 @@ void get_path_intervals::operator()(m2::PointD const & pt)
}
else
{
- if (my::AlmostEqualULPs(m_intervals->back(), clipStart))
+ if (base::AlmostEqualULPs(m_intervals->back(), clipStart))
m_intervals->back() = clipEnd;
else
{
diff --git a/storage/country.cpp b/storage/country.cpp
index 5d290a309c..8388becbca 100644
--- a/storage/country.cpp
+++ b/storage/country.cpp
@@ -166,11 +166,11 @@ bool LoadCountriesSingleMwmsImpl(string const & jsonBuffer, StoreSingleMwmInterf
{
try
{
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
LoadGroupSingleMwmsImpl(0 /* depth */, root.get(), kInvalidCountryId, store);
return true;
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
return false;
@@ -286,11 +286,11 @@ bool LoadCountriesTwoComponentMwmsImpl(string const & jsonBuffer,
{
try
{
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
LoadGroupTwoComponentMwmsImpl(0 /* depth */, root.get(), kInvalidCountryId, store);
return true;
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
return false;
@@ -307,7 +307,7 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, TCountryTree & countr
int64_t version = -1;
try
{
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
FromJSONObject(root.get(), "v", version);
if (version::IsSingleMwm(version))
@@ -325,7 +325,7 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, TCountryTree & countr
return -1;
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
}
@@ -348,7 +348,7 @@ void LoadCountryFile2CountryInfo(string const & jsonBuffer, map<string, CountryI
int64_t version = -1;
try
{
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
FromJSONObjectOptionalField(root.get(), "v", version);
isSingleMwm = version::IsSingleMwm(version);
if (isSingleMwm)
@@ -362,7 +362,7 @@ void LoadCountryFile2CountryInfo(string const & jsonBuffer, map<string, CountryI
LoadCountriesTwoComponentMwmsImpl(jsonBuffer, store);
}
}
- catch (my::Json::Exception const & e)
+ catch (base::Json::Exception const & e)
{
LOG(LERROR, (e.Msg()));
}
diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp
index 35cf34f722..db807faed3 100644
--- a/storage/country_info_getter.hpp
+++ b/storage/country_info_getter.hpp
@@ -157,7 +157,7 @@ protected:
std::result_of_t<TFn(vector<m2::RegionD>)> WithRegion(size_t id, TFn && fn) const;
FilesContainerR m_reader;
- mutable my::Cache<uint32_t, std::vector<m2::RegionD>> m_cache;
+ mutable base::Cache<uint32_t, std::vector<m2::RegionD>> m_cache;
mutable std::mutex m_cacheMutex;
};
diff --git a/storage/diff_scheme/diff_manager.cpp b/storage/diff_scheme/diff_manager.cpp
index 3a2246ce25..589fc0b343 100644
--- a/storage/diff_scheme/diff_manager.cpp
+++ b/storage/diff_scheme/diff_manager.cpp
@@ -62,7 +62,7 @@ void Manager::ApplyDiff(ApplyDiffParams && p, std::function<void(bool const resu
diffFile->SyncWithDisk();
auto const isOnDisk = diffFile->OnDisk(MapOptions::Diff);
- auto const isFilePrepared = isOnDisk || my::RenameFileX(diffReadyPath, diffPath);
+ auto const isFilePrepared = isOnDisk || base::RenameFileX(diffReadyPath, diffPath);
if (isFilePrepared)
{
@@ -74,7 +74,7 @@ void Manager::ApplyDiff(ApplyDiffParams && p, std::function<void(bool const resu
string const newMwmPath = diffFile->GetPath(MapOptions::Map);
string const diffApplyingInProgressPath = newMwmPath + DIFF_APPLYING_FILE_EXTENSION;
result = generator::mwm_diff::ApplyDiff(oldMwmPath, diffApplyingInProgressPath, diffPath) &&
- my::RenameFileX(diffApplyingInProgressPath, newMwmPath);
+ base::RenameFileX(diffApplyingInProgressPath, newMwmPath);
}
diffFile->DeleteFromDisk(MapOptions::Diff);
diff --git a/storage/diff_scheme/diff_scheme_checker.cpp b/storage/diff_scheme/diff_scheme_checker.cpp
index 0751dea5b0..700e1aa212 100644
--- a/storage/diff_scheme/diff_scheme_checker.cpp
+++ b/storage/diff_scheme/diff_scheme_checker.cpp
@@ -31,16 +31,16 @@ auto const kTimeoutInSeconds = 5.0;
string SerializeCheckerData(LocalMapsInfo const & info)
{
- auto mwmsArrayNode = my::NewJSONArray();
+ auto mwmsArrayNode = base::NewJSONArray();
for (auto const & nameAndVersion : info.m_localMaps)
{
- auto node = my::NewJSONObject();
+ auto node = base::NewJSONObject();
ToJSONObject(*node, kNameKey, nameAndVersion.first);
ToJSONObject(*node, kVersionKey, nameAndVersion.second);
json_array_append_new(mwmsArrayNode.get(), node.release());
}
- auto const root = my::NewJSONObject();
+ auto const root = base::NewJSONObject();
json_object_set_new(root.get(), kMwmsKey, mwmsArrayNode.release());
ToJSONObject(*root, kMaxVersionKey, info.m_currentDataVersion);
unique_ptr<char, JSONFreeDeleter> buffer(json_dumps(root.get(), JSON_COMPACT | JSON_ENSURE_ASCII));
@@ -55,7 +55,7 @@ NameDiffInfoMap DeserializeResponse(string const & response, LocalMapsInfo::Name
return NameDiffInfoMap{};
}
- my::Json const json(response.c_str());
+ base::Json const json(response.c_str());
if (json.get() == nullptr)
return NameDiffInfoMap{};
diff --git a/storage/downloading_policy.hpp b/storage/downloading_policy.hpp
index e7e12f6a8b..e4c037f7cf 100644
--- a/storage/downloading_policy.hpp
+++ b/storage/downloading_policy.hpp
@@ -22,7 +22,7 @@ class StorageDownloadingPolicy : public DownloadingPolicy
bool m_downloadRetryFailed = false;
static size_t constexpr kAutoRetryCounterMax = 3;
size_t m_autoRetryCounter = kAutoRetryCounterMax;
- my::DeferredTask m_autoRetryWorker;
+ base::DeferredTask m_autoRetryWorker;
time_point<steady_clock> m_disableCellularTime;
diff --git a/storage/storage.cpp b/storage/storage.cpp
index ac88316151..a5296d5c7c 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -202,7 +202,7 @@ void Storage::Migrate(TCountriesVec const & existedCountries)
auto localFile = PreparePlaceForCountryFiles(GetCurrentDataVersion(), m_dataDir, countryFile);
string localFilename = localFile->GetPath(MapOptions::Map);
LOG_SHORT(LINFO, ("Move", prefetchedFilename, "to", localFilename));
- my::RenameFileX(prefetchedFilename, localFilename);
+ base::RenameFileX(prefetchedFilename, localFilename);
}
// Remove empty migrate folder
@@ -654,7 +654,7 @@ void Storage::DownloadNextFile(QueuedCountry const & country)
if (opt == MapOptions::Diff)
{
string filePath = readyFilePath;
- my::GetNameWithoutExt(filePath);
+ base::GetNameWithoutExt(filePath);
isDownloadedDiff = p.GetFileSizeByFullPath(filePath, size);
}
@@ -772,7 +772,7 @@ void Storage::OnMapFileDownloadFinished(HttpRequest::Status status,
{
GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kMapLastDownloaded, countryId);
char nowStr[18]{};
- tm now = my::GmTime(time(nullptr));
+ tm now = base::GmTime(time(nullptr));
strftime(nowStr, sizeof(nowStr), "%Y-%m-%d %H:%M", &now);
GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kMapLastDownloadedTimestamp,
std::string(nowStr));
@@ -947,7 +947,7 @@ void Storage::RegisterDownloadedFiles(TCountryId const & countryId, MapOptions o
if (!HasOptions(options, file))
continue;
string const path = GetFileDownloadPath(countryId, file);
- if (!my::RenameFileX(path, localFile->GetPath(file)))
+ if (!base::RenameFileX(path, localFile->GetPath(file)))
{
ok = false;
break;
diff --git a/storage/storage_integration_tests/storage_3levels_tests.cpp b/storage/storage_integration_tests/storage_3levels_tests.cpp
index 8f82fcca93..e342872559 100644
--- a/storage/storage_integration_tests/storage_3levels_tests.cpp
+++ b/storage/storage_integration_tests/storage_3levels_tests.cpp
@@ -46,7 +46,7 @@ UNIT_TEST(SmallMwms_3levels_Test)
TEST_EQUAL(3, GetLevelCount(storage, kCountryId), ());
- string const mapDir = my::JoinFoldersToPath(platform.WritableDir(), version);
+ string const mapDir = base::JoinFoldersToPath(platform.WritableDir(), version);
auto onProgressFn = [&](TCountryId const & countryId, TLocalAndRemoteSize const & mapSize)
{
diff --git a/storage/storage_integration_tests/storage_group_download_tests.cpp b/storage/storage_integration_tests/storage_group_download_tests.cpp
index d3ce0010d9..2b3c36e1e8 100644
--- a/storage/storage_integration_tests/storage_group_download_tests.cpp
+++ b/storage/storage_integration_tests/storage_group_download_tests.cpp
@@ -35,20 +35,20 @@ TCountriesSet const kLeafCountriesIds = {"Tokelau",
string GetMwmFilePath(string const & version, TCountryId const & countryId)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- countryId + DATA_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION);
}
string GetMwmDownloadingFilePath(string const & version, TCountryId const & countryId)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- countryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION DOWNLOADING_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION DOWNLOADING_FILE_EXTENSION);
}
string GetMwmResumeFilePath(string const & version, TCountryId const & countryId)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- countryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION RESUME_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION RESUME_FILE_EXTENSION);
}
void DownloadGroup(Storage & storage, bool oneByOne)
diff --git a/storage/storage_integration_tests/storage_http_tests.cpp b/storage/storage_integration_tests/storage_http_tests.cpp
index 19b06122d4..d6aeabe38f 100644
--- a/storage/storage_integration_tests/storage_http_tests.cpp
+++ b/storage/storage_integration_tests/storage_http_tests.cpp
@@ -40,20 +40,20 @@ void UpdateWithoutChecks(TCountryId const &, TLocalFilePtr const /* localCountry
string const GetMwmFullPath(string const & countryId, string const & version)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- countryId + DATA_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION);
}
string const GetDownloadingFullPath(string const & countryId, string const & version)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- kCountryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION DOWNLOADING_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ kCountryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION DOWNLOADING_FILE_EXTENSION);
}
string const GetResumeFullPath(string const & countryId, string const & version)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- kCountryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION RESUME_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ kCountryId + DATA_FILE_EXTENSION READY_FILE_EXTENSION RESUME_FILE_EXTENSION);
}
void InitStorage(Storage & storage, Storage::TUpdateCallback const & didDownload,
diff --git a/storage/storage_integration_tests/storage_update_tests.cpp b/storage/storage_integration_tests/storage_update_tests.cpp
index fa39c78862..b28bf40517 100644
--- a/storage/storage_integration_tests/storage_update_tests.cpp
+++ b/storage/storage_integration_tests/storage_update_tests.cpp
@@ -66,13 +66,13 @@ string GetCountriesTxtWebUrl(string const version)
string GetCountriesTxtFilePath()
{
- return my::JoinFoldersToPath(GetPlatform().WritableDir(), kCountriesTxtFile);
+ return base::JoinFoldersToPath(GetPlatform().WritableDir(), kCountriesTxtFile);
}
string GetMwmFilePath(string const & version, TCountryId const & countryId)
{
- return my::JoinFoldersToPath({GetPlatform().WritableDir(), version},
- countryId + DATA_FILE_EXTENSION);
+ return base::JoinFoldersToPath({GetPlatform().WritableDir(), version},
+ countryId + DATA_FILE_EXTENSION);
}
} // namespace
@@ -123,7 +123,7 @@ UNIT_TEST(SmallMwms_Update_Test)
}
// Replace countries.txt by version 2
- TEST(my::DeleteFileX(GetCountriesTxtFilePath()), ());
+ TEST(base::DeleteFileX(GetCountriesTxtFilePath()), ());
TEST(DownloadFile(GetCountriesTxtWebUrl(kMwmVersion2), GetCountriesTxtFilePath(), kCountriesTxtFileSize2), ());
{
diff --git a/storage/storage_tests/helpers.cpp b/storage/storage_tests/helpers.cpp
index f53d424923..2f92714b29 100644
--- a/storage/storage_tests/helpers.cpp
+++ b/storage/storage_tests/helpers.cpp
@@ -21,9 +21,9 @@ unique_ptr<storage::CountryInfoGetter> CreateCountryInfoGetterMigrate()
bool AlmostEqualRectsAbs(const m2::RectD & r1, const m2::RectD & r2)
{
double constexpr kEpsilon = 1e-3;
- return my::AlmostEqualAbs(r1.maxX(), r2.maxX(), kEpsilon)
- && my::AlmostEqualAbs(r1.maxY(), r2.maxY(), kEpsilon)
- && my::AlmostEqualAbs(r1.minX(), r2.minX(), kEpsilon)
- && my::AlmostEqualAbs(r1.minY(), r2.minY(), kEpsilon);
+ return base::AlmostEqualAbs(r1.maxX(), r2.maxX(), kEpsilon)
+ && base::AlmostEqualAbs(r1.maxY(), r2.maxY(), kEpsilon)
+ && base::AlmostEqualAbs(r1.minX(), r2.minX(), kEpsilon)
+ && base::AlmostEqualAbs(r1.minY(), r2.minY(), kEpsilon);
}
} // namespace storage
diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp
index e5f94f7814..9e4d9ca6e0 100644
--- a/storage/storage_tests/storage_tests.cpp
+++ b/storage/storage_tests/storage_tests.cpp
@@ -1216,7 +1216,7 @@ UNIT_TEST(StorageTest_TwoInstance)
platform::tests_support::ScopedDir removeTestDir1(testDir1);
UNUSED_VALUE(removeTestDir1);
string const versionDir1 =
- my::JoinFoldersToPath(testDir1, strings::to_string(storage1.GetCurrentDataVersion()));
+ base::JoinFoldersToPath(testDir1, strings::to_string(storage1.GetCurrentDataVersion()));
platform::tests_support::ScopedDir removeVersionDir1(versionDir1);
UNUSED_VALUE(removeVersionDir1);
TaskRunner runner1;
@@ -1227,7 +1227,7 @@ UNIT_TEST(StorageTest_TwoInstance)
platform::tests_support::ScopedDir removeTestDir2(testDir2);
UNUSED_VALUE(removeTestDir2);
string const versionDir2 =
- my::JoinFoldersToPath(testDir2, strings::to_string(storage2.GetCurrentDataVersion()));
+ base::JoinFoldersToPath(testDir2, strings::to_string(storage2.GetCurrentDataVersion()));
platform::tests_support::ScopedDir removeVersionDir2(versionDir2);
UNUSED_VALUE(removeVersionDir2);
TaskRunner runner2;
@@ -1241,7 +1241,7 @@ UNIT_TEST(StorageTest_TwoInstance)
auto const checker = AbsentCountryDownloaderChecker(storage1, uruguayId, MapOptions::Map);
checker->StartDownload();
runner1.Run();
- TEST(platform.IsFileExistsByFullPath(my::JoinFoldersToPath(writableDir, versionDir1)), ());
+ TEST(platform.IsFileExistsByFullPath(base::JoinFoldersToPath(writableDir, versionDir1)), ());
}
storage2.DeleteCountry(uruguayId, MapOptions::Map);
@@ -1251,7 +1251,7 @@ UNIT_TEST(StorageTest_TwoInstance)
auto const checker = AbsentCountryDownloaderChecker(storage2, uruguayId, MapOptions::Map);
checker->StartDownload();
runner2.Run();
- TEST(platform.IsFileExistsByFullPath(my::JoinFoldersToPath(writableDir, versionDir1)), ());
+ TEST(platform.IsFileExistsByFullPath(base::JoinFoldersToPath(writableDir, versionDir1)), ());
}
}
@@ -1410,7 +1410,7 @@ UNIT_TEST(StorageTest_GetUpdateInfoSingleMwm)
classificator::Load();
WritableDirChanger writableDirChanger(kMapTestDir);
- string const kVersion1Dir = my::JoinFoldersToPath(GetPlatform().WritableDir(), "1");
+ string const kVersion1Dir = base::JoinFoldersToPath(GetPlatform().WritableDir(), "1");
CHECK_EQUAL(Platform::MkDir(kVersion1Dir), Platform::ERR_OK, ());
LocalCountryFile country1(kVersion1Dir, CountryFile("OutdatedCountry1"), 1);
diff --git a/testing/benchmark.hpp b/testing/benchmark.hpp
index dea7407714..f4a1018cf0 100644
--- a/testing/benchmark.hpp
+++ b/testing/benchmark.hpp
@@ -1,10 +1,13 @@
#pragma once
+
#include "testing/testing.hpp"
#include "testing/testregister.hpp"
+
#include "base/timer.hpp"
-#include "std/iostream.hpp"
-namespace my
+#include <iostream>
+
+namespace base
{
class BenchmarkNTimes
{
@@ -19,24 +22,24 @@ namespace my
double const secondsElapsed = m_Timer.ElapsedSeconds();
TEST_GREATER(m_RepeatCount, 0, ());
TEST_LESS_OR_EQUAL(secondsElapsed, m_MaxSecondsToSucceed, (m_RepeatCount));
- cout << secondsElapsed << "s total";
+ std::cout << secondsElapsed << "s total";
if (secondsElapsed > 0)
{
- cout << ", " << static_cast<int>(m_RepeatCount / secondsElapsed) << "/s, ";
+ std::cout << ", " << static_cast<int>(m_RepeatCount / secondsElapsed) << "/s, ";
/*
if (secondsElapsed / m_RepeatCount * 1000 >= 10)
- cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000) << "ms each";
+ std::cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000) << "ms each";
else */ if (secondsElapsed / m_RepeatCount * 1000000 >= 10)
- cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000000) << "us each";
+ std::cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000000) << "us each";
else
- cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000000000) << "ns each";
+ std::cout << static_cast<int>(secondsElapsed / m_RepeatCount * 1000000000) << "ns each";
}
- cout << " ...";
+ std::cout << " ...";
}
- inline int Iteration() const { return m_Iteration; }
- inline bool ContinueIterating() const { return m_Iteration < m_RepeatCount; }
- inline void NextIteration() { ++m_Iteration; }
+ int Iteration() const { return m_Iteration; }
+ bool ContinueIterating() const { return m_Iteration < m_RepeatCount; }
+ void NextIteration() { ++m_Iteration; }
private:
int const m_RepeatCount;
@@ -44,7 +47,7 @@ namespace my
int m_Iteration;
Timer m_Timer;
};
-}
+} // namespace base
#define BENCHMARK_TEST(name) \
void Benchmark_##name(); \
@@ -52,5 +55,5 @@ namespace my
void Benchmark_##name()
#define BENCHMARK_N_TIMES(times, maxTimeToSucceed) \
- for (::my::BenchmarkNTimes benchmark(times, maxTimeToSucceed); \
+ for (::base::BenchmarkNTimes benchmark(times, maxTimeToSucceed); \
benchmark.ContinueIterating(); benchmark.NextIteration())
diff --git a/testing/testing.hpp b/testing/testing.hpp
index 8d9d404c00..d0347d4ae9 100644
--- a/testing/testing.hpp
+++ b/testing/testing.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include "testing/testregister.hpp"
#include "base/exception.hpp"
@@ -6,39 +7,37 @@
#include "base/math.hpp"
#include "base/src_point.hpp"
-#include "std/iostream.hpp"
-#include "std/string.hpp"
-
-
-#define UNIT_TEST(name) \
- void UnitTest_##name(); \
- TestRegister g_TestRegister_##name(#name, __FILE__, &UnitTest_##name); \
- void UnitTest_##name()
-
-#define UNIT_CLASS_TEST(CLASS, NAME) \
- struct UnitClass_##CLASS##_##NAME : public CLASS \
- { \
- public: \
- void NAME(); \
- }; \
- UNIT_TEST(CLASS##_##NAME) \
- { \
- UnitClass_##CLASS##_##NAME instance; \
- instance.NAME(); \
- } \
+#include <string>
+
+#define UNIT_TEST(name) \
+ void UnitTest_##name(); \
+ TestRegister g_TestRegister_##name(#name, __FILE__, &UnitTest_##name); \
+ void UnitTest_##name()
+
+#define UNIT_CLASS_TEST(CLASS, NAME) \
+ struct UnitClass_##CLASS##_##NAME : public CLASS \
+ { \
+ public: \
+ void NAME(); \
+ }; \
+ UNIT_TEST(CLASS##_##NAME) \
+ { \
+ UnitClass_##CLASS##_##NAME instance; \
+ instance.NAME(); \
+ } \
void UnitClass_##CLASS##_##NAME::NAME()
DECLARE_EXCEPTION(TestFailureException, RootException);
-namespace my
+namespace base
{
- inline void OnTestFailed(SrcPoint const & srcPoint, string const & msg)
- {
- LOG(LINFO, ("FAILED"));
- LOG(LINFO, (::DebugPrint(srcPoint.FileName()) + ":" + ::DebugPrint(srcPoint.Line()), msg));
- MYTHROW(TestFailureException, (srcPoint.FileName(), srcPoint.Line(), msg));
- }
+inline void OnTestFailed(SrcPoint const & srcPoint, std::string const & msg)
+{
+ LOG(LINFO, ("FAILED"));
+ LOG(LINFO, (::DebugPrint(srcPoint.FileName()) + ":" + ::DebugPrint(srcPoint.Line()), msg));
+ MYTHROW(TestFailureException, (srcPoint.FileName(), srcPoint.Line(), msg));
}
+} // namespace base
namespace testing
{
@@ -53,8 +52,11 @@ void Notify();
struct CommandLineOptions
{
CommandLineOptions()
- : m_filterRegExp(nullptr), m_suppressRegExp(nullptr),
- m_dataPath(nullptr), m_resourcePath(nullptr), m_help(false)
+ : m_filterRegExp(nullptr)
+ , m_suppressRegExp(nullptr)
+ , m_dataPath(nullptr)
+ , m_resourcePath(nullptr)
+ , m_help(false)
{
}
@@ -68,171 +70,173 @@ struct CommandLineOptions
};
CommandLineOptions const & GetTestingOptions();
-#define TEST(X, msg) \
- do \
- { \
- if (X) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), ::my::impl::Message("TEST(" #X ")", ::my::impl::Message msg)); \
- } \
+#define TEST(X, msg) \
+ do \
+ { \
+ if (X) \
+ { \
+ } \
+ else \
+ { \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X ")", ::base::Message msg)); \
+ } \
} while (0)
-#define TEST_EQUAL(X, Y, msg) \
- do \
- { \
- if ((X) == (Y)) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " == " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
- } \
- } while (0)
-#define TEST_NOT_EQUAL(X, Y, msg) \
- do \
- { \
- if ((X) != (Y)) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " != " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
- } \
+
+#define TEST_EQUAL(X, Y, msg) \
+ do \
+ { \
+ if ((X) == (Y)) \
+ { \
+ } \
+ else \
+ { \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " == " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
+ } \
} while (0)
-#define TEST_LESS(X, Y, msg) \
- do \
- { \
- if ((X) < (Y)) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " < " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
- } \
+
+#define TEST_NOT_EQUAL(X, Y, msg) \
+ do \
+ { \
+ if ((X) != (Y)) \
+ { \
+ } \
+ else \
+ { \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " != " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
+ } \
} while (0)
-#define TEST_LESS_OR_EQUAL(X, Y, msg) \
+
+#define TEST_LESS(X, Y, msg) \
do \
{ \
- if ((X) <= (Y)) \
+ if ((X) < (Y)) \
{ \
} \
else \
{ \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " <= " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " < " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
} \
} while (0)
-#define TEST_GREATER(X, Y, msg) \
- do \
- { \
- if ((X) > (Y)) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " > " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
- } \
+
+#define TEST_LESS_OR_EQUAL(X, Y, msg) \
+ do \
+ { \
+ if ((X) <= (Y)) \
+ { \
+ } \
+ else \
+ { \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " <= " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
+ } \
} while (0)
-#define TEST_GREATER_OR_EQUAL(X, Y, msg) \
+
+#define TEST_GREATER(X, Y, msg) \
do \
{ \
- if ((X) >= (Y)) \
+ if ((X) > (Y)) \
{ \
} \
else \
{ \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(" #X " >= " #Y ")", ::my::impl::Message(X, Y), \
- ::my::impl::Message msg)); \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " > " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
} \
} while (0)
-#define TEST_ALMOST_EQUAL_ULPS(X, Y, msg) \
- do \
- { \
- if (::my::AlmostEqualULPs(X, Y)) \
- { \
- } \
- else \
- { \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(my::AlmostEqualULPs(" #X ", " #Y ")", \
- ::my::impl::Message(X, Y), ::my::impl::Message msg)); \
- } \
- } while (0)
-#define TEST_NOT_ALMOST_EQUAL_ULPS(X, Y, msg) \
+
+#define TEST_GREATER_OR_EQUAL(X, Y, msg) \
do \
{ \
- if (!::my::AlmostEqualULPs(X, Y)) \
+ if ((X) >= (Y)) \
{ \
} \
else \
{ \
- ::my::OnTestFailed(SRC(), \
- ::my::impl::Message("TEST(!my::AlmostEqualULPs(" #X ", " #Y ")", \
- ::my::impl::Message(X, Y), ::my::impl::Message msg)); \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(" #X " >= " #Y ")", ::base::Message(X, Y), \
+ ::base::Message msg)); \
} \
} while (0)
-// TODO(AlexZ): Add more cool macroses (or switch all unit tests to gtest).
-#define TEST_THROW(X, exception, msg) \
- do \
- { \
- bool expected_exception = false; \
- try \
- { \
- X; \
- } \
- catch (exception const &) \
- { \
- expected_exception = true; \
- } \
- catch (...) \
- { \
- ::my::OnTestFailed(SRC(), ::my::impl::Message("Unexpected exception at TEST(" #X ")", \
- ::my::impl::Message msg)); \
- } \
- if (!expected_exception) \
- ::my::OnTestFailed(SRC(), ::my::impl::Message("Expected exception " #exception \
- " was not thrown in TEST(" #X ")", \
- ::my::impl::Message msg)); \
- } while (0)
-#define TEST_NO_THROW(X, msg) \
- do \
- { \
- try \
- { \
- X; \
- } \
- catch (...) \
- { \
- ::my::OnTestFailed(SRC(), ::my::impl::Message("Unexpected exception at TEST(" #X ")", \
- ::my::impl::Message msg)); \
- } \
+#define TEST_ALMOST_EQUAL_ULPS(X, Y, msg) \
+ do \
+ { \
+ if (::base::AlmostEqualULPs(X, Y)) \
+ { \
+ } \
+ else \
+ { \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(base::AlmostEqualULPs(" #X ", " #Y ")", \
+ ::base::Message(X, Y), ::base::Message msg)); \
+ } \
} while (0)
-#define TEST_ANY_THROW(X, msg) \
+
+#define TEST_NOT_ALMOST_EQUAL_ULPS(X, Y, msg) \
do \
{ \
- bool was_exception = false; \
- try \
+ if (!::base::AlmostEqualULPs(X, Y)) \
{ \
- X; \
} \
- catch (...) \
+ else \
{ \
- was_exception = true; \
+ ::base::OnTestFailed(SRC(), ::base::Message("TEST(!base::AlmostEqualULPs(" #X ", " #Y ")", \
+ ::base::Message(X, Y), ::base::Message msg)); \
} \
- if (!was_exception) \
- ::my::OnTestFailed(SRC(), ::my::impl::Message("No exceptions were thrown in TEST(" #X ")", \
- ::my::impl::Message msg)); \
+ } while (0)
+
+// TODO(AlexZ): Add more cool macroses (or switch all unit tests to gtest).
+#define TEST_THROW(X, exception, msg) \
+ do \
+ { \
+ bool expected_exception = false; \
+ try \
+ { \
+ X; \
+ } \
+ catch (exception const &) \
+ { \
+ expected_exception = true; \
+ } \
+ catch (...) \
+ { \
+ ::base::OnTestFailed( \
+ SRC(), ::base::Message("Unexpected exception at TEST(" #X ")", ::base::Message msg)); \
+ } \
+ if (!expected_exception) \
+ ::base::OnTestFailed(SRC(), ::base::Message("Expected exception " #exception \
+ " was not thrown in TEST(" #X ")", \
+ ::base::Message msg)); \
+ } while (0)
+
+#define TEST_NO_THROW(X, msg) \
+ do \
+ { \
+ try \
+ { \
+ X; \
+ } \
+ catch (...) \
+ { \
+ ::base::OnTestFailed( \
+ SRC(), ::base::Message("Unexpected exception at TEST(" #X ")", ::base::Message msg)); \
+ } \
+ } while (0)
+
+#define TEST_ANY_THROW(X, msg) \
+ do \
+ { \
+ bool was_exception = false; \
+ try \
+ { \
+ X; \
+ } \
+ catch (...) \
+ { \
+ was_exception = true; \
+ } \
+ if (!was_exception) \
+ ::base::OnTestFailed(SRC(), ::base::Message("No exceptions were thrown in TEST(" #X ")", \
+ ::base::Message msg)); \
} while (0)
diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp
index 35d1a24348..309f74d4f4 100644
--- a/testing/testingmain.cpp
+++ b/testing/testingmain.cpp
@@ -153,9 +153,9 @@ int main(int argc, char * argv[])
UNUSED_VALUE(argv);
#endif
- my::ScopedLogLevelChanger const infoLogLevel(LINFO);
+ base::ScopedLogLevelChanger const infoLogLevel(LINFO);
#if defined(OMIM_OS_MAC) || defined(OMIM_OS_LINUX) || defined(OMIM_OS_IPHONE)
- my::SetLogMessageFn(my::LogMessageTests);
+ base::SetLogMessageFn(base::LogMessageTests);
#endif
vector<string> testNames;
@@ -231,7 +231,7 @@ int main(int argc, char * argv[])
return STATUS_BROKEN_FRAMEWORK;
}
- my::HighResTimer timer(true);
+ base::HighResTimer timer(true);
try
{
diff --git a/testing/testregister.hpp b/testing/testregister.hpp
index 0c2ab2351c..1f36498063 100644
--- a/testing/testregister.hpp
+++ b/testing/testregister.hpp
@@ -1,6 +1,5 @@
#pragma once
-
class TestRegister
{
public:
diff --git a/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp b/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp
index 2d2eca9eb3..5eefe95e81 100644
--- a/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp
+++ b/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp
@@ -391,7 +391,7 @@ void BookMarkSplitPanel::UpdateCompass()
double const dAzimut = GetAzimuth(GetCurMark(), m_northAzimuth);
double dRotateAngle = dAzimut - (math::pi / 2);
AngleIn2Pi(dRotateAngle);
- pCanvas->DrawBitmap(Point(centerX, centerY), *pBTM, Point(imgHeighDiv2, imgHeighDiv2), my::RadToDeg(dRotateAngle));
+ pCanvas->DrawBitmap(Point(centerX, centerY), *pBTM, Point(imgHeighDiv2, imgHeighDiv2), base::RadToDeg(dRotateAngle));
delete pCanvas;
}
}
diff --git a/track_analyzing/log_parser.cpp b/track_analyzing/log_parser.cpp
index 709bea3455..9d6a52a54b 100644
--- a/track_analyzing/log_parser.cpp
+++ b/track_analyzing/log_parser.cpp
@@ -43,7 +43,7 @@ public:
{
numMwmIds.ForEachId([&](routing::NumMwmId numMwmId) {
string const & mwmName = numMwmIds.GetFile(numMwmId).GetName();
- string const polyFile = my::JoinPath(dataDir, BORDERS_DIR, mwmName + BORDERS_EXTENSION);
+ string const polyFile = base::JoinPath(dataDir, BORDERS_DIR, mwmName + BORDERS_EXTENSION);
osm::LoadBorders(polyFile, m_borders[numMwmId]);
});
}
@@ -95,7 +95,7 @@ void LogParser::Parse(string const & logFile, MwmToTracks & mwmToTracks) const
void LogParser::ParseUserTracks(string const & logFile, UserToTrack & userToTrack) const
{
- my::Timer timer;
+ base::Timer timer;
std::ifstream stream(logFile);
if (!stream)
@@ -142,7 +142,7 @@ void LogParser::ParseUserTracks(string const & logFile, UserToTrack & userToTrac
void LogParser::SplitIntoMwms(UserToTrack const & userToTrack, MwmToTracks & mwmToTracks) const
{
- my::Timer timer;
+ base::Timer timer;
PointToMwmId const pointToMwmId(m_mwmTree, *m_numMwmIds, m_dataDir);
diff --git a/track_analyzing/track_analyzer/cmd_gpx.cpp b/track_analyzing/track_analyzer/cmd_gpx.cpp
index 3c274cea2e..257d21f800 100644
--- a/track_analyzing/track_analyzer/cmd_gpx.cpp
+++ b/track_analyzing/track_analyzer/cmd_gpx.cpp
@@ -40,7 +40,7 @@ void CmdGPX(string const & logFile, string const & outputDirName, string const &
if (!userID.empty() && track.first != userID)
continue;
- auto const path = my::JoinPath(outputDirName, mwmName + to_string(i) + ".gpx");
+ auto const path = base::JoinPath(outputDirName, mwmName + to_string(i) + ".gpx");
ofstream ofs(path, ofstream::out);
ofs << "<gpx>\n";
ofs << "<metadata>\n";
diff --git a/track_analyzing/track_analyzer/cmd_match.cpp b/track_analyzing/track_analyzer/cmd_match.cpp
index 7ce446718c..6649c14afb 100644
--- a/track_analyzing/track_analyzer/cmd_match.cpp
+++ b/track_analyzing/track_analyzer/cmd_match.cpp
@@ -25,7 +25,7 @@ namespace
void MatchTracks(MwmToTracks const & mwmToTracks, storage::Storage const & storage,
NumMwmIds const & numMwmIds, MwmToMatchedTracks & mwmToMatchedTracks)
{
- my::Timer timer;
+ base::Timer timer;
uint64_t tracksCount = 0;
uint64_t pointsCount = 0;
diff --git a/track_analyzing/track_analyzer/cmd_table.cpp b/track_analyzing/track_analyzer/cmd_table.cpp
index 584e3b3939..13401e024e 100644
--- a/track_analyzing/track_analyzer/cmd_table.cpp
+++ b/track_analyzing/track_analyzer/cmd_table.cpp
@@ -256,7 +256,7 @@ void CmdTagsTable(string const & filepath, string const & trackExtension, String
}
cout << mwmName << " " << user << " " << trackIdx << " "
- << my::SecondsSinceEpochToString(start) << " " << length << " " << timeElapsed << " "
+ << base::SecondsSinceEpochToString(start) << " " << length << " " << timeElapsed << " "
<< speed << " " << aggregator.GetSummary() << endl;
}
}
diff --git a/track_analyzing/track_analyzer/cmd_track.cpp b/track_analyzing/track_analyzer/cmd_track.cpp
index 1791c627c2..f6d66b5320 100644
--- a/track_analyzing/track_analyzer/cmd_track.cpp
+++ b/track_analyzing/track_analyzer/cmd_track.cpp
@@ -69,7 +69,7 @@ void CmdTrack(string const & trackFile, string const & mwmName, string const & u
if (elapsed != 0)
speed = CalcSpeedKMpH(distance, elapsed);
- LOG(LINFO, (my::SecondsSinceEpochToString(point.GetDataPoint().m_timestamp),
+ LOG(LINFO, (base::SecondsSinceEpochToString(point.GetDataPoint().m_timestamp),
point.GetDataPoint().m_latLon, point.GetSegment(), ", traffic:",
point.GetDataPoint().m_traffic, ", distance:", distance, ", elapsed:", elapsed,
", speed:", speed));
diff --git a/track_analyzing/track_analyzer/cmd_tracks.cpp b/track_analyzing/track_analyzer/cmd_tracks.cpp
index b5e3dfa34d..c4010c2c45 100644
--- a/track_analyzing/track_analyzer/cmd_tracks.cpp
+++ b/track_analyzing/track_analyzer/cmd_tracks.cpp
@@ -183,8 +183,8 @@ void CmdTracks(string const & filepath, string const & trackExtension, StringFil
cout << fixed << setprecision(1) << " points: " << track.size() << ", length: " << length
<< ", duration: " << duration << ", estimated duration: " << estimatedDuration
<< ", speed: " << speed << ", traffic: " << hasTrafficPoints
- << ", departure: " << my::SecondsSinceEpochToString(start.m_timestamp)
- << ", arrival: " << my::SecondsSinceEpochToString(finish.m_timestamp)
+ << ", departure: " << base::SecondsSinceEpochToString(start.m_timestamp)
+ << ", arrival: " << base::SecondsSinceEpochToString(finish.m_timestamp)
<< setprecision(numeric_limits<double>::max_digits10)
<< ", start: " << start.m_latLon.lat << ", " << start.m_latLon.lon
<< ", finish: " << finish.m_latLon.lat << ", " << finish.m_latLon.lon << endl;
diff --git a/track_analyzing/utils.cpp b/track_analyzing/utils.cpp
index f96ff4c9e5..b16cefe377 100644
--- a/track_analyzing/utils.cpp
+++ b/track_analyzing/utils.cpp
@@ -93,7 +93,7 @@ MatchedTrack const & GetMatchedTrack(MwmToMatchedTracks const & mwmToMatchedTrac
std::string GetCurrentVersionMwmFile(storage::Storage const & storage, std::string const & mwmName)
{
- return my::JoinPath(GetPlatform().WritableDir(), to_string(storage.GetCurrentDataVersion()),
+ return base::JoinPath(GetPlatform().WritableDir(), to_string(storage.GetCurrentDataVersion()),
mwmName + DATA_FILE_EXTENSION);
}
@@ -126,7 +126,7 @@ void ForEachTrackFile(
for (string const & file : filesList)
{
- if (my::GetFileExtension(file) != extension)
+ if (base::GetFileExtension(file) != extension)
continue;
MwmToMatchedTracks mwmToMatchedTracks;
diff --git a/track_generator/utils.cpp b/track_generator/utils.cpp
index c3105e5c94..7b2aad6ebe 100644
--- a/track_generator/utils.cpp
+++ b/track_generator/utils.cpp
@@ -103,7 +103,7 @@ void GenerateTracks(string const & inputDir, string const & outputDir, routing::
try
{
kml::DeserializerKml des(data);
- FileReader r(my::JoinPath(inputDir, file));
+ FileReader r(base::JoinPath(inputDir, file));
des.Deserialize(r);
}
catch (FileReader::Exception const & ex)
@@ -132,7 +132,7 @@ void GenerateTracks(string const & inputDir, string const & outputDir, routing::
try
{
kml::SerializerKml ser(data);
- FileWriter sink(my::JoinPath(outputDir, file));
+ FileWriter sink(base::JoinPath(outputDir, file));
ser.Serialize(sink);
}
catch (FileWriter::Exception const & ex)
diff --git a/tracking/reporter.cpp b/tracking/reporter.cpp
index 80250be806..f601229efb 100644
--- a/tracking/reporter.cpp
+++ b/tracking/reporter.cpp
@@ -63,7 +63,7 @@ void Reporter::AddLocation(location::GpsInfo const & info, traffic::SpeedGroup t
if (Platform::GetChargingStatus() != Platform::ChargingStatus::Plugged)
{
- double const currentTime = my::Timer::LocalTime();
+ double const currentTime = base::Timer::LocalTime();
if (currentTime < m_lastNotChargingEvent + kNotChargingEventPeriod)
return;
@@ -135,7 +135,7 @@ bool Reporter::SendPoints()
if (m_wasConnected)
return true;
- double const currentTime = my::Timer::LocalTime();
+ double const currentTime = base::Timer::LocalTime();
if (currentTime < m_lastConnectionAttempt + kReconnectDelaySeconds)
return false;
diff --git a/tracking/tracking_tests/protocol_test.cpp b/tracking/tracking_tests/protocol_test.cpp
index 0bd1f76a86..76cf4640b3 100644
--- a/tracking/tracking_tests/protocol_test.cpp
+++ b/tracking/tracking_tests/protocol_test.cpp
@@ -87,9 +87,9 @@ void DecodeDataPacketVersionTest(Container const & points, Protocol::PacketType
{
TEST_EQUAL(points[i].m_timestamp, result[i].m_timestamp,
(points[i].m_timestamp, result[i].m_timestamp));
- TEST(my::AlmostEqualAbsOrRel(points[i].m_latLon.lat, result[i].m_latLon.lat, kEps),
+ TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lat, result[i].m_latLon.lat, kEps),
(points[i].m_latLon.lat, result[i].m_latLon.lat));
- TEST(my::AlmostEqualAbsOrRel(points[i].m_latLon.lon, result[i].m_latLon.lon, kEps),
+ TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lon, result[i].m_latLon.lon, kEps),
(points[i].m_latLon.lon, result[i].m_latLon.lon));
}
}
diff --git a/tracking/tracking_tests/reporter_test.cpp b/tracking/tracking_tests/reporter_test.cpp
index eb5256006e..17bff04d7c 100644
--- a/tracking/tracking_tests/reporter_test.cpp
+++ b/tracking/tracking_tests/reporter_test.cpp
@@ -66,8 +66,8 @@ void TransferLocation(Reporter & reporter, TestSocket & testSocket, double times
TEST_EQUAL(points.size(), 1, ());
auto const & point = points[0];
TEST_EQUAL(point.m_timestamp, timestamp, ());
- TEST(my::AlmostEqualAbs(point.m_latLon.lat, latidute, 0.001), ());
- TEST(my::AlmostEqualAbs(point.m_latLon.lon, longtitude, 0.001), ());
+ TEST(base::AlmostEqualAbs(point.m_latLon.lat, latidute, 0.001), ());
+ TEST(base::AlmostEqualAbs(point.m_latLon.lon, longtitude, 0.001), ());
}
}
diff --git a/traffic/pytraffic/bindings.cpp b/traffic/pytraffic/bindings.cpp
index 8408055859..d222412c6f 100644
--- a/traffic/pytraffic/bindings.cpp
+++ b/traffic/pytraffic/bindings.cpp
@@ -59,15 +59,15 @@ traffic::TrafficInfo::Coloring TransformToSpeedGroups(SegmentMapping const & seg
double const ws = kv.second.m_weightedSpeed;
double const wrs = kv.second.m_weightedRefSpeed;
double const w = kv.second.m_weight;
- if (my::AlmostEqualAbs(w, 0.0, kEps))
+ if (base::AlmostEqualAbs(w, 0.0, kEps))
{
LOG(LWARNING, ("A traffic segment has zero weight."));
continue;
}
double const u = ws / w;
double const v = wrs / w;
- bool const uz = my::AlmostEqualAbs(u, 0.0, kEps);
- bool const vz = my::AlmostEqualAbs(v, 0.0, kEps);
+ bool const uz = base::AlmostEqualAbs(u, 0.0, kEps);
+ bool const vz = base::AlmostEqualAbs(v, 0.0, kEps);
if (uz && vz)
{
result[kv.first] = traffic::SpeedGroup::TempBlock;
@@ -80,7 +80,7 @@ traffic::TrafficInfo::Coloring TransformToSpeedGroups(SegmentMapping const & seg
else
{
double p = 100.0 * u / v;
- p = my::clamp(p, 0.0, 100.0);
+ p = base::clamp(p, 0.0, 100.0);
result[kv.first] = traffic::GetSpeedGroupByPercentage(p);
}
}
diff --git a/traffic/speed_groups.cpp b/traffic/speed_groups.cpp
index a136e5721d..2083c696b3 100644
--- a/traffic/speed_groups.cpp
+++ b/traffic/speed_groups.cpp
@@ -10,7 +10,7 @@ uint32_t const kSpeedGroupThresholdPercentage[] = {8, 16, 33, 58, 83, 100, 100,
SpeedGroup GetSpeedGroupByPercentage(double p)
{
- p = my::clamp(p, 0.0, 100.0);
+ p = base::clamp(p, 0.0, 100.0);
SpeedGroup res = SpeedGroup::Unknown;
for (int i = static_cast<int>(SpeedGroup::Count) - 1; i >= 0; --i)
{
diff --git a/transit/transit_graph_data.cpp b/transit/transit_graph_data.cpp
index deacdce4d9..838925ed3c 100644
--- a/transit/transit_graph_data.cpp
+++ b/transit/transit_graph_data.cpp
@@ -152,7 +152,7 @@ void DeserializerFromJson::operator()(m2::PointD & p, char const * name)
if (name == nullptr)
item = m_node; // Array item case
else
- item = my::GetJSONObligatoryField(m_node, name);
+ item = base::GetJSONObligatoryField(m_node, name);
CHECK(json_is_object(item), ("Item is not a json object:", name));
FromJSONObject(item, "x", p.x);
@@ -204,7 +204,7 @@ void DeserializerFromJson::operator()(StopIdRanges & rs, char const * name)
}
// GraphData --------------------------------------------------------------------------------------
-void GraphData::DeserializeFromJson(my::Json const & root, OsmIdToFeatureIdsMap const & mapping)
+void GraphData::DeserializeFromJson(base::Json const & root, OsmIdToFeatureIdsMap const & mapping)
{
DeserializerFromJson deserializer(root.get(), mapping);
Visit(deserializer);
diff --git a/transit/transit_graph_data.hpp b/transit/transit_graph_data.hpp
index ed14e8f722..21e82fe2fa 100644
--- a/transit/transit_graph_data.hpp
+++ b/transit/transit_graph_data.hpp
@@ -60,12 +60,12 @@ public:
template <typename T>
void operator()(std::vector<T> & vs, char const * name = nullptr)
{
- auto * arr = my::GetJSONOptionalField(m_node, name);
+ auto * arr = base::GetJSONOptionalField(m_node, name);
if (arr == nullptr)
return;
if (!json_is_array(arr))
- MYTHROW(my::Json::Exception, ("The field", name, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));
size_t const sz = json_array_size(arr);
vs.resize(sz);
for (size_t i = 0; i < sz; ++i)
@@ -83,7 +83,7 @@ public:
{
if (name != nullptr && json_is_object(m_node))
{
- json_t * dictNode = my::GetJSONOptionalField(m_node, name);
+ json_t * dictNode = base::GetJSONOptionalField(m_node, name);
if (dictNode == nullptr)
return; // No such field in json.
@@ -106,7 +106,7 @@ private:
return;
}
- json_struct_t * field = my::GetJSONOptionalField(m_node, name);
+ json_struct_t * field = base::GetJSONOptionalField(m_node, name);
if (field == nullptr)
{
// No optional field |name| at |m_node|. In that case the default value should be set to |t|.
@@ -125,7 +125,7 @@ private:
class GraphData
{
public:
- void DeserializeFromJson(my::Json const & root, OsmIdToFeatureIdsMap const & mapping);
+ void DeserializeFromJson(base::Json const & root, OsmIdToFeatureIdsMap const & mapping);
/// \note This method changes only |m_header| and fills it with correct offsets.
void Serialize(Writer & writer);
void DeserializeAll(Reader & reader);
diff --git a/transit/transit_tests/transit_graph_test.cpp b/transit/transit_tests/transit_graph_test.cpp
index 9d1ee3fd55..119c802a23 100644
--- a/transit/transit_tests/transit_graph_test.cpp
+++ b/transit/transit_tests/transit_graph_test.cpp
@@ -275,7 +275,7 @@ unique_ptr<GraphData> CreateGraphFromJson()
mapping[base::GeoObjectId(105)] = vector<FeatureId>({15});
mapping[base::GeoObjectId(106)] = vector<FeatureId>({16});
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
CHECK(root.get() != nullptr, ("Cannot parse the json."));
graph->DeserializeFromJson(root, mapping);
return graph;
diff --git a/transit/transit_tests/transit_json_parsing_test.cpp b/transit/transit_tests/transit_json_parsing_test.cpp
index 5f6046243a..fd5fcde766 100644
--- a/transit/transit_tests/transit_json_parsing_test.cpp
+++ b/transit/transit_tests/transit_json_parsing_test.cpp
@@ -24,7 +24,7 @@ void TestDeserializerFromJson(string const & jsonBuffer,
OsmIdToFeatureIdsMap const & osmIdToFeatureIds, string const & name,
vector<Obj> const & expected)
{
- my::Json root(jsonBuffer.c_str());
+ base::Json root(jsonBuffer.c_str());
CHECK(root.get() != nullptr, ("Cannot parse the json."));
DeserializerFromJson deserializer(root.get(), osmIdToFeatureIds);
diff --git a/transit/transit_types.cpp b/transit/transit_types.cpp
index 063ebe1d4a..a3256195de 100644
--- a/transit/transit_types.cpp
+++ b/transit/transit_types.cpp
@@ -138,7 +138,7 @@ bool Stop::IsEqualForTesting(Stop const & stop) const
double constexpr kPointsEqualEpsilon = 1e-6;
return m_id == stop.m_id && m_featureIdentifiers == stop.m_featureIdentifiers &&
m_transferId == stop.m_transferId && m_lineIds == stop.m_lineIds &&
- my::AlmostEqualAbs(m_point, stop.m_point, kPointsEqualEpsilon) &&
+ base::AlmostEqualAbs(m_point, stop.m_point, kPointsEqualEpsilon) &&
m_titleAnchors == stop.m_titleAnchors;
}
@@ -199,7 +199,7 @@ bool Gate::IsEqualForTesting(Gate const & gate) const
{
return m_featureIdentifiers == gate.m_featureIdentifiers && m_entrance == gate.m_entrance &&
m_exit == gate.m_exit && m_weight == gate.m_weight && m_stopIds == gate.m_stopIds &&
- my::AlmostEqualAbs(m_point, gate.m_point, kPointsEqualEpsilon);
+ base::AlmostEqualAbs(m_point, gate.m_point, kPointsEqualEpsilon);
}
bool Gate::IsValid() const
@@ -310,7 +310,7 @@ Transfer::Transfer(StopId id, m2::PointD const & point, std::vector<StopId> cons
bool Transfer::IsEqualForTesting(Transfer const & transfer) const
{
return m_id == transfer.m_id &&
- my::AlmostEqualAbs(m_point, transfer.m_point, kPointsEqualEpsilon) &&
+ base::AlmostEqualAbs(m_point, transfer.m_point, kPointsEqualEpsilon) &&
m_stopIds == transfer.m_stopIds && m_titleAnchors == transfer.m_titleAnchors;
}
@@ -355,7 +355,7 @@ bool Shape::IsEqualForTesting(Shape const & shape) const
for (size_t i = 0; i < m_polyline.size(); ++i)
{
- if (!my::AlmostEqualAbs(m_polyline[i], shape.m_polyline[i], kPointsEqualEpsilon))
+ if (!base::AlmostEqualAbs(m_polyline[i], shape.m_polyline[i], kPointsEqualEpsilon))
return false;
}
return true;
diff --git a/ugc/index_migration/utility.cpp b/ugc/index_migration/utility.cpp
index 0275c0a38a..2f8806c44b 100644
--- a/ugc/index_migration/utility.cpp
+++ b/ugc/index_migration/utility.cpp
@@ -26,7 +26,7 @@ using MigrationTables = unordered_map<int64_t, MigrationTable>;
bool GetMigrationTable(int64_t tableVersion, MigrationTable & t)
{
- auto const fileName = my::JoinPath(kMigrationDirName, to_string(tableVersion) + kBinExt);
+ auto const fileName = base::JoinPath(kMigrationDirName, to_string(tableVersion) + kBinExt);
try
{
auto reader = GetPlatform().GetReader(fileName);
diff --git a/ugc/serdes_json.hpp b/ugc/serdes_json.hpp
index 5986343bc1..80458046af 100644
--- a/ugc/serdes_json.hpp
+++ b/ugc/serdes_json.hpp
@@ -58,7 +58,7 @@ public:
template <typename T>
void operator()(vector<T> const & vs, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONArray(), name, [this, &vs] {
+ NewScopeWith(base::NewJSONArray(), name, [this, &vs] {
for (auto const & v : vs)
(*this)(v);
});
@@ -67,7 +67,7 @@ public:
template <typename R, EnableIfNotEnum<R> * = nullptr>
void operator()(R const & r, char const * name = nullptr)
{
- NewScopeWith(my::NewJSONObject(), name, [this, &r] { r.Visit(*this); });
+ NewScopeWith(base::NewJSONObject(), name, [this, &r] { r.Visit(*this); });
}
template <typename T, EnableIfEnum<T> * = nullptr>
@@ -116,9 +116,9 @@ public:
private:
template <typename Fn>
- void NewScopeWith(my::JSONPtr json_object, char const * name, Fn && fn)
+ void NewScopeWith(base::JSONPtr json_object, char const * name, Fn && fn)
{
- my::JSONPtr safe_json = std::move(m_json);
+ base::JSONPtr safe_json = std::move(m_json);
m_json = std::move(json_object);
fn();
@@ -132,7 +132,7 @@ private:
m_json = std::move(safe_json);
}
- my::JSONPtr m_json = nullptr;
+ base::JSONPtr m_json = nullptr;
Sink & m_sink;
};
@@ -189,7 +189,7 @@ public:
json_t * context = SaveContext(name);
if (!json_is_array(m_json))
- MYTHROW(my::Json::Exception, ("The field", name, "must contain a json array."));
+ MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));
vs.resize(json_array_size(m_json));
for (size_t index = 0; index < vs.size(); ++index)
@@ -257,7 +257,7 @@ public:
template <typename Optional>
void operator()(Optional & opt, Optional const & defaultValue, char const * name = nullptr)
{
- auto json = my::GetJSONOptionalField(m_json, name);
+ auto json = base::GetJSONOptionalField(m_json, name);
if (!json)
{
opt = defaultValue;
@@ -272,7 +272,7 @@ private:
{
json_t * context = m_json;
if (name)
- m_json = my::GetJSONObligatoryField(context, name);
+ m_json = base::GetJSONObligatoryField(context, name);
return context;
}
@@ -282,7 +282,7 @@ private:
m_json = context;
}
- my::Json m_jsonObject;
+ base::Json m_jsonObject;
json_t * m_json = nullptr;
};
} // namespace ugc
diff --git a/ugc/storage.cpp b/ugc/storage.cpp
index d475b54620..41f3a477a0 100644
--- a/ugc/storage.cpp
+++ b/ugc/storage.cpp
@@ -38,9 +38,9 @@ string const kTmpFileExtension = ".tmp";
using Sink = MemWriter<string>;
-string GetUGCFilePath() { return my::JoinPath(GetPlatform().SettingsDir(), kUGCUpdateFileName); }
+string GetUGCFilePath() { return base::JoinPath(GetPlatform().SettingsDir(), kUGCUpdateFileName); }
-string GetIndexFilePath() { return my::JoinPath(GetPlatform().SettingsDir(), kIndexFileName); }
+string GetIndexFilePath() { return base::JoinPath(GetPlatform().SettingsDir(), kIndexFileName); }
bool GetUGCFileSize(uint64_t & size)
{
@@ -71,7 +71,7 @@ string SerializeIndexes(ugc::UpdateIndexes const & indexes)
if (indexes.empty())
return string();
- auto array = my::NewJSONArray();
+ auto array = base::NewJSONArray();
for (auto const & index : indexes)
{
string data;
@@ -81,7 +81,7 @@ string SerializeIndexes(ugc::UpdateIndexes const & indexes)
ser(index);
}
- my::Json node(data);
+ base::Json node(data);
json_array_append_new(array.get(), node.get_deep_copy());
}
@@ -255,15 +255,15 @@ void Storage::Migrate(string const & indexFilePath)
// Backup existing files
auto const v0IndexFilePath = indexFilePath + suffix;
auto const v0UGCFilePath = ugcFilePath + suffix;
- if (!my::CopyFileX(indexFilePath, v0IndexFilePath))
+ if (!base::CopyFileX(indexFilePath, v0IndexFilePath))
{
LOG(LERROR, ("Can't backup UGC index file"));
return;
}
- if (!my::CopyFileX(ugcFilePath, v0UGCFilePath))
+ if (!base::CopyFileX(ugcFilePath, v0UGCFilePath))
{
- my::DeleteFileX(v0IndexFilePath);
+ base::DeleteFileX(v0IndexFilePath);
LOG(LERROR, ("Can't backup UGC update file"));
return;
}
@@ -277,10 +277,10 @@ void Storage::Migrate(string const & indexFilePath)
case migration::Result::Success:
if (!SaveIndex(indexFilePath))
{
- my::DeleteFileX(indexFilePath);
- my::DeleteFileX(ugcFilePath);
- my::RenameFileX(v0UGCFilePath, ugcFilePath);
- my::RenameFileX(v0IndexFilePath, indexFilePath);
+ base::DeleteFileX(indexFilePath);
+ base::DeleteFileX(ugcFilePath);
+ base::RenameFileX(v0UGCFilePath, ugcFilePath);
+ base::RenameFileX(v0IndexFilePath, indexFilePath);
m_indexes.clear();
LOG(LERROR, ("Can't save UGC index after migration"));
return;
@@ -306,7 +306,7 @@ bool Storage::SaveIndex(std::string const & pathToTargetFile /* = "" */) const
catch (FileWriter::Exception const & exception)
{
LOG(LERROR, ("Exception while writing file:", indexFilePath, "reason:", exception.what()));
- my::DeleteFileX(indexFilePath);
+ base::DeleteFileX(indexFilePath);
return false;
}
@@ -360,8 +360,8 @@ void Storage::DefragmentationImpl(bool force)
}
base::EraseIf(m_indexes, [](UpdateIndex const & i) -> bool { return i.m_deleted; });
- CHECK(my::DeleteFileX(ugcFilePath), ());
- CHECK(my::RenameFileX(tmpUGCFilePath, ugcFilePath), ());
+ CHECK(base::DeleteFileX(ugcFilePath), ());
+ CHECK(base::RenameFileX(tmpUGCFilePath, ugcFilePath), ());
m_numberOfDeleted = 0;
}
@@ -371,7 +371,7 @@ string Storage::GetUGCToSend() const
if (m_indexes.empty())
return string();
- auto array = my::NewJSONArray();
+ auto array = base::NewJSONArray();
auto const indexesSize = m_indexes.size();
auto const ugcFilePath = GetUGCFilePath();
FileReader r(ugcFilePath);
@@ -408,8 +408,8 @@ string Storage::GetUGCToSend() const
ser(update);
}
- my::Json serializedUgc(data);
- auto embeddedNode = my::NewJSONObject();
+ base::Json serializedUgc(data);
+ auto embeddedNode = base::NewJSONObject();
ToJSONObject(*embeddedNode.get(), "data_version", index.m_dataVersion);
ToJSONObject(*embeddedNode.get(), "mwm_name", index.m_mwmName);
ToJSONObject(*embeddedNode.get(), "feature_id", index.m_featureId);
@@ -423,7 +423,7 @@ string Storage::GetUGCToSend() const
if (json_array_size(array.get()) == 0)
return string();
- auto reviewsNode = my::NewJSONObject();
+ auto reviewsNode = base::NewJSONObject();
ToJSONObject(*reviewsNode.get(), "reviews", *array.release());
unique_ptr<char, JSONFreeDeleter> buffer(json_dumps(reviewsNode.get(), JSON_COMPACT | JSON_ENSURE_ASCII));
@@ -461,7 +461,7 @@ void Storage::MarkAllAsSynchronized()
return;
auto const indexPath = GetIndexFilePath();
- my::DeleteFileX(indexPath);
+ base::DeleteFileX(indexPath);
SaveIndex();
}
diff --git a/ugc/types.hpp b/ugc/types.hpp
index 327b174280..d1581d9cb9 100644
--- a/ugc/types.hpp
+++ b/ugc/types.hpp
@@ -332,7 +332,7 @@ struct UGC
bool operator==(UGC const & rhs) const
{
return m_ratings == rhs.m_ratings && m_reviews == rhs.m_reviews &&
- my::AlmostEqualAbs(m_totalRating, rhs.m_totalRating, 1e-6f) && m_basedOn == rhs.m_basedOn;
+ base::AlmostEqualAbs(m_totalRating, rhs.m_totalRating, 1e-6f) && m_basedOn == rhs.m_basedOn;
}
bool IsEmpty() const
diff --git a/ugc/ugc_tests/migration/generate_migration_files.cpp b/ugc/ugc_tests/migration/generate_migration_files.cpp
index f903a86cb5..8d125672aa 100644
--- a/ugc/ugc_tests/migration/generate_migration_files.cpp
+++ b/ugc/ugc_tests/migration/generate_migration_files.cpp
@@ -41,19 +41,19 @@ string const kBinFileExtension = ".bin";
string GetUGCDirPath()
{
- return my::JoinPath(GetPlatform().WritableDir(), "ugc_migration");
+ return base::JoinPath(GetPlatform().WritableDir(), "ugc_migration");
}
void LoadClassificatorTypesForVersion(string const & version)
{
- auto const folderPath = my::JoinPath("ugc_migration_supported_files", version);
+ auto const folderPath = base::JoinPath("ugc_migration_supported_files", version);
auto const & p = GetPlatform();
using Inflate = coding::ZLib::Inflate;
string classificator;
{
- auto const r = p.GetReader(my::JoinPath(folderPath, kClassificatorFileName));
+ auto const r = p.GetReader(base::JoinPath(folderPath, kClassificatorFileName));
string data;
r->ReadAsString(data);
Inflate inflate(Inflate::Format::GZip);
@@ -62,7 +62,7 @@ void LoadClassificatorTypesForVersion(string const & version)
string types;
{
- auto const r = p.GetReader(my::JoinPath(folderPath, kTypesFileName));
+ auto const r = p.GetReader(base::JoinPath(folderPath, kTypesFileName));
string data;
r->ReadAsString(data);
Inflate inflate(Inflate::Format::GZip);
@@ -74,7 +74,7 @@ void LoadClassificatorTypesForVersion(string const & version)
void LoadTableForVersion(string const & version, MigrationTable & table)
{
- Source source(FileReader(my::JoinPath(GetUGCDirPath(), version + kBinFileExtension)));
+ Source source(FileReader(base::JoinPath(GetUGCDirPath(), version + kBinFileExtension)));
ugc::DeserializerV0<Source> des(source);
des(table);
}
@@ -98,7 +98,7 @@ UNIT_TEST(UGC_GenerateMigrationFiles)
c.ForEachTree(parse);
auto const fileName = v + kBinFileExtension;
- auto const filePath = my::JoinPath(ugcDirPath, fileName);
+ auto const filePath = base::JoinPath(ugcDirPath, fileName);
{
FileWriter sink(filePath, FileWriter::Op::OP_WRITE_TRUNCATE);
ugc::Serializer<FileWriter> ser(sink);
diff --git a/ugc/ugc_tests/storage_tests.cpp b/ugc/ugc_tests/storage_tests.cpp
index 3efd701dd8..e7e0e6ec56 100644
--- a/ugc/ugc_tests/storage_tests.cpp
+++ b/ugc/ugc_tests/storage_tests.cpp
@@ -47,7 +47,7 @@ string const kTestMwmName = "ugc storage test";
bool DeleteIndexFile(ugc::IndexVersion v = ugc::IndexVersion::Latest)
{
if (v == ugc::IndexVersion::Latest)
- return my::DeleteFileX(my::JoinPath(GetPlatform().WritableDir(), "index.json"));
+ return base::DeleteFileX(base::JoinPath(GetPlatform().WritableDir(), "index.json"));
string version;
switch (v)
@@ -60,13 +60,13 @@ bool DeleteIndexFile(ugc::IndexVersion v = ugc::IndexVersion::Latest)
break;
}
- return my::DeleteFileX(my::JoinPath(GetPlatform().WritableDir(), "index.json." + version));
+ return base::DeleteFileX(base::JoinPath(GetPlatform().WritableDir(), "index.json." + version));
}
bool DeleteUGCFile(ugc::IndexVersion v = ugc::IndexVersion::Latest)
{
if (v == ugc::IndexVersion::Latest)
- return my::DeleteFileX(my::JoinPath(GetPlatform().WritableDir(), "ugc.update.bin"));
+ return base::DeleteFileX(base::JoinPath(GetPlatform().WritableDir(), "ugc.update.bin"));
string version;
@@ -80,7 +80,7 @@ bool DeleteUGCFile(ugc::IndexVersion v = ugc::IndexVersion::Latest)
break;
}
- return my::DeleteFileX(my::JoinPath(GetPlatform().WritableDir(), "ugc.update.bin." + version));
+ return base::DeleteFileX(base::JoinPath(GetPlatform().WritableDir(), "ugc.update.bin." + version));
}
} // namespace
@@ -329,7 +329,7 @@ UNIT_CLASS_TEST(StorageTest, ContentTest)
ser(newUGC);
}
- my::Json ugcNode(data);
+ base::Json ugcNode(data);
auto const & indexes = storage.GetIndexesForTesting();
TEST_EQUAL(indexes.size(), 2, ());
auto const & firstIndex = indexes.front();
@@ -339,7 +339,7 @@ UNIT_CLASS_TEST(StorageTest, ContentTest)
TEST(!firstIndex.m_synchronized, ());
TEST(!lastIndex.m_synchronized, ());
- auto embeddedNode = my::NewJSONObject();
+ auto embeddedNode = base::NewJSONObject();
ToJSONObject(*embeddedNode.get(), "data_version", lastIndex.m_dataVersion);
ToJSONObject(*embeddedNode.get(), "mwm_name", lastIndex.m_mwmName);
ToJSONObject(*embeddedNode.get(), "feature_id", lastIndex.m_featureId);
@@ -347,9 +347,9 @@ UNIT_CLASS_TEST(StorageTest, ContentTest)
ToJSONObject(*embeddedNode.get(), "feature_type", c.GetReadableObjectName(c.GetTypeForIndex(lastIndex.m_matchingType)));
ToJSONObject(*ugcNode.get(), "feature", *embeddedNode.release());
- auto array = my::NewJSONArray();
+ auto array = base::NewJSONArray();
json_array_append_new(array.get(), ugcNode.get_deep_copy());
- auto reviewsNode = my::NewJSONObject();
+ auto reviewsNode = base::NewJSONObject();
ToJSONObject(*reviewsNode.get(), "reviews", *array.release());
unique_ptr<char, JSONFreeDeleter> buffer(json_dumps(reviewsNode.get(), JSON_COMPACT | JSON_ENSURE_ASCII));
string const toSendExpected(buffer.get());
@@ -476,11 +476,11 @@ UNIT_TEST(UGC_IndexMigrationFromV0ToV1Smoke)
auto & p = GetPlatform();
auto const version = "v0";
auto const indexFileName = "index.json";
- auto const folder = my::JoinPath(p.WritableDir(), "ugc_migration_supported_files", "test_index", version);
- auto const indexFilePath = my::JoinPath(folder, indexFileName);
+ auto const folder = base::JoinPath(p.WritableDir(), "ugc_migration_supported_files", "test_index", version);
+ auto const indexFilePath = base::JoinPath(folder, indexFileName);
{
using Inflate = coding::ZLib::Inflate;
- auto const r = p.GetReader(my::JoinPath(folder, "index.gz"));
+ auto const r = p.GetReader(base::JoinPath(folder, "index.gz"));
string data;
r->ReadAsString(data);
Inflate inflate(Inflate::Format::GZip);
@@ -499,8 +499,8 @@ UNIT_TEST(UGC_IndexMigrationFromV0ToV1Smoke)
s.LoadForTesting(indexFilePath);
uint64_t migratedIndexFileSize = 0;
uint64_t v0IndexFileSize = 0;
- TEST(my::GetFileSize(indexFilePath, migratedIndexFileSize), ());
- TEST(my::GetFileSize(v0IndexFilePath, v0IndexFileSize), ());
+ TEST(base::GetFileSize(indexFilePath, migratedIndexFileSize), ());
+ TEST(base::GetFileSize(v0IndexFilePath, v0IndexFileSize), ());
TEST_GREATER(migratedIndexFileSize, 0, ());
TEST_GREATER(v0IndexFileSize, 0, ());
auto const & indexes = s.GetIndexesForTesting();
@@ -525,8 +525,8 @@ UNIT_TEST(UGC_IndexMigrationFromV0ToV1Smoke)
}
}
- my::DeleteFileX(indexFilePath);
- my::DeleteFileX(v0IndexFilePath);
+ base::DeleteFileX(indexFilePath);
+ base::DeleteFileX(v0IndexFilePath);
}
UNIT_TEST(UGC_NoReviews)